Hardhat in the Whitechain templates repository. The fastest path below clones it and deploys. The companion Foundry template is Foundry.
Fastest path
The Hardhat template is a finished project for Whitechain Sepolia: the network is configured, the contract and tests are in place, and the deploy script is written. You need Node.js 22 or later and a funded key. The walkthrough after this section builds the same project by hand, if you would rather see every step.-
Get the
Hardhatfolder and install its dependencies. -
Copy the environment file.
Set
PRIVATE_KEYto a throwaway key funded from the faucet.TESTNET_RPC_URLalready points at the public endpoint.npm run compileandnpm testboth run before you fill anything in. -
Deploy.
The script prints the deployed address and its explorer URL.
-
Verify, using the address from step 3.
whitechainSepolia (chain ID 1874) and points verification at the Whitechain Blockscout explorer. Source: whitechain-labs/templates.
Hardhat publishes its own Agent Skill for AI coding assistants. Install it with
npx skills add nomicfoundation/hardhat-skills for AI-guided help with Hardhat 3 workflows and migrations. Pair it with the whitechain-dev skill for the Whitechain-specific steps below.Before you deploy
- Node.js 22 or later and npm. Hardhat 3 requires Node.js 22 or newer.
- A funded testnet account. Claim test WBT from the faucet.
- The private key for that account. Use a throwaway key for testing.
1. Create a project
2. Set environment variables
.env file:
0x prefix. Hardhat rejects the network configuration without it.
Add .env to .gitignore so you do not commit the key.
3. Configure the network
Replace the contents ofhardhat.config.ts with:
4. Add a contract
Createcontracts/Storage.sol.
5. Add a deploy script
Createscripts/deploy.ts.
network.create("whitechainSepolia") opens a connection to the network defined in hardhat.config.ts. Passing the name makes the script explicit; network.create() with no argument uses whatever --network selects. Do not use network.connect(), which is deprecated in Hardhat 3 and will be removed. Hardhat 3 uses ESM with top-level await, so no main() wrapper is needed.
6. Deploy the contract
7. Verify the contract
Storage takes no constructor arguments, so pass only the address.
Verify the result
Open the contract address on the explorer. The Contract tab shows the source code and a verified marker.hardhat verify submits to every verifier configured for the network, so the same source also lands on Sourcify.
If you deployed the
Storage example unchanged, the explorer may show its source before you verify anything. That is a verified twin: the same bytecode is already verified at another address, so the explorer matches it. Hardhat then skips Blockscout and verifies only on Sourcify, and your address stays unverified in its own right. Record it with npx hardhat verify blockscout --force --network whitechainSepolia <contract_address>. Your own contracts have unique bytecode, so they have no twin and the plain command covers both verifiers.
