Skip to main content
Create an example ERC-20 using OpenZeppelin’s implementation, deploy it through Remix and MetaMask, then transfer tokens and check the receipt in Tavchain’s explorer.
A verified GLD reference deployment is available on chain 771002, built with the Hardhat starter. This guide uses Remix; deploy your own instance and retain its original source and compiler input for verification.
This example uses Gold (GLD), the fictional game currency from OpenZeppelin’s ERC-20 guide. It is a valueless test token, not gold-backed, native TAV or an official Tavchain asset. Gas fees are paid in Test TAV.

Before you begin

Connect MetaMask to Tavchain Testnet, chain ID 771002, and obtain Test TAV. Use a second public address you control for the token transfer.

Create the contract

In Remix, create GLDToken.sol and paste:
GLDToken.sol
This follows OpenZeppelin’s MIT-licensed example with its dependency pinned to 5.6.1. The constructor gives the initial supply to the deploying account. No extra minting function or administrator is added. Compile with Solidity 0.8.21+commit.d9974bed, Shanghai, optimization enabled and 200 runs. Remix resolves the versioned import; retain the source, imported files and original compiler input for verification.

Deploy 1,000 example tokens

ERC-20 amounts are integers in the token’s smallest unit. OpenZeppelin’s default decimals() is 18, so:
  1. In Deploy & Run Transactions, choose Browser Extension → MetaMask and confirm the network is Custom (771002).
  2. Select GLDToken.
  3. Enter 1000000000000000000000 for the constructor’s initialSupply.
  4. Leave Value at 0. You are creating tokens, not buying them with TAV.
  5. Click Deploy once, review the deployment and fee in MetaMask, and confirm.
  6. Wait for a successful receipt. Save the contract address and transaction hash.
Follow deploy and interact for the wallet workflow. If the result is unclear, check wallet activity and the receipt before trying again.

Read the supply and balance

Expand your deployed GLDToken in Remix. Read: These reads do not require a wallet transaction or gas payment.

Transfer 10 GLD

  1. Expand transfer.
  2. Enter your second account’s public address in to.
  3. Enter 10000000000000000000 in value.
  4. Keep Remix’s separate transaction Value at 0.
  5. Click Transact once. Review and confirm the interaction in MetaMask.
  6. Wait for a successful receipt and check the Transfer event for the sender, recipient and raw amount.
If no other transfers occurred and the recipient started with zero GLD, the sender now has 990 GLD, the recipient 10 GLD, and total supply remains 1,000 GLD. Gas reduces the sender’s Test TAV balance separately.

Inspect and verify

Search the deployment and transfer hashes in the explorer. Check the chain, contract address, successful receipt and token-transfer event. Follow verify a contract using Standard JSON input, including the OpenZeppelin imports and original compiler settings. A source file with unresolved imports is not the complete verification input. Once verified, the explorer exposes the ABI’s read/write methods. To display GLD in your wallet, use its custom-token import flow on Tavchain Testnet with your deployed contract address and the token’s actual symbol/decimals. Importing a token only changes its display in that wallet.

Example token

Open the Hardhat GLD reference contract to inspect its verified source, deployment and transfer transactions on chain 771002. The Hardhat guide records its 1,000-GLD initial supply and the balances after a 10-GLD transfer. The reference was built with Hardhat’s npm import path. This Remix guide uses a versioned import path, so its compiler input and metadata differ. Deploy your own instance to follow the initial-supply and transfer steps above. Source filenames and compiler settings affect verification metadata. Keep your own original input. This demonstration is not an official Tavchain token or a security audit.

Continue locally

Use the Hardhat starter for local compilation, contract tests and a disposable Ignition deployment of the same GLD example. Its local npm import path and artifact metadata differ from this Remix build.