Deploying EVM Smart Contract
In this guide, we will walk through deploying a simple Solidity smart contract on Umi. We'll use a basic counter example, build the contract and deploy it with Hardhat.
1. Setting Up the Hardhat Environment
-
Install Hardhat and required dependencies:
-
Initialize a Hardhat project:
Follow steps with the
Create a TypeScript project
option. -
Add the Umi plugin and network description to
hardhat.config.ts
:Make sure to put in your private key in place of
YOUR_PRIVATE_KEY
. You can obtain this key from your crypto wallet. We recommend creating a burner account for testing.
2. Creating a Solidty Smart Contract
We'll start with a simple counter contract that increments a stored value. First, replace the existing Lock
project with the Counter
project.
Change the content of the Counter.sol
Solidity file with:
Finally let's compile the Solidity contract, from the top project folder:
3. Deploying the Contract
-
Create a script to deploy the generated contract artifact. Create a file under
scripts/deploy.ts
with the following code. Make sure thescripts
folder is inside the Hardhat folder and not thecontracts
project folder. -
Ensure your wallet has sufficient test ETH for the address used above. Get tokens from the Faucet.
-
Deploy the contract using a single command, Hardhat takes care of the rest:
The contract should deploy successfully and display its address.
-
After deployment, locate your contract on the Umi block explorer. Search the deployer address to verify its status and details.
With these steps, you've successfully deployed and now checkout Use Contract to interact with your Solidity smart contract!
Interacting with Your Deployed Move Smart Contract
In this guide, we will create a simple website that interacts with your deployed Move smart contract. The website will allow users to increment the counter and display its current value using Move transactions and Viem SDK.
Interacting with Solidity Contract
In this guide, we will create a simple website that interacts with your deployed Solidity smart contract. The website will allow users to increment the counter and display its current value using Solidity transactions and Viem SDK.