bbaktaeho / deploy-smart-contract

Deploy smart-contract using hardhat to hyperledger besu.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

deploy-smart-contract-tester

Prerequisites

  • node.js
  • ethereum network (besu, truffle, ghanache, hardhat, ...)

Configuration

  • generate .env

    # extract mnemonic from metamask
    MNEMONIC=...
    
  • modify hardhat.config.ts

    const chainIds = {
      besu: 1337,
    };
    
    ....
    
    function getChainConfig(url: string, network: keyof typeof chainIds): NetworkUserConfig {
      return {
        accounts: {
          mnemonic,
          initialIndex: 8, // 지갑의 계정 순번
        },
        chainId: chainIds[network],
        url,
      };
    }
    
    ....
    
    const config: HardhatUserConfig = {
      solidity: {
        version: "0.8.0",
      },
      networks: {
        // url, chainId
        besu: getChainConfig("http://localhost:8545", "besu"),
      },
    };
    
    ....

Deploy script

Create script file to deploy in ./scripts.

Usage

npm install
npx hardhat compile
npx hardhat test ./test/AssetToken.test.ts
npx hardhat run scripts/deployScript.ts --network besu

About

Deploy smart-contract using hardhat to hyperledger besu.


Languages

Language:TypeScript 48.1%Language:Solidity 26.6%Language:JavaScript 25.3%