0g-storage-node/doc/run.md
2024-01-04 18:05:32 +08:00

1.4 KiB

Run

Deploy contract: Token, Flow and Mine contracts

Setup Environment

Install dependencies Node.js, yarn, hardhat.

  • Linux

    • Ubuntu
    # node >=12.18
    sudo apt install npm
    sudo npm install --global yarn
    sudo npm install --global hardhat
    
  • Mac

    brew install node
    sudo npm install --global yarn
    sudo npm install --global hardhat
    
  • Windows
    Download and install node from here

    npm install --global yarn
    npm install --global hardhat
    

Download contract source code

git clone https://github.com/zero-gravity-labs/zerog-storage-contracts.git
cd zerog-storage-contracts

Add target network to your hardhat.config.js, i.e.

# example
networks: {
    targetNetwork: {
      url: "******",
      accounts: [
        "******",
      ],
    },
  },

Compile

yarn
yarn compile

Deploy contract

npx hardhat run scripts/deploy.ts --network targetnetwork

Keep contracts addresses

Run ZeroGStorage

Update coinfig run/config.toml as required:

# p2p port
network_libp2p_port

# rpc endpoint
rpc_listen_address

# peer nodes
network_libp2p_nodes

# flow contract address
log_contract_address

# mine contract address
mine_contract_address

# layer one blockchain rpc endpoint
blockchain_rpc_endpoint

Run node

cd run
../target/release/zgs_node --config config.toml