Skip to main content

What is hardhat

Hardhat is a development environment for Ethereum software. It consists of different components for editing, compiling, debugging and deploying your smart contracts and dApps, all of which work together to create a complete development environment.

How to use hardhat on Fuse and Spark

Following the instructions here, run npx hardhat to create a hardhat project.

Then in hardhat.config.js add Fuse and Spark to the network section:

hardhat.config.js
module.exports = {
// ...
networks: {
fuse: {
url: 'https://rpc.fuse.io/',
accounts: {
// put dev menomonic or PK here
},
},
spark: {
url: 'https://rpc.fusespark.io/',
accounts: {
// put dev menomonic or PK here
},
},
},
// ...
}

How to verify contracts

To verify contracts with hardhat the hardhat-etherscan is used. Yes it’s sound counterintuitive and wrong, but the hardhat-etherscan plugin verifies contracts in the blockscout explorer.

Add the following property to hardhat.config.js

hardhat.config.js
etherscan: {
apiKey: {
fuse: "YOUR_KEY_IF_YOU_HAVE_ONE",
spark: "YOUR_KEY_IF_YOU_HAVE_ONE"
},
customChains: [
{
network: "fuse",
chainId: 122,
urls: {
apiURL: "https://explorer.fuse.io/api",
browserURL: "https://explorer.fuse.io"
}
},
{
network: "spark",
chainId: 123,
urls: {
apiURL: "https://explorer.fusespark.io/api",
browserURL: "https://explorer.fusespark.io"
}
}
]
}

Now to verify the contract on Fuse:

npx hardhat verify --network fuse DEPLOYED_CONTRACT_ADDRESS "Constructor argument 1"

Was this page helpful?

Happy React is loading...