Cronos EVM Docs
  • Getting Started
    • Getting Started
    • Background
    • Architecture
    • Cronos roadmap
  • FOR USERS
    • 💳Crypto.com Card Top Up
    • 🔥Crypto Wallets
    • 🦊MetaMask Configuration
    • 🦁Brave Wallet
    • 🌉Bridges
      • From the Crypto.com App and Exchange
        • From the Crypto.com App
        • From the Crypto.com Exchange
      • IBC (Cronos POS Chain, other Cosmos chains)
        • Cronos Bridge Web App
      • Independent bridges
      • FAQs for Bridge transfers
      • FAQs for transactions from/to centralized exchanges
    • 🚰Testnet Faucet
    • 💡Tips & FAQs
    • 👮Key Principles for Wallet Security
    • GasTracker
  • FOR DAPP DEVELOPERS
    • 💡Founder FAQs
    • 🏅Hacker's Getting Started Resources
    • 📃Smart Contracts
      • Contract Development on Testnet
      • Contract Deployment and Verification
      • Contract Verification Export: Cronoscan To Cronos Explorer
      • Best Practices
      • Token Contract Addresses
    • 💻dApp Creation
      • Free and commercial RPC endpoints
      • Wallet integrations
      • Web3-wallet
      • JSON-RPC methods
      • Address Conversion
      • Swagger Playground
    • ⚙️Dev Tools & Integrations
      • All dev tools & integrations
      • Account Abstraction
      • Band Protocol
      • Banxa
      • GoldRush
      • Cronos Safe
      • Flair
      • Google Bigquery
      • Moralis
      • Pyth
      • Secret Network
      • SubQuery
      • Witnet
    • Crypto.com AI Agent SDK
  • FOR NODE HOSTS
    • Running nodes
      • Cronos Mainnet
        • Quicksync
        • State-sync
        • Public Node Sync
        • KSYNC
        • The "Huygen" upgrade guide (v0.6.* to v0.7.*)
        • The "v0.7.0-hotfix" upgrade guide (v0.7.* to v0.8.*)
        • The "Galileo" upgrade guide (v0.8.* to v1.0.*)
        • The "Titan" upgrade guide (v1.0.* to v1.1.0)
        • The "v1.2" upgrade guide (v1.1.* to v1.2.0)
        • The "v1.3" upgrade guide (v1.2.* to v1.3.0)
        • The "v1.4" Pallene upgrade guide (v1.3.* to v1.4.1)
        • Patching Unlucky & Duplicate Tx
      • Cronos Testnet
      • Devnet
      • Best Practices
      • Cronosd build with Nix
      • VersionDB
      • MemIAVL
      • Local State Sync
    • Cronosd
  • CRONOS PLAY
    • Introduction
    • Unity Engine
      • Current Version
      • Legacy Version
        • EVM
        • Login Example
        • Custom RPC
        • ERC20
        • ERC721
        • ERC1155
      • Useful Links
    • Unreal Engine
      • Installation and Enabling
      • Working with Blueprint
        • Actors and Blueprint Classes
        • Cronos Configuration
        • Connect Defi Desktop/Onchain Wallet with URI
        • Connect Wallets with QR Code
        • Connect WalletConnect Step by Step
        • WalletConnect 2.0 and Unreal Engine 5: Hello World Example
        • Wallet
        • ERC20
        • ERC721
        • ERC1155
        • Broadcast Transactions
        • Get Tokens or Transactions
      • Working with C++
        • Creating a C++ Project
        • Creating a child DefiWalletCoreActor
        • Querying a contract
        • Customizing Network
      • Demo
    • Cronos Play C++ SDK
    • Crypto.com Pay Integration
    • Cronos Play FAQ
  • Block Explorers
    • Block Explorer and API Keys
    • Cronos Explorer
    • Cronoscan
  • CRONOS CHAIN PROTOCOL
    • Chain ID and Address Format
    • Cronos General FAQ
    • Genesis
    • Modules
      • module_bank
      • module_distribution
      • module_slashing
      • module_feemarket
    • Chain Details
      • List of parameters
      • Technical glossary
      • Protocol Documentation
    • Common IBC Commands
  • Cronos zkEVM
    • Cronos zkEVM
  • Resources
    • Media / brand kit
