Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Interchain-Security Testnet: joining participant instructions

Join the Interchain-Security Testnet

This guide contains the instructions for joining the Interchain-Security Testnet as both Provider and Consumer chain validators.


Prerequesites

  • Go 1.16+
  • Interchain-Security binaries
  • jq

Install Go

curl -OL https://golang.org/dl/go1.17.4.linux-amd64.tar.gz

sudo tar -C /usr/local -xvf go1.17.4.linux-amd64.tar.gz

export PATH=$PATH:/usr/local/go/bin

export PATH=$PATH:$(go env GOPATH)/bin

Install Interchain-Security binaries

git clone https://github.com/cosmos/interchain-security.git

cd interchain-security

git checkout testnet

git reset --hard 5c77829411135a89bfecb500389a2dc6e7afef94

make install

Install jq

#Linux
apt-get install jq

# OSX
brew install jq


Run a validator on the Provider chain

This section will explain you how to setup and run an node in order to participate to the Provider chain as a validator.

1. Remove any existing directory

rm -rf <provider-node-dir>

2. Create the node directory
This command generates the required node directory stucture along with the intial genesis file.

interchain-securityd init <provider-node-moniker> --chain-id provider --home <provider-node-dir>

3. Generate the node keypair
To generate the node account keypair use the following command.

interchain-securityd keys add <provider-keyname> --home <provider-node-dir> --keyring-backend test --output json > <provider-keyname>_keypair.json 2>&1

*The --keyring-backend option can be removed if you would prefer securing the account with a password

4. Import the Provider chain genesis file Import the node genesis states by downloading the Provider chain genesis file using curl.(pastebin link )

curl -o <provider-node-dir>/config/genesis.json https://pastebin.com/raw/UxMuQN7v

5. Run the node
This command will run the node using the coordinator persistent peer address retrieved from the genesis state. Replace the <provider-node-dir> with your your chosen provider node directory.

# Retrieve public ip address
MY_IP=$(host -4 myip.opendns.com resolver1.opendns.com | grep "address" | awk '{print $4}')

# Get persistent peer
COORDINATOR_P2P_ADDRESS=$(jq -r '.app_state.genutil.gen_txs[0].body.memo' <provider-node-dir>/config/genesis.json)

# Run node
interchain-securityd start --home <provider-node-dir> \
        --rpc.laddr tcp://${MY_IP}:26658 \
        --grpc.address ${MY_IP}:9091 \
        --address tcp://${MY_IP}:26655 \
        --p2p.laddr tcp://${MY_IP}:26656 \
        --grpc-web.enable=false \
        --p2p.persistent_peers $COORDINATOR_P2P_ADDRESS \
        &> <provider-node-dir>/logs &

*If you get the error "can't bind address xxx.xxx.x.x", try using 127.0.0.1 instead.

6. Bond the validator
Ask on the Cephalopod's Discord channel to get the minimum funds to stake. You will receive the tokens on your account shortly.

Make sure your node account has at least 1000000stake coins to using the command below.

# Setup the client RPC endpoint using the following command.
sed -i -r "/node =/ s/= .*/= \"tcp:\/\/${MY_IP}:26658\"/" <provider-node-dir>/config/client.toml

# Check your account balance
interchain-securityd q bank balances $(jq -r .address <provider-keyname>_keypair.json) --home <provider-node-dir>

Bond the validator by sending the following transaction.

# Get the validator node pubkey 
VAL_PUBKEY=$(interchain-securityd tendermint show-validator --home <provider-node-dir>)

# Create the validator
interchain-securityd tx staking create-validator \
            --amount 1000000stake \
            --pubkey $VAL_PUBKEY \
            --from <provider-keyname> \
            --keyring-backend test \
            --home <provider-node-dir> \
            --chain-id provider \
            --commission-max-change-rate 0.01 \
            --commission-max-rate 0.2 \
            --commission-rate 0.1 \
            --moniker <provider-node-moniker> \
            --min-self-delegation 1 \
            -b block -y

Verify that your validator node is now part of the validator-set.
interchain-securityd q tendermint-validator-set --home <provider-node-dir>



Run a validator on the Consumer chain

The following steps will explain you how to configure and run a validator node for joining the Consumer chain.

1. Remove any existing directory

rm -rf <consumer-node-dir>

2. Create the node directory This command generates the required node directory stucture along with the intial genesis file.

interchain-securityd init <consumer-node-moniker> --chain-id consumer --home <consumer-node-dir>

3. Generate a node keypair This command create a keypair for the consumer node.

interchain-securityd keys add <consumer-keyname> --home <consumer-node-dir> --keyring-backend test --output json > <consumer-keyname>_keypair.json 2>&1

4. Import Consumer chain genesis file Update the node genesis states by downloading the consumer genesis file with curl. (pastebin link)

curl -o <consumer-node-dir>/config/genesis.json https://pastebin.com/raw/EV1yYKwQ

5. Import validator keypair node The following will copy the required validator keypair files in order to run the same node on the consumer chain.

cp <provider-node-dir>/config/node_key.json <consumer-node-dir>/config/node_key.json

cp <provider-node-dir>/config/priv_validator_key.json <consumer-node-dir>/config/priv_validator_key.json

6. Run the validator node This command will run the validator on the consumer chain.

COORDINATOR_P2P_ADDRESS=$(jq -r '.app_state.genutil.gen_txs[0].body.memo' <provider-node-dir>/config/genesis.json)

CONSUMER_P2P_ADDRESS=$(echo $COORDINATOR_P2P_ADDRESS | sed 's/:.*/:26646/')

interchain-securityd start --home <consumer-node-dir> \
        --rpc.laddr tcp://${MY_IP}:26648 \
        --grpc.address ${MY_IP}:9081 \
        --address tcp://${MY_IP}:26645 \
        --p2p.laddr tcp://${MY_IP}:26646 \
        --grpc-web.enable=false \
        --p2p.persistent_peers $CONSUMER_P2P_ADDRESS \
        &> <consumer-node-dir>/logs &

7. Query the consumer chain node Update the node client RPC endpoint using the following command.

sed -i -r "/node =/ s/= .*/= \"tcp:\/\/${MY_IP}:26648\"/" <consumer-node-dir>/config/client.toml

Query the consumer chain and check that the validator node was added to the validator set.

interchain-securityd q tendermint-validator-set --home <consumer-node-dir>



Test the CCV protocol

These optional steps show you how CCV updates the Consumer chain validator-set voting power. In order to do so, we will delegate some tokens to the validator on the Provider chain and verify that the Consumer chain validator-set gets updated.

1. Delegate tokens

# Get validator delegations
DELEGATIONS=$(interchain-securityd q staking delegations $(jq -r .address <provider-keyname>_keypair.json) --home <provider-node-dir> -o json)

# Get validator operator address
OPERATOR_ADDR=$(echo $DELEGATIONS | jq -r '.delegation_responses[0].delegation.validator_address')


# Delegate tokens
interchain-securityd tx staking delegate $OPERATOR_ADDR 1000000stake \
                --from <provider-keyname> \
                --keyring-backend test \
                --home <provider-node-dir> \
                --chain-id provider \
                -y -b block

2.Check the validator-set
This commands below will print the updated validator consensus info.

# Get validator consensus address
VAL_ADDR=$(interchain-securityd tendermint show-address --home <provider-node-dir>)
        
# Query validator consenus info        
interchain-securityd q tendermint-validator-set --home <consumer-node-dir> | grep -A11 $VAL_ADDR
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment