A Comprehensive Developer’s Guide for EVM Smart Contract on IRISHUB
— Dive into the guide and transform infinite possibilities into reality!
Dear IRISgardians,
With the successful upgrade, IRISHUB 2.0 is now featuring integrated EVM capabilities for developers to effortlessly build dApps using EVM smart contracts. The first ERC-721 smart contract and its accompanying NFT have already been issued on IRISHUB.
Now it’s your turn to innovate. Our all-inclusive developer guide will teach you how to harness IRISHUB’s EVM compatibility to create next-gen dApps. Dive into the guide and transform infinite possibilities into reality!
Developer Guide Overview
Embrace the ease of constructing and deploying EVM smart contracts with IRISHub to create the foundation for your dApps. With full EVM compatibility, IRISHUB grants you access to familiar tools (e.g., Solidity, Remix, and Oracles) and APIs (like Ethereum JSON-RPC) from the EVM ecosystem.
Capitalize on the inherent interoperability of Cosmos chains, as IRISHUB lets you develop scalable cross-chain applications in a well-known EVM environment. Explore the essential components for building and deploying EVM smart contracts on IRISHUB in our comprehensive guide below.
Part 1: Build Smart Contracts with Solidity
Part 2: Prepare an Account for EVM Integration
Part 3: Deploy Smart Contracts Using Remix
Unlock the full potential of EVM smart contract development on IRISHUB today!
Part 1: Build Smart Contracts with Solidity
You can develop EVM smart contracts on IRISHUB using Solidity, which is also used on Ethereum. If you have deployed smart contracts on Ethereum or any other EVM-compatible chain, you can use the same contracts on IRISHUB.
Since it is the most widely used smart contract programming language in Blockchain, Solidity comes with well-documented and rich language support.
Part 2: Prepare an Account for EVM
You might already have an EVM account and hold its mnemonic phrase, but on IRISHUB, EVM accounts are displayed with the iaa
prefix.
1. Generate or Recover your EVM account on IRISHUB
iris keys add <key-name> --algo eth_secp256k1
# or you can choose to recover one
iris keys add <key-name> --algo eth_secp256k1 --recover
2. Import/Export your EVM private key
You can import the private key of your EVM account to generate an iaa
account on IRISHUB with the following command:
iris keys unsafe-import-eth-key <key-name> <private-key>
Likewise, you can export the EVM private key of youriaa
account using the following command:
iris keys unsafe-export-eth-key <key-name>
3. Exchange ERIS on IRISHUB
IRISHub uses eris
as the EVM token, which is pegged 1:1 with iris
. You can exchange them using the following command:
iris tx token swap-fee 100iris --from <sender> --to <recipient>
> balances:
- denom: eris
amount: "100.000000000000000000"
Part 3: Deploy Smart Contracts with Remix
Remix is an in-browser IDE for Solidity smart contracts. In this guide, we will guide you to know how to deploy a contract to a running Ethermint network through Remix and interact with it.
1. Add Network with Metamask
Before diving into Remix for smart contract development and deployment, you need to first add a custom network for IRISHUB with MetaMask.
a. Launch the MetaMask extension in your browser.
b. Log in to your MetaMask account.
c. Click on the top-right circular icon, then navigate to Settings > Networks
.
d. Select the Add Network
button and fill in the form using the following example, making sure to replace your application ChainID:
Network Name: IRISHub 2.0
RPC URL: https://evmrpc.irishub-1.irisnet.org
ChainID: 6688
Symbol: ERIS
Alternatively, you can search for IRIS on Chainlist to quickly connect your wallet to the IRISHUB network.
Now you can export your private key from the terminal using the following command:
iris keys unsafe-export-eth-key <key-name>
Go back to the browser and select the Private Key option. Then paste the private key exported from the unsafe-export-eth-key
command.
2. Connect the IRISHUB account to Remix
Start your IRISHUB daemon and rest server, or just connect to the remote server, based on your network configuration.
Once that is complete, go to Remix. There are some contracts in the File Explorer
. Select any of these contracts. On the left-most bar, select theSolidity compiler
and compile the contract.
Next, select the Deploy and run transaction
. Note that you should change the environment to Injected Provider
. This will open a Metamask popup for you to confirm connecting your Metamask to Remix.
3. Deploy and Interact
Now that your account is connected, you are able to deploy the contract. Press the Deploy
button. A Metamask pop-up will appear asking you to confirm the transaction.
Once the contract has been successfully deployed, you will see it show up in the Deployed Contracts
section on the left-hand side, as well as a green check in the Remix console showing the transaction details.
Once you’ve completed the steps, you can use Remix to interact with the contract.