Beginner

Deploying a Contract on Testnet — Hands-on

End-to-end deploy experience.

Developer Beginner
5/7 — Deploying a Contract on Testnet — Hands-on

Record everythingSave the deployed address, chainId, block number, and ABI for later steps. These become inputs for frontends and tests.

Blockchains solve coordination problems, not just financial ones.
— Vitalik Buterin
Steps
  1. Create a Hardhat project:npm init -y && npx hardhat. Choose an empty config.
  2. Write a tiny contract:(e.g., Counter.sol) in contracts/.
  3. Fund a fresh testnet:EOA (Sepolia or Goerli) via faucet; add its key + RPC URL to .env.
  4. Add the network to:Hardhat.config and run npx hardhat run scripts/deploy.js --network sepolia (or your network).
  5. Copy the deployed address;:Check the explorer for code and logs. Note gas used and the deployer address.
  6. Verify the contract using:The Hardhat verify task or the explorer’s verify UI. Ensure the ABI matches.
  7. Optional:Re-run the script with a higher nonce to see how the contract address changes if you send another deployment tx.
← Previous section
Next section →