Skip to main content
SUBMIT A PRSUBMIT AN ISSUElast edit: Jan 17, 2025

Hardhat Configuration for Subtensor EVM

You can use Hardhat development environment for the EVM feature on subtensor. The Hardhat networks can be configured using the hardhat.config.ts file, as shown below.

The below code configures two subtensor EVM networks for Hardhat:

  1. EVM Localnet with URL: http://127.0.0.1:9944
  2. EVM Testnet with URL: https://test.chain.opentensor.ai
  3. EVM Mainnet with URL: https://lite.chain.opentensor.ai
  4. EVM Version Cancun that matches Solidity 0.8.24.
Full example

See ERC-20 Example Token repository for a complete example of hardhat.config.ts configuration.

Partial snippet of hardhat.config.ts file
const hardhatConfig: HardhatUserConfig = {
solidity: "0.8.24",
defaultNetwork: "subevm",
networks: {
subevm: {
url: "https://test.chain.opentensor.ai",
accounts: [config.ethPrivateKey]
},
mainnet: {
url: "https://lite.chain.opentensor.ai",
accounts: [config.ethPrivateKey]
},
local: {
url: "http://127.0.0.1:9944",
accounts: [config.ethPrivateKey]
}
},
mocha: {
timeout: 300000
},
};