Kroma
GithubCommunity
  • Introduction
    • Overview
    • KRO Tokenomics
      • Token Allocation
      • Token Distribution
      • Token Utilities
      • Airdrops
        • Initial Airdrop
    • Official Links
  • BUILDERS
    • Developers
      • Contract Deployment Tutorial
        • Using Foundry
        • Using Remix IDE
        • Using Hardhat
      • JSON-RPC API
      • Oracles
    • Node Operators
      • Kroma MPT Migration Guide
      • Running a Full Node
      • Running a Kroma v2 Validator Node
        • How to Migrate Your Validator to KRO-based Validator System
      • How to Sync Blocks Using a Snapshot
      • FAQ
      • [Deprecated] Running a Kroma v1 Validator Node
        • How to Check and Claim the Validator Reward
    • Network Information
    • Protocol Contracts
    • Testnet
      • Setup
      • Faucet
      • Bridge
      • Contract Addresses
  • USERS
    • Wallet Configuration
    • Bridge
    • Block Explorer
    • How to Swap legacy USDC to upgradable USDC
  • Governance
    • Kroma Security Council
  • Kroma Guardian House
    • Overview
    • Philosophy
    • KRO & KGH NFT Staking
      • Validator Boosting by KGH NFT
      • How to Get KRO
      • FAQ
    • KGH NFT Migration & KYC
      • KGH NFT Migration
      • How to Complete KYC with Argos
    • KGH NFT Sales (Ended)
      • KGH Utilities
      • Referral Program: Expand Your Impact
      • Estimated Reward Value
    • Notice
  • Resources
    • Security
    • Brand Kit
    • FAQs
    • Glossary
Powered by GitBook
On this page
  • Hardhat
  • Steps

Was this helpful?

  1. BUILDERS
  2. Developers
  3. Contract Deployment Tutorial

Using Hardhat

This page describes how to deploy smart contracts using Hardhat.

PreviousUsing Remix IDENextJSON-RPC API

Last updated 10 months ago

Was this helpful?

Hardhat

Hardhat is a development environment for Ethereum software. It consists of different components for editing, compiling, debugging and deploying your smart contracts and dApps, all of which work together to create a complete development environment.

Hardhat documentation, see:

Steps

  1. Install

npm install --save-dev hardhat

To create a new Hardhat project,

npx hardhat

Select Create a TypeScript project then press enter to confirm the project root.

Select y for both adding a .gitignore and loading the sample project.

  1. Update your project’s hardhat.config.ts file by adding Kroma Mainnet as a network:

import { HardhatUserConfig } from 'hardhat/config';
import '@nomicfoundation/hardhat-toolbox';

require('dotenv').config();

const config: HardhatUserConfig = {
  solidity: {
    version: '0.8.17',
  },
  networks: {
    // for kroma mainnet
    'kroma-mainnet': {
      url: 'https://api.kroma.network',
      chainId: 255,
      accounts: [process.env.PRIVATE_KEY as string],
    },
    // for local devnet
    'kroma-local': {
      url: 'http://localhost:8545',
      chainId: 7790,
      accounts: [process.env.PRIVATE_KEY as string],
    },
  },
  defaultNetwork: 'hardhat',
};

export default config;
  1. create a .env file with the following content ( It is critical that you do NOT commit this to a public repo)

PRIVATE_KEY=<YOUR_PRIVATE_KEY>
  1. Finaly, Run it using npx hardhat run

npx hardhat run scripts/deploy.ts --network kroma-mainnet
https://hardhat.org/docs
Hardhat