LogoLogo
WebsiteSubstrate Block ExplorerEVM Block ExplorerFaucet
  • Learn
    • Architecture
    • Staking
      • Proof of stake
    • Smart Contracts
    • Accounts
    • Infrastructure
      • Nodes
      • Agents
      • Models
      • IPFS
    • Security
      • OPOC
      • TSS
      • IPFS Integrity
      • Model Updates Integrity
    • Fees
    • Finney Testnet RPC Endpoints
  • Build
    • Address format
    • ink! Environment
    • Wasm Smart Contracts
      • Smart Contract Stack
      • Domain-Specific Languages (DSLs)
      • ink! Development
      • ask! Development
      • Basic ink! Contract
    • EVM Smart Contracts
      • Introduction to EVM Smart Contracts
      • HardHat
      • Your first EVM Smart Contract
      • Debug EVM Transactions
      • Precompiles
        • SR25519
        • Substrate ECDSA
        • XC20
    • Run a node
      • Run an archive node
        • Binary
      • Run a full node
      • Become a validator
        • Learn about Validators
        • Validator requirements
        • Spin up a validator
        • Set your identity
    • Build an Agent
      • Introduction
      • Development
      • Installing WASP
      • Agents API Reference
      • Available AI Models
Powered by GitBook
On this page
  • Hardhat Setup
  • Truffle Setup
Export as PDF
  1. Build
  2. EVM Smart Contracts

HardHat

PreviousIntroduction to EVM Smart ContractsNextYour first EVM Smart Contract

Last updated 3 months ago

Hardhat Setup

💡 New to Hardhat? Check out the for basics.

Project Setup

1. Configure Your Account

To deploy contracts to UOMI networks, you'll need to export your private key from MetaMask:

  1. Open MetaMask

  2. Select your account

  3. Click the three dots menu

  4. Go to "Account Details"

  5. Select "Export Private Key"

  6. Enter your password to confirm

You'll get a 64-character hex string like:

60ed0dd24087f00faea4e2b556c74ebfa2f0e705f8169733b01530ce4c619883

2. Store Your Private Key

Create private.json in your project root:

{
  "privateKey": "YOUR_PRIVATE_KEY_HERE"
}

⚠️ Security Warning Never commit your private key to version control. Add private.json to your .gitignore file.

3. Configure Networks

Modify your hardhat.config.js:

const { privateKey } = require("./private.json");

module.exports = {
  networks: {
    // Finney Testnet
    finney: {
      url: "https://finney.uomi.ai",
      chainId: XXX,
      accounts: [privateKey],
    },
  }
};

4. Deploy Your Contract

npx hardhat run --network finney scripts/deploy.js

Truffle Setup

Prerequisites

Install the HD Wallet Provider:

npm install @truffle/hdwallet-provider

Configuration

Modify your truffle-config.js:

const HDWalletProvider = require('@truffle/hdwallet-provider');
const { privateKey } = require('./private.json');

module.exports = {
  networks: {
    // Finney Testnet
    finney: {
      provider: () => new HDWalletProvider(
        privateKey,
        'https://finney.uomi.ai'
      ),
      network_id: XXX,
    },
  }
};

Deployment

Deploy to your chosen network:

truffle migrate --network finney

💡 Note If no network is specified, Truffle will use the default development network.

Hardhat Quick Start Guide