Hardhat is a development environment to compile, deploy, test, and debug your Ethereum software.
A sample project is available at
Setting up Hardhat
Please follow .
Once your environment is ready, we can create an empty folder and init a Hardhat project in it.
$ mkdir my-thundercore-project && cd $_
# We choose a basic sample project and install its dependences here:
$ npx hardhat init
✔ What do you want to do? · Create a basic sample project
✔ Do you want to install this sample project's dependencies with npm (hardhat @nomiclabs/hardhat-waffle ethereum-waffle chai @nomiclabs/hardhat-ethers ethers)? (Y/n) · y
After initialization, we can test the project with the hardhat compile command:
Never store your private key directly in hardhat.config.js
Here we pass the its value on the command line or store it in `.env`.
Deploy to ThunderCore Network
Let's deploy the first contract.
# Using NPM
KEY=0xPrivateKey npm exec -- hardhat run scripts/sample-script.js --network thunder-testnet
# or using Yarn
KEY=0xPrivateKey yarn hardhat run scripts/sample-script.js --network thunder-testnet
# Using NPM
set KEY=0xPrivateKey & npm exec -- hardhat run scripts/sample-script.js --network thunder-testnet
# or using Yarn
set KEY=0xPrivateKey & yarn hardhat run scripts/sample-script.js --network thunder-testnet
# Using NPM
$env:KEY='0xPrivateKey';npm exec -- hardhat run scripts/sample-script.js --network thunder-testnet
# or using Yarn
$env:KEY='0xPrivateKey';yarn hardhat run scripts/sample-script.js --network thunder-testnet
Congratulations! You have successfully deployed a smart contract onto the ThunderCore network, you will find the deployed messages look like:
Greeter deployed to: 0xGreeterContractAddress
Verify contract by plugin
Once you deployed your contract, you might want to verify your contract code.
yarn add -D @nomiclabs/hardhat-etherscan
after installed the package, modify your hardhat.config.js