Deploy on EVM (Hardhat)
Last updated
Last updated
Create a wallet using Metamask () and request funds from the for your new account.
Once your account is funded, download Node.js:
required
Let's create a project with Hardhat. Create a new folder and run the following command inside:
The command will initialize a new npm
project and install Hardhat locally.
Initialize a new Hardhat project
Select TypeScript
as the project type, and for the rest of the questions, such as .gitignore and sample project, choose y
or yes
Open the hardhat.config.ts
file generated by the previous command, and replace its content with the following:
To install hardhat-toolbox
, run the following command:
To install the dotenv
dependency, use the following command:
Once the dependency is installed, let's create a new file named .env
and place the private key inside it:
Let's deploy an ERC-20 contract on the testnet. First, navigate to the contracts/
folder and remove the Lock.sol
file from the sample project as it is not needed.
Create a new file in the contracts/
directory and name it Token.sol
. Then, put the following code inside:
Let's compile the code by running the following command:
After successful compilation, let's deploy the contract. Open the scripts/deploy.ts
file and replace its contents with the following code:
Important: Reth L2 doesn't support the "block tag pending." So, in case you encounter issues with block tags while using Hardhat, try adding the parameter blockTag: "latest"
. This may be particularly relevant, especially when estimating gas.
For deploy run the following command:
Awesome, after deployment you would see message:
See from Metamask.
Now, let's install the framework:
Copy the address and go to , that's all! Now you can continue develop your contract/project on the EVM part of the L2.