What you’ll build
An Ignition module that deploysCounter, a record of the deployment in your project, and a script that reads the deployed contract.
Prerequisites
- A Hardhat 3 project set up for BOT Chain, including the fee hook. Follow Set up Hardhat first.
BOT_PRIVATE_KEYset in the Hardhat keystore or your terminal, for a wallet with at least 0.01 tBOT.contracts/Counter.solfrom the setup guide.
Steps
1
Write an Ignition module
An Ignition module describes what to deploy. Ignition works out the order and keeps a journal, so a failed deploy can resume where it stopped.If your contract takes constructor arguments, pass them as an array:
ignition/modules/Counter.ts
m.contract("Greeter", ["Hello"]).2
Deploy to testnet
y. When it finishes you’ll see output like:Output
ignition/deployments/chain-968/deployed_addresses.json.3
Read the contract from a script
scripts/read-counter.ts
count is 0.Verify it worked
- Run
npx hardhat ignition status chain-968. It printsDeployment chain-968 (chainId: 968) was successfuland the address. - Open
https://scan.bohr.life/address/YOUR_ADDRESS. BOTScan shows the contract and the deploy transaction.
Deploy to mainnet
Use the same module with the mainnet network:ignition/deployments/chain-677.
Troubleshooting
transaction underpriced: effective gas tip 0, minimum needed 20000000000
transaction underpriced: effective gas tip 0, minimum needed 20000000000
Ignition sent a fee of 0 because BOT Chain’s base fee is 0. Add the fee hook from Set up Hardhat, then deploy again.
Ignition says a previous run failed or a transaction is pending
Ignition says a previous run failed or a transaction is pending
Ignition resumes from its journal. If the earlier run failed before anything was sent (for example, an RPC error), delete
ignition/deployments/chain-968 and deploy again. Don’t delete it if a contract was deployed, or Ignition will deploy a second copy.insufficient funds for gas
insufficient funds for gas
Your wallet needs tBOT. Check the address with the script in Set up Hardhat and claim from a faucet.
An RPC call returns 502
An RPC call returns 502
The public RPC sometimes drops a request. Run the same deploy command again; Ignition picks up where it stopped.
Next steps
Verify with Hardhat
Publish your source on BOTScan.
Set up wagmi
Call your contract from a web app.