Remix is an in-browser Solidity IDE that’s used to write, compile and debug Solidity code. Solidity is a high-level, contract-oriented programming language for writing smart contracts. Celo is a close cousin of Ethereum so Celo developers can use many of the resources available for ethereum, Remix being one of them. In this tutorial, we will learn how to set up our development environment on Remix so that we can deploy and interact with celo smart contracts on Alfajores testnet and mainnet directly from Remix.
- Chromium based browser (Example- Google Chrome and Brave)
- Celo Extension Wallet can be downloaded from here.
- Funds to deploy contracts on the blockchain. Faucet for Alfajores Testnet can be reached from here.
- Some previous experience of working with Metamask, Solidity and Remix.
Head over to Remix and click on
Plugin Manger. Here search for Celo Plugin and click on Activate.
Now we should be able to see Celo icon in Icon Tray.
Our development area should look like this.
After making sure we have selected Alfajores testnet account in Celo Extension Wallet 1. Click on the Connect button in the account tab. 2. Allow celo-extension-wallet to connect to Remix.
Now we will be able to see our Celo Balance in the Balance tab.
MAKE SURE NETWORK SELECTED IS
We will deploy a very simple smart contract for this tutorial.
Create a new file named
simple_contract.solfrom file explorer and copy the following content.
Let's go back to Celo Plugin and click on Compile.
After compiling the successfully, we are ready to deploy our contract.
Click on the Deploy button and sign the transaction using your wallet.
Yay! we have successfully deployed our contract to the Alfajores Testnet. We can check the status of the transaction on Alfajores Blockscout by pasting the transaction hash.
Now try playing around with the store and retrieve the functionality of our smart contract. We can use similar instructions for deploying contracts on mainnet by selecting Celo Main Network in celo-extension-wallet but we will need real celo in that case.
If you have both metamask and Celo extension wallet installed then this problem can arise. You can uninstall metamask and everything will work fine. If you don't want to remove metamask extension then you can work with celo extension wallet in incognito mode. Just click on the Extensions icon on the chrome extension tray, select celo extension wallet and click on options, and select manage extension, Here click on allow In Incognito. Now you are all set to go.
Celo extension requires your cookie permissions to work properly which is not given by default in incognito mode. Head over to
chrome://settings/content/cookiesand select allow all cookies option in general settings.