Skip to content

Instantly share code, notes, and snippets.

@jtremback
Last active March 24, 2022 17:13
Show Gist options
  • Save jtremback/618cf97e7e75bc61556b7072d00b90de to your computer and use it in GitHub Desktop.
Save jtremback/618cf97e7e75bc61556b7072d00b90de to your computer and use it in GitHub Desktop.
  • delete old cosmos folder if neccesary rm -rf /provider
  • init new genesis and other state (i don't know why it needs a moniker) interchain-securityd init --chain-id provider jehan --home /provider
  • make the keys interchain-securityd keys add jehan --home /provider
  • add to the genesis interchain-securityd add-genesis-account cosmos18dnlag2vt2x0x30zg6m0ncxaalhxp4vl8rpyjl 1000000000stake --home /provider
  • add someone else to the genesis interchain-securityd add-genesis-account cosmos1t0nv6nr2scsa993ujldr7xmww5w66kcxv2cp4f 1000000000stake --home /provider
  • get the genesis out cat /provider/config/genesis.json
  • modify genesis if needed
  • For other validators: copy the genesis into /provider/config/genesis.json
  • add your gentx, bonding half of the coins here interchain-securityd gentx jehan 500000000stake --chain-id provider --home /provider
  • add anyone else's gentxs vi /provider/config/gentx/gentx-942a4c70819f7e6464607860fe35237427dc9240.json
  • make the final genesis file interchain-securityd collect-gentxs --home /provider
  • have anyone else save it vi /provider/config/genesis.json
  • start the chain with interchain-securityd start --home /provider --p2p.laddr tcp://143.110.237.79:26656 --address tcp://143.110.237.79:26655 --grpc.address 143.110.237.79:9091 --rpc.laddr tcp://143.110.237.79:26658 --grpc-web.enable=false
  • send someone tokens if you want interchain-securityd tx bank send jehan cosmos14fq9yztw2rq768f53p5x6dwrndjtw49tc5nqzs 1000000stake --home /provider --chain-id provider --node http://143.110.237.79:26658

Consumer chain

  • Make a consumer chain proposal on the provider vi child-proposal.json
{
    "title": "Create a chain",
    "description": "Gonna be a great chain",
    "chain_id": "consumer",
    "initial_height": {
        "revision_height": 1
    },
    "genesis_hash": "Z2VuX2hhc2g=",
    "binary_hash": "YmluX2hhc2g=",
    "spawn_time": "2022-03-11T09:02:14.718477-08:00",
    "deposit": "10000001stake"
}
  • create the proposal on the provider chain interchain-securityd tx gov submit-proposal create-child-chain ./child-proposal.json --chain-id provider --from jehan --home /provider

  • Vote for the proposal interchain-securityd tx gov vote 1 yes --from jehan --chain-id provider --home /provider -b block

  • Everyone preps their consumer validators

    • delete old cosmos folder if neccesary rm -rf /consumer
    • make the keys interchain-securityd keys add jehan --home /consumer
  • Testnet coordinator makes genesis.json

    • init genesis interchain-securityd init jehan --chain-id consumer --home /consumer
    • add people's accounts to the genesis interchain-securityd add-genesis-account cosmos18dnlag2vt2x0x30zg6m0ncxaalhxp4vl8rpyjl 1000000000stake --home /consumer
    • add someone else to the genesis interchain-securityd add-genesis-account cosmos1t0nv6nr2scsa993ujldr7xmww5w66kcxv2cp4f 1000000000stake --home /consumer
    • get the genesis out cat /consumer/config/genesis.json
    • query the consumer genesis state from the provider interchain-securityd query parent child-genesis consumer --home /provider -o json
    • paste it into the ccvchild section of the consumer's genesis
  • Everyone bootstraps their files

    • paste genesis from above into consumer folder vi /consumer/config/genesis.json
    • make empty priv validator state file echo '{"height": "0","round": 0,"step": 0}' > /consumer/data/priv_validator_state.json
    • copy the priv validator key from the provider to the consumer cp /provider/config/priv_validator_key.json /consumer/config/priv_validator_key.json
    • copy the node key from the provider to the consumer cp /provider/config/node_key.json /consumer/config/node_key.json
    • issue the gentx command (even though we will not use the created gentx) interchain-securityd gentx jehan 500000000stake --chain-id consumer --home /consumer
    • exchange peer addresses with other validators cat consumer/config/gentx/gentx-027c0fd67ee51640ac0a7e0852afeed9410e20d4.json | jq, get the address out of the body.memo for example 027c0fd67ee51640ac0a7e0852afeed9410e20d4@143.110.237.79:26656. change the port to 26646.
  • Everyone starts their nodes

    • start the node, while customizing the ports (get your own IP address from the step above). We also set persistent_peers, using the addresses of other validators interchain-securityd start --home /consumer --p2p.laddr tcp://localhost:26646 --address tcp://localhost:26645 --grpc.address localhost:9081 --rpc.laddr tcp://localhost:26648 --grpc-web.enable=false --p2p.persistent_peers 027c0fd67ee51640ac0a7e0852afeed9410e20d4@143.110.237.79:26646
  • Start the relayer

  • hermes keys restore --mnemonic "glare blur deer little sport daring conduct nothing grain boat photo track emerge unit trust identify oil portion language amount original area pioneer wage" consumer

  • hermes keys restore --mnemonic "glare blur deer little sport daring conduct nothing grain boat photo track emerge unit trust identify oil portion language amount original area pioneer wage" provider

  • vi /root/.hermes/config.toml

[global]
 log_level = "info"

[[chains]]
account_prefix = "cosmos"
clock_drift = "5s"
gas_adjustment = 0.1
grpc_addr = "tcp://143.110.237.79:9081"
id = "consumer"
key_name = "relayer"
max_gas = 2000000
rpc_addr = "http://143.110.237.79:26648"
rpc_timeout = "10s"
store_prefix = "ibc"
trusting_period = "14days"
websocket_addr = "ws://143.110.237.79:26647/websocket"

[chains.gas_price]
       denom = "stake"
       price = 0.00

[chains.trust_threshold]
       denominator = "3"
       numerator = "1"

[[chains]]
account_prefix = "cosmos"
clock_drift = "5s"
gas_adjustment = 0.1
grpc_addr = "tcp://143.110.237.79:9091"
id = "provider"
key_name = "relayer"
max_gas = 2000000
rpc_addr = "http://143.110.237.79:26658"
rpc_timeout = "10s"
store_prefix = "ibc"
trusting_period = "14days"
websocket_addr = "ws://143.110.237.79:26657/websocket"

[chains.gas_price]
       denom = "stake"
       price = 0.00

[chains.trust_threshold]
       denominator = "3"
       numerator = "1"
  • hermes create connection consumer --client-a 07-tendermint-0 --client-b 07-tendermint-0
  • hermes create channel consumer --port-a child --port-b parent -o ordered --channel-version 1 --connection-a connection-0
  • check provider powers interchain-securityd query tendermint-validator-set --home /provider --chain-id provider --node http://143.110.237.79:26658
  • delegate some coins interchain-securityd tx staking delegate cosmosvaloper1wtwl466yzcvkhy27su9smr8ycsx7gxtcqpzhg3 1000000stake --from simon --home /provider --chain-id provider
  • check provider powers again, should have changed interchain-securityd tx staking delegate cosmosvaloper1wtwl466yzcvkhy27su9smr8ycsx7gxtcqpzhg3 1000000stake --from simon --home /provider --chain-id provider
  • check consumer powers interchain-securityd query tendermint-validator-set --home /consumer --chain-id consumer --node http://143.110.237.79:26648
  • relay packets hermes clear packets provider parent channel-0
  • check consumer powers again interchain-securityd query tendermint-validator-set --home /consumer --chain-id consumer --node http://143.110.237.79:26648
@jtremback
Copy link
Author

jtremback commented Mar 22, 2022

glare blur deer little sport daring conduct nothing grain boat photo track emerge unit trust identify oil portion language amount original area pioneer wage

cosmos14fq9yztw2rq768f53p5x6dwrndjtw49tc5nqzs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment