Skip to main content
Use the Tavchain Hardhat starter to build and test the same fictional Gold (GLD) token used in the Remix tutorial. The local testing steps need no wallet, Test TAV or Tavchain node. The later public deployment steps use a dedicated signing account and Test TAV for gas.
The verified GLD reference contract below is deployed on Tavchain Testnet, chain ID 771002. Deploy your own instance when following this guide.
The starter uses Hardhat 3, TypeScript, viem, the Node.js test runner and Ignition. Its contract imports OpenZeppelin’s ERC-20 implementation.

Before you begin

Install a maintained, even-numbered Node.js release supported by Hardhat, at least 22.13.0. The reference environment uses Node.js 24.22.1 on Linux x64. These instructions have not been validated on Windows or macOS. The first install and compiler download require internet access.

Download the starter

Download the source ZIP and its SHA-256 checksum. Extract the ZIP and open a terminal in the extracted tavchain-hardhat-starter3 directory. Archive SHA-256:
The ZIP contains editable source, configuration, tests, an Ignition module and a dependency lockfile. Dependencies are installed by npm. No Tavchain node binary, wallet or private key is included. The source kit has MIT reuse permission with its included notices. A checksum detects changed bytes. To authenticate the archive, follow the network release’s verification instructions: its signed NETWORK-RELEASE.json includes this ZIP’s hash. The archive remains unchanged; its README contains preparation-time and predecessor example references. Use this guide for the current 771002 workflow and deployment.

Install and compile

The lockfile fixes dependency versions. Both compiler profiles use Solidity 0.8.21, optimization enabled with 200 runs, and Shanghai. The contract creates 1,000 GLD for the deploying account. GLD has 18 decimals and is a fictional test token. It is separate from Tavchain’s native TAV.

Run the contract tests

The three tests check:
  • Fixed initial supply, deployer balance and Gold/GLD metadata.
  • A ten-GLD transfer, its Transfer event and resulting balances.
  • Rejected overdrawing with unchanged balances and supply.
A successful test run reports 3 passing. Tests use Hardhat’s in-process development network and publicly known development accounts.
Never fund Hardhat development accounts with valuable assets. These local accounts are for disposable testing.

Deploy on the local development chain

Ignition reports a successful GLDTokenModule deployment and its local address. The in-process network ends when the command exits. Its address and state do not represent a public Tavchain deployment.

Check the public network without signing

The script reads the public chain ID and block height without depending on a previous contract deployment. It requires no private key and sends no transaction. Check that the chain ID is 771002. The network check does not read token balances. Follow read an ERC-20 balance for token reads.

Prepare a public test account

Use a fresh account holding only valueless Test TAV. Connect to Tavchain Testnet, chain ID 771002, and obtain Test TAV from the faucet. Keep your public account address available so you can check the deployer. Store only this dedicated account’s private key through Hardhat’s hidden prompt:
Choose a keystore password and enter the account’s private key when requested. Do not enter a recovery phrase, use a valuable mainnet account, paste secrets into chat or commit them to your project. Use the production keystore, without --dev. A compromised host or dependency can expose the key while unlocked. Do not use keystore get, which prints the secret.

Deploy to Tavchain Testnet

Unlock the keystore privately. Check Hardhat’s network and deployer, then confirm the deployment once. Native transaction value is zero; this constructor creates 1,000 GLD. Save the successful transaction hash and contract address. The public configuration uses the example settings: maximum fee 2 gwei per gas, priority fee 0.125 gwei, five confirmations and no automatic fee increases. These are client settings, not protocol limits or a total-fee guarantee. Check current fees before deploying; the settings may need review if network conditions change. Keep Ignition’s deployment journal. If the command fails or its result is unclear, inspect the journal, account nonce and receipt before rerunning. Do not use --reset to create a second deployment.

Verify without unlocking the key

Replace CONTRACT_ADDRESS with your successful deployment’s address:
The verification configuration connects without a local signing key. It needs no password, wallet signature, fee or Etherscan API key. It submits your original source, imports and compiler settings to the hosted Blockscout verifier and checks the result. Open Contract → Code in the explorer and require verified (exact match). A transaction receipt or visible bytecode alone is not source verification. This is not a security audit. If verification reports a missing TAVCHAIN_PRIVATE_KEY, check that you selected hardhat.verify.config.ts. Do not expose a signing key in CI to solve a verification-only connection problem. The npm import path differs from Remix’s versioned import. Keep the original build and compiler input for source verification; do not mix artifacts from the two workflows.

Example deployment

The starter’s GLD example is deployed on Tavchain Testnet, chain ID 771002. Open its verified source and compiler settings to inspect the original contract and OpenZeppelin imports.At block 10833, after the demonstrated transfer, the deploying account held 990 GLD and the recipient held 10 GLD. Supply remained 1,000 GLD. Later transactions may change those balances. Deployment and transfer fees totaled 0.000671911875 Test TAV; this observed fee is not a quote for future transactions.The transfer uses the existing token contract’s transfer method. Follow Create and transfer an ERC-20 token to perform a transfer with your own deployed instance. The downloadable starter’s Ignition module deploys the token; it does not include a separate public-transfer module.Deploy your own instance when following the guide. Its address, transaction hash and fee will differ. The source retains the kit’s MIT notice and third-party notices.