VeChain Docs
  • Welcome to VeChain
  • Blockchain Basics
    • Introduction to blockchain
    • Introduction to digital property
    • The evolution of the internet
  • Introduction to VeChain
    • About the VeChain blockchain
      • Consensus Deep Dive
      • Governance
    • Dual-Token Economic Model
      • VeChain (VET)
      • VeThor (VTHO)
    • Acquire VeChain Assets
    • Sustainability
  • Core Concepts
    • Networks
      • Thor Solo Node
      • Testnet
      • Mainnet
    • Nodes
      • Node Rewards Programme
    • Blocks
      • Block Model
    • Transactions
      • Transaction Model
      • Transaction Fees
      • Transaction Calculation
      • Meta Transaction Features
        • Transaction Uniqueness
        • Controllable Transaction Lifecycle
        • Clauses (Multi-Task Transaction)
        • Fee Delegation
          • Multi-Party Payment (MPP)
          • Designated Gas Payer (VIP-191)
        • Transaction Dependency
    • Block Explorers
    • Wallets
      • VeWorld
        • User Guide
          • Setup
          • Wallet
          • Signing
          • Activities
          • Settings
        • FAQ
      • Sync2
        • User Guide
          • Setup
          • Wallet
          • Signing
          • Activities
          • Settings
        • FAQ
      • Sync
        • User Guide
          • Wallet
          • Ledger Device
          • Browser dApps and web
          • Interact with dApps
          • Activities
          • Settings
          • Report an Issue
          • Contributing
        • FAQ
    • EVM Compatibility
      • VeChain Modifications
      • Methodology
      • Test Coverage
        • Gas model
        • Raw transaction
        • hardhat specific
          • Ganache failures
          • evm_increaseTime
        • Failures in constructor
        • eth_sign
        • Contract address prediction
        • BadBeacon proxy address at 0x1
      • How to Recreate
      • Additional Information
        • Using Governance Contracts
        • ERC1820/ERC777 Testnet
        • Delegate Options
    • Account Abstraction
      • UserOperation
      • Bundler
      • EntryPoint Contract
      • Account Factory Contract
      • Paymaster Contract
    • Token Bound Accounts
  • How to run a node
    • Nodes
    • How to run a Thor Solo Node
    • Custom Network
    • Connect Sync2 to a Thor Solo Node
  • Developer Resources
    • Getting Started
    • How to build on VeChain
      • Connect to the Network
      • Read Data
        • Read Blocks
        • Read Transactions
        • Read Accounts
        • States & Views
        • Events & Logs
        • VET Transfers
      • Write Data
        • Transactions
        • Fee Delegation
      • Listen to Changes
        • Events
        • VET Transfers
        • Transactions
        • Blocks
        • Beats
      • Build with Hardhat
      • Utilities
        • BigInt and Unit-Handling
        • Name Service Lookups
    • Example dApps
      • Buy me a Coffee
      • Token Bound Accounts
      • PWA with Privy and Account Abstraction
    • EVM Compatibility for Developers
      • Key Architectural Differences and Optimizations
      • Practical Implications for Developers: Key Considerations
      • RPC Methods (Detailed Breakdown)
      • Frequently Asked Questions (FAQs)
      • VeChain Blockchain Specifications
      • Key Differences Between VeChain and Ethereum (Summary)
      • Best Practices for Developing on VeChainThor
    • How to verify Address-Ownership
      • Next.js Session Verification
    • Debug Reverted Transactions
    • Account Abstraction
    • VIP-191: Designated Gas Payer
      • How to Integrate VIP-191 (I)
      • How to Integrate VIP-191 (II)
      • How to Integrate VIP-191 (III)
    • Index with Graph Node
      • Setup with Docker
      • Index with OpenZeppelin
        • Create Subgraph Project
        • Configure Contracts
        • Deploy Subgraph and start Indexing
        • Track Subgraph Indexing
        • Access Subgraph
        • Update Subgraph
    • SDKs & Providers
      • SDK
        • Architecture
        • Accounts
        • Bloom Filter
        • Certificates
        • Contracts
        • Cryptography
        • Debug
        • Encoding
        • Polls
        • Subscriptions
        • Thor Client
        • Transactions
      • Thor DevKit
        • Installation
        • Usage
          • Cryptography
          • Accounts
          • Encoding
          • Transactions
          • Certificates
          • Bloom Filter
      • DApp Kit
        • v2
          • Installation
          • React
            • Installation
            • Usage
          • Vanilla JS
            • Installation
            • Usage
          • Core
            • Installation
            • Usage
          • Theme Variables
          • i18n
        • v1
          • Installation
          • React
            • Installation
            • Usage
          • Vanilla JS
            • Installation
            • Usage
          • Core
            • Installation
            • Usage
          • Theme Variables
          • i18n
          • Node Polyfills
          • V0 to V1
        • v0
          • Installation
          • Usage
          • React
            • Installation
            • Usage
          • Vanilla (UI)
            • Installation
            • Usage
          • Styles (UI)
          • i18n
      • DevPal
      • Web3-Providers-Connex
        • Installation
        • Usage
      • Connex
        • Installation
        • API Specification
    • Frameworks & IDEs
      • Hardhat
      • Remix
    • Built-in Contracts
    • VORJ
    • Useful Links
  • How to contribute
