Get Started On Celo With Infura RPC Endpoints

Onboarding the next wave of users for Web3 is a massive task that many projects in the ecosystem are building towards. One project with a unique approach to this is Celo, a layer-one blockchain network. Celo provides a superior new user experience by being a mobile-first layer-1 blockchain that is easy to use with just a mobile phone. Your phone number acts as your address rather than a complex string, and the network allows users to pay gas fees with tokens other than the native currency.

However, the user experience is only one side of the onboarding coin. Developer experience is the second. After all, a new network is only as good as the RPCs that let you use it. Only some developers have the resources to run a node.

Infura, one of the most popular Web3 node providers, now offers Celo Network RPC nodes to all users. So if you want to start building on this mobile-first network, there’s never been a better time. Before you start building, let’s learn more about Celo.

This article will provide a high-level overview of the Celo Blockchain Network and how you can start building on it using Infura.

What is Celo?

Celo is a high-throughput layer-1 network that focuses on mobile users.

Association of telephone numbers with public keys

Celo is easier for mobile phone users than other networks. Celo maps phone numbers to public keys, allowing users to send tokens to people who don’t have wallets. A decentralized attestation protocol performs the mapping and links an account to a phone number. This service never receives the phone number in plain text to preserve privacy.

How Celo's attestation protocol works

How Celo’s attestation protocol works – Picture from celo.org

As a result, the user experience is better than most blockchains, as all interactions are via phone numbers rather than 30+ character long strings that are easy to make mistakes with and impossible to remember.

Payment of gas fees with ERC-20 tokens

Another usability hurdle is that most networks require users to pay gas fees with a native token. This results in users exchanging other tokens with natives just to be able to send transactions.

This is a problem for two reasons. First, it adds a non-trivial step to each transaction if the user does not have enough native tokens. Second, exchanging tokens is taxable in some countries, so they have to keep track of every time they exchange to a native token just to cover gas fees.

With Celo, you can pay with any approved ERC-20 token currently available, even stablecoins, lowering yet another barrier to entry and making costs more predictable. There is one caveat though: transactions paid with non-CELO gas currencies will cost around 50,000 extra gas. It is also important to note that there is an adjustable list of accepted currencies.

In development, Celo comes with a dApp SDK called ContractKit. This SDK is a bundle of packages that make building on Celo more straightforward. Connect, one of ContractKit’s main packages, acts as a wrapper around web3.js that handles the various currencies to pay the fees.

You can set your preferred currency as the default for all transactions, as in this example:

import { CeloContract } from "@celo/contractkit"

const accounts = await kit.web3.eth.getAccounts()
kit.defaultAccount = accounts[0]
await kit.setFeeCurrency(CeloContract.StableToken)

With this in your code you set the default currency if feeCurrency field is left blank when you submit a transaction. The user can still choose a different currency to use.

ContractKit comes with a list of contract addresses that includes all Celo core currencies. In the example CeloContract.StableToken refers to cUSD.

It is also possible to set your preferred currency per transaction. In this example we send cUSD and also pay with cUSD.

const contract = await kit.contracts.getStableToken()
await contract.transfer(recipientAddress, amount)
  .send({ feeCurrency: contract.address })

Celo’s virtual machine is also EVM compatible as it originated as a fork of Geth. This compatibility allows you to reuse most of your Solidity skills when implementing your smart contracts on Celo. However, there are some notable differences.

The first difference is that transaction objects have additional fields such as feeCurrency, gatewayFeeand gatewayFeeRecipient. They provide full-node incentives and allow users to pay their gas fees with different tokens. This does not affect you when transferring smart contracts from Ethereum to Celo, but it can be a problem when transferring from Celo to Ethereum.

The second difference may have implications for your Ethereum-based smart contracts. That DIFFICULTY and GASLIMIT opcodes are not supported and the fields are also missing in block headers.

A third difference is that the main diversion pathway is m/44'/52752'/0'/0 and not m/44'/60'/0'/0 just like in Ethereum. Essentially, this derivation path allows wallets to generate different keys from a seed set.

The network is carbon negative

CO2 production from blockchain networks has been a big talking point for the past few years. Coming from Bitcoin, many of the early networks used the Proof-of-Work consensus algorithm to eliminate Sybil attacks.

The Celo protocol uses BFT Proof-of-Stake, which minimizes network energy consumption by over 90%. Plus, it can create a new block in five seconds, less than half the time it takes Ethereum.

Also, all blocks are completed immediately, so you and your users don’t have to wait for their actions to be written on the chain.

All this optimization still produces CO2, so Celo uses projects like Wren, a carbon offset subscription service that offsets 65.7 tons of CO2 monthly to become CO2 negative. With technology-funded rainforest protection, Celo has already saved over 30,000 tons of CO2.

Why use Celo with Infura?

Infura offers free RPCs to prominent wallets, and many large Web3 projects use them as their RPC provider, including Brave, Uniswap, Compound, Gnosis, and Maker, to name just a few. In addition, Infura has achieved 99.99% uptime and about 10 times faster response times than other service providers such as Alchemy or Quicknode.

ConsenSys, the company behind Infura, has also created and maintained important Web3 projects such as MetaMask and Truffle Suite. So the shared know-how of creating wallets, developer tools and RPCs creates synergies you don’t get from any other RPC provider. This also means you get reliable and complementary end-to-end tools from the ConsenSys suite of products that perfectly integrate with Infura RPCs.

With the release of Celo RPCs, Infura now supports 10 different networks, allowing you to build on multiple chains at once. Best of all, accessing these networks and their archived data is free!

Summary

Celo is an exciting chain that tackles Web3 user and developer experience pain points with innovative solutions. With its mobile-first approach, users can interact with the network and receive tokens with their phone number instead of a crypto wallet, making onboarding to the network easier for Web3 newcomers.

With the ability to pay gas fees with other tokens instead of the native currency, Celo also removed a massive obstacle in the day-to-day use of a blockchain network. Other networks require fees paid with a native and potentially volatile token.

Now that Infura is offering RPC nodes for the Celo network, it’s the perfect time to start building on this mobile-first blockchain network. For more information, check out Infura’s docs.

William

Leave a Reply

Your email address will not be published. Required fields are marked *