Hardhat
Hardhat is a development environment to compile, deploy, test, and debug your Ethereum software. This guide describes how to configure Hardhat to deploy contracts on the IoTeX blockchain.
If you want to learn more about Hardhat and how to use it, please refer to the official documentation:
Ethereum development environment for professionals
HardhatHQ
We assume you have already created a project in Hardhat.

Configure Hardhat

You can configure hardhat deployment accounts using a mnemonic phrase, or by setting an array of private keys, which can be also input from the command line or set in the .env configuration file. As this is not the scope of this documentation, we refer you to the hardhat network configuration docs.

1.2 Use Private Key

To have hardhat deploy to IoTeX, simply modify hardhat-config.js as below,
1
module.exports = {
2
networks: {
3
dev: {
4
url: "https://babel-api.testnet.iotex.io,
5
accounts: ['your private key'],
6
chainId: 4690,
7
gas: 8500000,
8
gasPrice: 1000000000000
9
},
10
},
11
...
12
};
Copied!
next, you can deploy as usual:
1
npx hardhat run scripts/sample-script.js --network dev
Copied!
Last modified 7mo ago
Export as PDF
Copy link