DERA chain docs
  • Introduction
  • NFT2.0
    • Introduction
    • Architecture
    • Concepts
      • Collection
      • NFT2.0
      • Data Registry
      • Derivative NFT
      • Derived Account
      • Token Bound Account (aka TBA)
    • Smart Contracts
      • Interfaces
        • Factory
        • Dynamicity
        • Derivability
        • Cross chain ability
      • Use cases
        • Create collection
        • Mint NFT2.0
        • Create Data registry
        • Write onchain data
        • Retrieve onchain data
        • Mint Derivative NFT2.0
        • Create TBA
    • SDK
      • Setup
        • Create Console Account
        • Manage API key
        • Set up metadata schema
        • Initialize the SDK
      • API reference
        • Get List Collection
        • Get List Collection By Owner
        • Get Collection Info
        • Get List NFT By Collection
        • Get List NFT By Owner
        • Get List Derivative NFT By Original
        • Get NFT Info
        • Get List Data Registry
        • Get Data Registry By Owner
        • Get Data Registry Info
        • Get NFT onchain data
        • Get NFT protocol-scoped onchain data
        • Get User Freemint Info
        • Get Claim Token Uri Info
        • Upload JSON Uri Data To IPFS
        • Generate Presigned URL To Upload Image (IPFS)
        • Utility Functions
    • App guide
      • NFT2Scan
        • Create Collection
        • Mint NFT2.0
        • Mint Derivative NFT2.0
      • NFT2Console
        • Create Dapp
        • Register data schema
        • Manage API keys
        • Manage onchain data
    • References
      • Links
  • Bridge
    • Introduction
    • Bridge Token
    • Bridge NFT
  • Staking
    • Introduction
    • Validate
    • Delegate
  • Smart Contracts
    • EVM compatibility
    • Hardhat
    • Foundry
    • Account Abstraction
    • SubQuery Indexer
    • SAFE multisign
  • Nodes & Validators
    • Run a Node
    • Become a Validator
Powered by GitBook
On this page
  • Hardhat config
  • Compile contracts
  • Deploy contracts
  • Verify contracts
  1. Smart Contracts

Hardhat

Smart contract development using Hardhat

Hardhat config

  1. Add chain config in networks section in hardhat.config.js file:

// hardhat.config.js
networks: {
    derachain: {
      chainId: 20240801,
      url: "<derachain-rpc-url>",
      accounts: [process.env.PRIVATE_KEY!],
    },
}
  1. Add customChain config for contracts verification in etherscan section of hardhat.config.js file:

// hardhat.config.js
etherscan: {
    apiKey: {
      derachain: "empty",
    },
    customChains: [
      {
        network: "derachain",
        chainId: 20240801,
        urls: {
          apiURL: "https://trace.derachain.com/api",
          browserURL: "https://trace.derachain.com",
        },
      },
}

Compile contracts

Compile smart contracts using hardhat commands as usual:

$ npx hardhat clean && npx hardhat compile

Deploy contracts

Deploy compiled smart contracts using deployment scripts as usual:

$ npx hardhat run <deployment-script.js> --network derachain

Verify contracts

Verify deployed smart contracts usingverify command as usual:

$ npx hardhat verify <deployed-address> --network derachain
PreviousEVM compatibilityNextFoundry

Last updated 6 months ago

After verification, the verified contracts can be displayed and interacted with on .

Explorer site