# Test latest Hermes relayer between provider and Neutron consumer chain We will attempt to start a Neutron chain as a consumer chain to a provider chain. Requirements: - Neutron binary - One droplet for one validator Neutron repo: https://github.com/neutron-org/neutron/tree/feat/interchain-security ## 1. Start the provider chain ``` --- # yamllint disable rule:line-length all: vars: ansible_user: root node_user: provider chain_home: "{{node_user_home}}/.isp" chain_binary_name: interchain-security-pd chain_version: 'main' major_version: 7 minor_version: 1 patch_version: 0 chain_repository: https://github.com/cosmos/interchain-security.git chain_denom: stake chain_id: provider chain_home_clear: true node_service_name: "provider" # chain_create_validator: true chain_restore_validator: true gentx_enabled: true chain_validator_coins: "1000001000000" chain_gentx_validator: "1000000" cosmovisor_service_name: "cv-provider" collect_gentx: true chain_gov_testing: true chain_voting_period: 60s reboot: false priv_validator_key_file: priv_validator_key.json node_key_file: node_key.json children: node: hosts: "{{ target }}": fast_sync: false ``` ## 2. Initialize the `sugar` consumer chain ```yaml= --- # yamllint disable rule:line-length all: vars: ansible_user: root node_user: sugar chain_home: "{{node_user_home}}/.isc" chain_binary_name: neutrond chain_version: 'feat/interchain-security-with-governance' chain_repository: https://github.com/neutron-org/neutron.git chain_binary_release: https://github.com/neutron-org/neutron/raw/feat/interchain-security-with-governance/neutrond chain_binary_source: release chain_denom: grain chain_id: sugar chain_home_clear: true node_service_name: "sugar" chain_create_validator: false chain_restore_validator: true chain_validator_coins: "1000000000000" cosmovisor_service_name: "cv-sugar" priv_validator_key_file: priv_validator_key.json node_key_file: node_key.json chain_moniker: "sugar" validator_mnemonic: "dwarf yellow hybrid join enjoy quiz quick glow rely fury power blanket boat sugar illness bread color reduce squeeze flower execute pass absent know" reboot: false children: node: hosts: "{{ target }}": fast_sync: false api_port: 1337 p2p_port: 26676 rpc_port: 26677 grpc_port: 9094 grpc_web_enabled: false rpc_pprof_port: 6064 ``` Copy the initialized genesis file and get the hash for it. ## 3. Submit a proposal to start the Neutron consumer chain Submit gov proposal from provider chain: ```bash interchain-security-pd tx gov submit-proposal consumer-addition prop.json --from validator --home ~/.isp --keyring-backend test ``` Vote on gov proposal on provider chain: ```bash interchain-security-pd tx gov vote 1 yes --from validator --home ~/.isp --keyring-backend test -y ``` Check that the proposal passed ``` interchain-security-pd q gov proposal 7 --home ~/.isp ``` ## 3. Update the genesis file Collect CCV states in the provider chain ```bash interchain-security-pd q provider consumer-genesis sugar --output json --home ~/.isp > sugar-ccv-states.json ``` Copy json file to local machine Update fresh consumer genesis file with CCV states ```bash jq -s '.[0].app_state.ccvconsumer = .[1] | .[0]' fresh-sugar-genesis.json sugar-ccv-states.json > sugar-genesis.json ``` ## 4. Start the consumer chain Copy the modified genesis file to the consumer chain machine. Start the cosmovisor service i. Blocks should be coming in now on the consumer chain, but we need to link it to the provider chain next. ## 5. Set up the relayer between chains - Set `hermes_order: ordered` - Set `hermes_channel_version: '1'` - The consumer chain must be the first chain listed (chain a) - The port name of the consumer chain must be `consumer` - The port name of the provider chain must be `provider` - The client id must be specified - Enable the channel workers for handshake completion. Hermes playboook: ```yaml= --- # yamllint disable rule:line-length all: vars: chain_home_clear: true hermes_version: master ansible_user: root reboot: false children: hermes: hosts: ibc-test.stg.earthball.xyz: hermes_relayer_mnemonics: true hermes_order: ordered hermes_channel_version: '1' mode_channels: 'true' hermes_chains: sugar: hermes_relayer_mnemonic: 'hypha-mnemonic.txt' hermes_port_name: consumer hermes_chain_rpc_url_schema: http hermes_chain_rpc_hostname: ibc-test.stg.earthball.xyz hermes_chain_rpc_port: 26677 hermes_chain_grpc_url_schema: http hermes_chain_grpc_hostname: ibc-test.stg.earthball.xyz hermes_chain_grpc_port: 9094 hermes_chain_websocket_url_schema: ws hermes_chain_rpc_timeout: '10s' hermes_chain_account_prefix: 'neutron' hermes_chain_key_name: 'testkey' hermes_chain_store_prefix: 'ibc' hermes_chain_max_gas: 2000000 hermes_chain_fee_granter: '' gas_price: "{ price = 0.00, denom = 'grain' }" hermes_chain_gas_multiplier: 1.1 hermes_chain_clock_drift: '5s' hermes_chain_trusting_period: '14days' hermes_chain_trust_threshold: "{ numerator = '1', denominator = '3' }" provider: hermes_relayer_mnemonic: 'hypha-mnemonic.txt' hermes_port_name: provider hermes_chain_rpc_url_schema: http hermes_chain_rpc_hostname: ibc-test.stg.earthball.xyz hermes_chain_rpc_port: 26657 hermes_chain_grpc_url_schema: http hermes_chain_grpc_hostname: ibc-test.stg.earthball.xyz hermes_chain_grpc_port: 9090 hermes_chain_websocket_url_schema: ws hermes_chain_rpc_timeout: '10s' hermes_chain_account_prefix: 'cosmos' hermes_chain_key_name: 'testkey' hermes_chain_store_prefix: 'ibc' hermes_chain_max_gas: 2000000 hermes_chain_fee_granter: '' gas_price: "{ price = 0.00, denom = 'stake' }" hermes_chain_gas_multiplier: 1.1 hermes_chain_clock_drift: '5s' hermes_chain_trusting_period: '14days' hermes_chain_trust_threshold: "{ numerator = '1', denominator = '3' }" ``` ## 6. Check the validator set matches between chains. On provider chain: ``` interchain-security-pd q tendermint-validator-set --home ~/.isp ``` On sugar chain: ``` neutrond q tendermint-validator-set --home ~/.isc ``` Sending a `tx staking delegate` command in the provider chain should result in an updated validator set in the consumer (`sugar`) chain. ## 7. Check ibc transfers between sugar and provider On sugar chain: ``` neutrond tx ibc-transfer transfer transfer channel-1 cosmos1e0ls94v2c7vq5kfk86849c0q9wqarnjwkn6zg9 1000grain --from validator --home ~/.isc --node http://localhost:26677 ``` On provider chain: ``` interchain-security-pd q bank balances cosmos1e0ls94v2c7vq5kfk86849c0q9wqarnjwkn6zg9 balances: - amount: "1000" denom: ibc/7A498C3D78BE60F7C17E4BC26AD48F69405FA71DF7263ADFF9380924F1951114 - amount: "1000000013247" denom: stake pagination: next_key: null total: "0" ``` On provider chain: ``` interchain-security-pd tx ibc-transfer transfer transfer channel-1 neutron1e0ls94v2c7vq5kfk86849c0q9wqarnjwjvnqjz 1000gstake --from validator --home ~/.isp --node http://localhost:26657 ``` On sugar chain: ``` neutrond q bank balances neutron1e0ls94v2c7vq5kfk86849c0q9wqarnjwjvnqjz --home ~/.isc ```