Powered by GitBook
On this page
  • Introduction
  • Installation and Setup
  • Prerequisites
  • Adding VeChain Support
  • Networks
  • Example Usage

Was this helpful?

  1. Developer Resources
  2. Frameworks & IDEs

Hardhat

PreviousFrameworks & IDEsNextRemix

Last updated 10 months ago

Was this helpful?

is a powerful, flexible development environment for Ethereum-based blockchain projects. It offers a comprehensive suite of tools for editing, compiling, debugging, and deploying smart contracts and decentralized applications (dApps). These components seamlessly integrate to create a robust ecosystem that supports the entire development lifecycle.

Our custom VeChain plugin extends Hardhat's capabilities to the VeChain blockchain, enabling our community to leverage this advanced toolset for VeChain-specific development. This integration allows developers to harness Hardhat's efficient workflows and powerful features while building on VeChain's innovative blockchain platform.

Introduction

The VeChain SDK Hardhat Plugin seamlessly integrates Hardhat with the VeChain SDK, providing developers with a powerful toolset for smart contract development on the VeChainThor blockchain. This essential package streamlines the process of creating, testing, deploying, and interacting with smart contracts in the VeChain ecosystem.

Installation and Setup

Prerequisites

Ensure Hardhat is installed in your project:

yarn add --dev hardhat
npx hardhat

Adding VeChain Support

  • Install the VeChain Hardhat plugin:

    yarn add @vechain/sdk-hardhat-plugin
  • Configure your hardhat.config.ts:

    import '@vechain/sdk-hardhat-plugin';
    
    import { VET_DERIVATION_PATH } from '@vechain/sdk-core';
    import { type HttpNetworkConfig } from 'hardhat/types';
    
    const config: HardhatUserConfig = {
    solidity: {
        compilers: [
        {
            version: '0.8.20', // Specify the first Solidity version
            settings: {
                // Additional compiler settings for this version
                optimizer: {
                    enabled: true,
                    runs: 200
                },
                evmVersion: 'paris' // EVM version (e.g., "byzantium", "constantinople", "petersburg", "istanbul", "berlin", "london")
            }
        },
        ]
    },
    networks: {
        vechain_testnet: {
        // Testnet
        url: 'https://testnet.vechain.org',
        accounts: {
            mnemonic:
                'vivid any call mammal mosquito budget midnight expose spirit approve reject system',
            path: VET_DERIVATION_PATH,
            count: 3,
            initialIndex: 0,
            passphrase: 'vechainthor'
        },
        debug: true,
        delegator: undefined,
        gas: 'auto',
        gasPrice: 'auto',
        gasMultiplier: 1,
        timeout: 20000,
        httpHeaders: {}
    } satisfies HttpNetworkConfig,
    }
    };

Networks

  • VeChain mainnet:

    vechain_mainnet: {
        // Mainnet
        url: 'https://mainnet.vechain.org',
        accounts: [
            '7f9290cc44c5fd2b95fe21d6ad6fe5fa9c177e1cd6f3b4c96a97b13e09eaa158'
        ],
        debug: false,
        delegator: undefined,
        gas: 'auto',
        gasPrice: 'auto',
        gasMultiplier: 1,
        timeout: 20000,
        httpHeaders: {}
    } satisfies HttpNetworkConfig
  • VeChain solo network:

    vechain_solo: {
        // Thor solo network
        url: 'http://localhost:8669',
        accounts: [
            '7f9290cc44c5fd2b95fe21d6ad6fe5fa9c177e1cd6f3b4c96a97b13e09eaa158'
        ],
        debug: false,
        enableDelegation: false,
        delegator: undefined,
        gas: 'auto',
        gasPrice: 'auto',
        gasMultiplier: 1,
        timeout: 20000,
        httpHeaders: {}
    } satisfies HttpNetworkConfig

Example Usage

By leveraging this plugin, developers can harness the full potential of VeChainThor blockchain while benefiting from Hardhat's robust development environment. Happy coding!

Notice: At the date of writing, VeChainThor EVM is aligned with Ethereum's at the paris hard fork. Set the to paris if you are using solidity compiler version 0.8.20 or above.

For a detailed example of integrating the VeChain SDK with Hardhat, visit our . This repository contains a fully configured project demonstrating best practices and common use cases, serving as an excellent starting point for your VeChain development journey.

Hardhat
evmVersion
apps/sdk-hardhat-integration directory