Powered by GitBook
On this page
  • Truffle: Deploy ERC20 Contract
  • Step 1. Enter smart-contract-example/truffle folder
  • Step 2. Run npm install inside the folder
  • Step 3. Make a copy of .env.example to .env
  • Step 4. Modify .env and fill ONE of the field
  • Step 5. Review Migration Script at migrations/2_deploy_cronos_token.js
  • Step 6. Endpoints setting
  • Step 7. Deploy Contract
  • Step 8. Obtain Contract address from console and input to Metamask
  • Hardhat: Deploy ERC20 Contract
  • Step 1. Enter smart-contract-example/hardhat folder
  • Step 2. Run npm install inside the folder
  • Step 3. Make a copy of .env.example to .env
  • Step 4. Modify .env and fill ONE of the field
  • Step 5. Review Migration Script at scripts/deploy-cronos-token.js
  • Step 6. Endpoints setting
  • Step 7. Deploy Contract
  • Step 8. Obtain Contract address from console and input to Metamask

Was this helpful?

Edit on GitHub
  1. FOR DAPP DEVELOPERS
  2. Smart Contracts

Contract Development on Testnet

PreviousSmart ContractsNextContract Deployment and Verification

Last updated 5 months ago

Was this helpful?

When developing smart contracts on Testnet, use the Testnet version of the Cronos Explorer block explorer:

  • Cronos Explorer Testnet URL:

  • Documentation of Cronos Explorer Testnet API:

Truffle: Deploy ERC20 Contract

Step 1. Enter smart-contract-example/truffle folder

$ cd cronos-smart-contract-example/truffle

Step 2. Run npm install inside the folder

$ npm install

Step 3. Make a copy of .env.example to .env

$ cp .env.example .env

Step 4. Modify .env and fill ONE of the field

MNEMONIC=goose easy ivory ...
PRIVATE_KEY=XXXXXXX

Step 5. Review Migration Script at migrations/2_deploy_cronos_token.js

  const CronosToken = artifacts.require("CronosToken");
  
  module.exports = function (deployer) {
      deployer.deploy(CronosToken, "Cronos Token", "CRT", "1000000000000000000000000");
  };

Step 6. Endpoints setting

By default, the script will be using your local host "127.0.0.1" - If you are not running a localhost, you may leverage the public endpoint https://evm-t3.cronos.org/ by making changes to networks in truffle-config.js, for example:

  networks: {
    development: {
      provider: new HDWalletProvider(getHDWallet(), "http://127.0.0.1:8545"), // TODO
      network_id: "*",       // Any network (default: none)
    },
    testnet: {
      provider: new HDWalletProvider(getHDWallet(), "https://evm-t3.cronos.org/"), // TODO
      network_id: "*",
      skipDryRun: true
    },
  },

Step 7. Deploy Contract

npm run deploy-contract-cronos

Step 8. Obtain Contract address from console and input to Metamask

Correct balance will be shown on Metamask page

Hardhat: Deploy ERC20 Contract

Step 1. Enter smart-contract-example/hardhat folder

$ cd smart-contract-example/hardhat

Step 2. Run npm install inside the folder

$ npm install

Step 3. Make a copy of .env.example to .env

$ cp .env.example .env

Step 4. Modify .env and fill ONE of the field

MNEMONIC=goose easy ivory ...
PRIVATE_KEY=XXXXXXX

Step 5. Review Migration Script at scripts/deploy-cronos-token.js

  async function main() {
      const CronosToken = await hre.ethers.getContractFactory("CronosToken");
      const cronosToken = await CronosToken.deploy("Cronos Token", "CRT", "1000000000000000000000000");
  
      await cronosToken.deployed();
  
      console.log("CronosToken deployed to:", cronosToken.address);
  }

Step 6. Endpoints setting

By default, the script will be using your local host "127.0.0.1" - If you are not running a localhost, you may leverage the public endpoint https://evm-t3.cronos.org/ by making changes to networks in hardhat.config.js, for example:

  networks: {
    development: {
      url: "http://localhost:8545",
      accounts: getHDWallet(),
     },
    testnet: {
      url: "https://evm-t3.cronos.org/",
      accounts: getHDWallet(),
    },
  },

Step 7. Deploy Contract

npm run deploy-contract-cronos

Step 8. Obtain Contract address from console and input to Metamask

Correct balance will be shown on Metamask page

CronosToken deployed to: 0x5F803c894a0A16B46fe5982fB5D89eb334eAF68
📃
https://explorer.cronos.org/testnet
https://explorer-api-doc.cronos.org/testnet