hypersign-protocol / whitepaper

2 stars 0 forks source link

Setup and run EVMOS node #33

Closed Vishwas1 closed 2 years ago

Vishwas1 commented 2 years ago
arnabghose997 commented 2 years ago

Following are the steps for setting up a 2 node cluster in EVMOS

> git clone https://github.com/tharsis/evmos.git
> cd evmos
> make install
> evmosd testnet init-files --v 2 --output-dir ~/multi-node

--v- Number of validator nodes

--output-dir - Directory to store the nodes related info

├── gentxs
│   ├── node0.json
│   └── node1.json
├── node0
│   └── evmosd
│       ├── config
│       │   ├── app.toml
│       │   ├── config.toml
│       │   ├── genesis.json
│       │   ├── node_key.json
│       │   └── priv_validator_key.json
│       ├── data
│       │   └── priv_validator_state.json
│       └── key_seed.json
└── node1
    └── evmosd
        ├── config
        │   ├── app.toml
        │   ├── config.toml
        │   ├── genesis.json
        │   ├── node_key.json
        │   └── priv_validator_key.json
        ├── data
        │   └── priv_validator_state.json
        └── key_seed.json

We now have to make port changes for some parameters, because at this moment, both nodes have same port configuration for the most params

The following parameters of node1/evmosd/config/app.toml should have the values set as follows:

The following parameters of node1/evmosd/config/config.toml should have the values set as follows:

The following parameters of node0/evmosd/config/config.toml should have the values set as follows:

Save the files and exit

# Node0
> evmosd start --home ~/multi-node/node0/evmosd

# Node1 (In another terminal window)
> evmosd start --home ~/multi-node/node1/evmosd
arnabghose997 commented 2 years ago

We will be running a local Evmos testnet with one node, to see the transfer of tokens between two Evmos accounts:

Setting up the node for the first time

> evmosd testnet start --v 1 --output-dir .

This will start a local Evmos testnet, whose data and config info will be located in the folder named in the format: evmos_<chain-id>-1 . Since, we executed this command from HOME, it will be created there. Note down the <chain-id> as this will required during the Metamask Network configuration

Running the same again in a new session

> evmosd start --home evmos_<chain-id>-1/node0/evmosd

Log of successful transaction taken from Evmos daemon

9:53AM INF executed block height=640 module=state num_invalid_txs=0 num_valid_txs=1 server=node
9:53AM INF commit synced commit=436F6D6D697449447B5B3120323430203139362036352034302032353520313731203433203930203135302033352032352036312032333220313731203230322031333020323037203232342031383120323136203530203139322031383420313237203738203139342031383720313137203131382032322039325D3A3238307D
9:53AM INF committed state app_hash=01F0C44128FFAB2B5A9623193DE8ABCA82CFE0B5D832C0B87F4EC2BB7576165C height=640 module=state num_txs=1 server=node
arnabghose997 commented 2 years ago

Deployment of Smart Contract through Remix IDE:

Evmos Docs: https://evmos.dev/guides/tools/remix.html

arnabghose997 commented 2 years ago

Bootstrapping Evmos and Gaia with the help of startport

The steps to bootstrap through starport for both of them is similar with config port differences as we will see. Let's take Gaia as an example:

The above steps are similar for running Evmos chain as well, with difference being in ports and account names

arnabghose997 commented 2 years ago

Oberservations from running both Gaia and Evmos chain

Both Gaia and Evmos chains were run using the starport. Below are their config.yml configuration:

Gaia:

accounts:
  - name: akash
    coins: ["10000000000000uatom", "100000000stake"]
  - name: badal
    coins: ["50000000000uatom"]
validator:
  name: akash
  staked: "1000000stake"
host:
  rpc: ":26657"
  p2p: ":26656"
  prof: ":6061"
  grpc: ":9095"
  grpc-web: ":9093"
  api: ":1318"
  frontend: ":8081"
  dev-ui: ":12346"
faucet:
  name: badal 
  coins: ["100000uatom"]
  port: 4500
build:
  binary: "gaiad"
init:
  home: "home/arnab/.gaia"
genesis:
  chain_id: "localcosmos-1"

Evmos:

accounts:
  - name: alice
    coins: ["100000000stake", "100000000000000000000aevmos"]
  - name: bob
    coins: ["5000000000000aevmos"]
validator:
  name: alice
  staked: "100000000000000000000aevmos"
host:
  rpc: ":36657"
  p2p: ":36656"
  prof: ":7061"
  grpc: ":10095"
  grpc-web: ":10093"
  api: ":2318"
  frontend: ":9081"
  dev-ui: ":22346"
faucet:
  name: bob 
  coins: ["100000aevmos"]
  port: 4501
build:
  binary: "evmosd"
init:
  home: "$HOME/.evmosd"
  app:
    evm-rpc:
      address: "0.0.0.0:8545"     # change the JSON-RPC address and port
      ws-address: "0.0.0.0:8546"  # change the JSON-RPC websocket address and port
genesis:
  chain_id: "evmosd_9000-1"
  app_state:
    staking:
      params:
        bond_denom: "aevmos"
    mint:
      params:
        mint_denom: "aevmos"
    crisis:
      constant_fee:
        denom: "aevmos"
    gov:
      deposit_params:
        min_deposit:
          - amount: "10000000"
            denom: "aevmos"
    evm:
      params:
        evm_denom: "aevmos"

Account badal from gaiad, and bob from evmos were chosen to be the relayer accounts. So we will focus on them

When both chains were started, the mnemonics of badal and bob were noted as follows:

badal:

[GAIA DAEMON] cosmos16xv7mzk9gffqs28wxq9etdsz083af7jxhzu2xt
[STARPORT] 🙂 Created account "badal" with address "cosmos16xv7mzk9gffqs28wxq9etdsz083af7jxhzu2xt" with mnemonic: "path oak treat put saddle quarter uniform broom aunt text cotton slice hotel mention dwarf prosper prepare buffalo still alone sweet lesson worth gentle"

bob:

[EVMOS DAEMON] evmos147h9vvlhxxe8nhjgaadraeu93rv9xv36dvfv0v
[STARPORT] 🙂 Created account "bob" with address "evmos147h9vvlhxxe8nhjgaadraeu93rv9xv36dvfv0v" with mnemonic: "scissors crouch hair bacon magnet analyst drip scare palace tragic verify forget have census blame best rabbit buzz hip whale define also october flag"

Now while trying to use the hermes CLI to restore the account addresses through following comand:

$ hermes keys restore --mnemonic <account-mnemonic> <chain-id>

Account address of badal (Gaia chain) was imported exactly how its supposed to be. But the account address of bob (Evmos chain) was different.

The public key type of Evmos is /ethermint.crypto.v1.ethsecp256k1.PubKey. It seems that version of Public key type defined in Evmos could be different from what is defined in Hermes.

So, we are putting a halt specific to Evmos IBC transfer for now till the time things are stable

arnabghose997 commented 2 years ago

Update on Hermes Relayer:

The issue with hermes relayer described in the above comment was raised on their repo (https://github.com/informalsystems/ibc-rs/issues/1785)

There were two set of responses: 1) Related to new branch that was created as part of the issue 2) Related to existing main branch supporting evmos

The first comment's approach did actually work. Since, the second comment suggests that the main branch of Hermes already supports Evmos and requires some hermis config file changes, which needs to seen later