---
tags: game-of-chains
---
# Provider chain prep
## Step 1: Test a private testnet with the provider chain binary
Provider chain binary: gaia branch
Scenario 1:
gaia (Theta+) as provider
interchain-security-cd as consumer
Provider inventory file to start the chain:
```yaml=
---
# yamllint disable rule:line-length
all:
vars:
ansible_user: root
node_user: provider
chain_home: "{{node_user_home}}/.isp"
chain_binary_name: gaiad
chain_version: glnro/ics-sdk45 # "Theta+"
chain_repository: https://github.com/cosmos/gaia.git
chain_denom: usit
chain_id: provider
chain_home_clear: true
chain_restore_validator: true
chain_validator_coins: "1001000000000"
chain_gentx_validator: "1000000000"
cosmovisor_service_name: "cv-provider"
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
```
Chain starts
Consumer chain inventory to initialize the chain:
```yaml=
---
# yamllint disable rule:line-length
all:
vars:
ansible_user: root
node_user: sputnik
chain_home: "{{node_user_home}}/.isc"
chain_binary_name: interchain-security-cd
chain_version: tags/v0.1.4
chain_repository: https://github.com/cosmos/interchain-security.git
chain_denom: stake
chain_id: sputnik
chain_home_clear: true
cosmovisor_service_name: "cv-sputnik"
priv_validator_key_file: priv_validator_key.json
node_key_file: node_key.json
chain_moniker: "sputnik"
reboot: false
chain_start: false
children:
node:
hosts:
"{{ target }}":
fast_sync: false
api_port: 1317
p2p_port: 26656
rpc_port: 26657
grpc_port: 9090
grpc_web_enabled: false
rpc_pprof_port: 6060
chain_airdrop: true
chain_airdrop_accounts:
- cosmos1e0ls94v2c7vq5kfk86849c0q9wqarnjwkn6zg9
```
Copy the genesis file
Submit the proposal in provider:
```json
{
"title": "Create the Sputnik chain",
"description": "This is the proposal to create consumer chain \"sputnik\". The genesis file can be found here: https://github.com/hyphacoop/ics-testnets/private/salt-genesis-fresh.json",
"chain_id": "sputnik",
"initial_height": {
"revision_height": 1
},
"genesis_hash": "4b5d741cabc832d5a1527658ebe580340354e62ea849e3e7d21d43023ce20d8d",
"binary_hash": "170da8c01aefc1772447fbb3c9d76661ad568b3ab16e93e6a0996f999c5d8ae5",
"spawn_time": "2022-10-05T13:20:00.000000Z",
"deposit": "1usit"
}
```
Wait for the proposal to go on chain before voting:
```bash=
gaiad tx gov submit-proposal consumer-addition prop.json --from validator --home ~/.isp
gaiad tx gov vote 1 yes --from validator --home ~/.isp
```
Collect ccv states
```bash=
gaiad q provider consumer-genesis sputnik --home ~/.isp --output json > sputnik-ccv-states.json
```
Copy the ccv states to our local machine
Patch the sputnik genesis file
```
jq -s '.[0].app_state.ccvconsumer = .[1] | .[0]' sputnik-fresh-genesis.json sputnik-ccv-states.json > sputnik-genesis.json
```
Copy the patched genesis file to the sputnik machine
Attempt to start sputnik:
- Error: `panic: unknown field "historical_entries" in types.Params`
Try removing the `historical_entries` field from the ccv_params section in the sputnik genesis file.
Attempt to start sputnik again:
- Error: `panic: unknown field "ccv_timeout_period" in types.Params`
Try removing the `ccv_timeout_period` field from the ccv_params section in the sputnik genesis file.
Attempt to start sputnik again:
- Error: `panic: unknown field "consumer_redistribution_fraction" in types.Params`
Try removing the `consumer_redistribution_fraction` field from the ccv_params section in the sputnik genesis file.
Attempt to start sputnik again:
- Error: `panic: unknown field "historical_entries" in types.Params`
Try resetting the database:
```
interchain-security-cd unsafe-reset-all --home ~/.isc
```
Attempt to start sputnik again
```
panic: unknown field "unbonding_period" in types.Params
```
Remove `unbonding period`, reset the database, and start the cv service again.
```
panic: unknown field "transfer_timeout_period" in types.Params
```
Remove `transfer_timeout_period`, reset the database, and start the cv service again.
```
panic: unknown field "height_to_valset_update_id" in types.GenesisState
```
Remove `height_to_valset_update_id`
```
panic: unknown field "outstanding_downtime_slashing" in types.GenesisState
```
Remove `outstanding_downtime_slashing` and `pending_slash_requests`
**The sputnik chain can now start**
Set up the relayer.
Run the `hermes.yml` playbook:
```yaml=
---
# yamllint disable rule:line-length
all:
vars:
chain_home_clear: true
hermes_version: v1.0.0
ansible_user: root
reboot: false
children:
hermes:
hosts:
goc-2.stg.earthball.xyz:
hermes_relayer_mnemonics: true
hermes_order: ordered
hermes_set_channel_version: true
hermes_channel_version: '1'
mode_channels: 'true'
hermes_set_clients: true
hermes_chains:
sputnik:
hermes_relayer_mnemonic: 'hypha-mnemonic.txt'
hermes_port_name: consumer
hermes_client_id: 07-tendermint-0
hermes_chain_rpc_url_schema: http
hermes_chain_rpc_hostname: goc-2.stg.earthball.xyz
hermes_chain_rpc_port: 26657
hermes_chain_grpc_url_schema: http
hermes_chain_grpc_hostname: goc-2.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.001, 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' }"
provider:
hermes_relayer_mnemonic: 'hypha-mnemonic.txt'
hermes_port_name: provider
hermes_client_id: 07-tendermint-0
hermes_chain_rpc_url_schema: http
hermes_chain_rpc_hostname: goc-1.stg.earthball.xyz
hermes_chain_rpc_port: 26657
hermes_chain_grpc_url_schema: http
hermes_chain_grpc_hostname: goc-1.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.001, denom = 'usit' }"
hermes_chain_gas_multiplier: 1.1
hermes_chain_clock_drift: '5s'
hermes_chain_trusting_period: '14days'
hermes_chain_trust_threshold: "{ numerator = '1', denominator = '3' }"
```
Test the voting power gets updated in the consumer chain when more stake is delegated to a validator in the provider chain.
Scenario 2: (wait until Lauren confirms)
gaia (Theta+) as provider
gaia (Theta+) as consumer
Create keys:
- Validator 1
- Priv validator key
- Node key
- Self-delegation mnemonic & address
- Node ID
- Validator 2
- Priv validator key
- Node key
- Self-delegation mnemonic and address
- Node ID
- Faucet mnemonic
- Playmaker 1 mnemonic
- Playmaker 2 mnemonic
Run this test inventory:
```
---
# yamllint disable rule:line-length
all:
vars:
ansible_user: root
node_user: provider
chain_home: "{{node_user_home}}/.isp"
chain_binary_name: gaiad
chain_version: glnro/ics-sdk45 # "Theta+"
chain_repository: https://github.com/cosmos/gaia.git
chain_denom: usit
chain_id: provider
chain_home_clear: true
chain_recover_validator: true
chain_validator_coins: "1002050000000"
chain_gentx_validator: "2050000000"
cosmovisor_service_name: "cv-provider"
chain_gov_testing: true
chain_voting_period: 172800s
reboot: false
priv_validator_key_file: player_priv_validator_key.json
node_key_file: player_node_key.json
chain_airdrop: true
chain_airdrop_accounts:
- cosmos1k3lw0g72hc2pdat46z84t8j4uqe4t0heygdc6l
- cosmos16h4y2kjnax4s9vwfn87tpl37emy7h4hhg3wn69
- cosmos1ypj5z0djfs6zntx4xlgsylff7y8l6s7uxvcvn9
- cosmos1mfm3agshcdavujy495d4sprzjqfmdezlhhzu2w
chain_use_ssl_proxy: true
chain_api_host: "rest"
chain_rpc_host: "rpc"
chain_p2p_host: "p2p"
chain_grpc_host: "grpc"
letsencrypt_email: "dante@hypha.coop"
chain_start: false
children:
node:
hosts:
"test-player.goc.earthball.xyz":
fast_sync: false
```
After the genesis file is created:
- update the balances for all airdrop accounts.
- update the supply so it equals the sum of all balances.
- update the unbonding time
- update the max validators
- Check the voting period and gov params
- ccv_timeout_period: 4 wks
- init_timeout_period 2 days
- vsc_timeout_period 8 days
- trusting_period_fraction "2"
- signed_blocks_window 8640
Copy the modified genesis to the validator node.
Set up as much as we can in the app.toml / config.toml files
Enable the cv-provider service
Start the cv-provider service
Confirm the genesis modifications have been accepted.
- Set up a single validator node: OK
- Add a sentry node
```yaml=
---
# yamllint disable rule:line-length
all:
vars:
ansible_user: root
node_user: provider
chain_home: "{{node_user_home}}/.isp"
chain_binary_name: gaiad
chain_version: glnro/ics-sdk45 # "Theta+"
chain_repository: https://github.com/cosmos/gaia.git
genesis_file: test-provider-modified-genesis.json
chain_id: provider
chain_home_clear: true
cosmovisor_service_name: "cv-provider"
reboot: false
chain_use_ssl_proxy: true
chain_api_host: "rest"
chain_rpc_host: "rpc"
chain_p2p_host: "p2p"
chain_grpc_host: "grpc"
letsencrypt_email: "dante@hypha.coop"
children:
node:
hosts:
"test-sentry.goc.earthball.xyz":
fast_sync: false
pruning: nothing
api_enabled: true
p2p_persistent_peers: "4b5cee15e6a9c4b96b8c1c4f396a18b0461edc17@138.197.172.12:26656"
```
- Add a seed node
```yaml=
---
# yamllint disable rule:line-length
all:
vars:
ansible_user: root
node_user: provider
chain_home: "{{node_user_home}}/.isp"
chain_binary_name: gaiad
chain_version: glnro/ics-sdk45 # "Theta+"
chain_repository: https://github.com/cosmos/gaia.git
genesis_file: test-provider-modified-genesis.json
chain_id: provider
chain_home_clear: true
cosmovisor_service_name: "cv-provider"
reboot: false
chain_use_ssl_proxy: true
chain_api_host: "rest"
chain_rpc_host: "rpc"
chain_p2p_host: "p2p"
chain_grpc_host: "grpc"
letsencrypt_email: "dante@hypha.coop"
children:
node:
hosts:
"test-seed.goc.earthball.xyz":
fast_sync: false
pruning: everything
api_enabled: true
p2p_persistent_peers: "6fba9b23c2def5b72bcabbdb93e92e1a49cedf69@147.182.155.36:26656"
p2p_seed_mode: true
```
Update all the app.toml and config.toml settings for the nodes set up so far using the testnet coordinator tasks spreadsheet (see `Assets`).
- Set up a second validator node
```
---
# yamllint disable rule:line-length
all:
vars:
ansible_user: root
node_user: provider
chain_home: "{{node_user_home}}/.isp"
chain_binary_name: gaiad
chain_version: glnro/ics-sdk45 # "Theta+"
chain_repository: https://github.com/cosmos/gaia.git
genesis_file: test-provider-modified-genesis.json
chain_id: provider
chain_home_clear: true
cosmovisor_service_name: "cv-provider"
reboot: false
priv_validator_key_file: ace_priv_validator_key.json
node_key_file: ace_node_key.json
chain_use_ssl_proxy: true
chain_api_host: "rest"
chain_rpc_host: "rpc"
chain_p2p_host: "p2p"
chain_grpc_host: "grpc"
letsencrypt_email: "dante@hypha.coop"
children:
node:
hosts:
"test-ace.goc.earthball.xyz":
fast_sync: false
pruning: nothing
p2p_seeds: "7a86ddc92f56e77a26c4fb4d543412f7175a7c9b@147.182.155.35:26656"
```
The ace node is able to sync with the network.
Next, create a second validator:
Recover the ace key.
```
gaiad keys add ace --home ~/.isp --recover
```
Create the ace validator
```
gaiad tendermint show-validator --home ~/.isp
{"@type":"/cosmos.crypto.ed25519.PubKey","key":"x3/2/KQNr7cSEPaQk48zeApi5TqyLeN9tmPjh97pzQs="}
gaiad tx staking create-validator --amount 50000000usit --pubkey '{"@type":"/cosmos.crypto.ed25519.PubKey","key":"x3/2/KQNr7cSEPaQk48zeApi5TqyLeN9tmPjh97pzQs="}' --moniker ace --chain-id provider --commission-rate 0.10 --commission-max-rate 1.00 --commission-max-change-rate 0.1 --min-self-delegation 1000000 --gas auto --from cosmos1k3lw0g72hc2pdat46z84t8j4uqe4t0heygdc6l --home ~/.isp
```
Set up a block explorer:
Set up DNS for hasura. as well as the hostname, and run this inventory:
```yaml=
---
# yamllint disable rule:line-length
all:
vars:
ansible_user: root
hasura_admin_secret: provider # Any random password will work
# Change if not running a cosmos hub testnet, see branches of bdjuno:
bdjuno_version: "chains/cosmos/testnet"
bdui_chain: testnet # Either testnet or mainnet
bigdipper_use_tls_proxy: true # Enables TLS, requires a domain name
letsencrypt_email: "dant@hypha.coop" # Required for TLS setup
genesis_file: "test-provider-modified-genesis.json"
chain_id: provider
bigdipper_genesis_time: "2022-11-04T16:18:19.631501983Z"
bigdipper_genesis_height: 1
children:
bigdipper:
hosts:
"test-explorer.goc.earthball.xyz":
bdjuno_rpc_address: "https://rpc.test-sentry.goc.earthball.xyz"
bdjuno_grpc_address: "https://grpc.test-sentry.goc.earthball.xyz"
bdui_rpc_websocket: "wss://rpc.test-sentry.goc.earthball.xyz/websocket"
```
Data was not showing in the UI, bdjuno's log shows this:
```
ERROR: failed to start client: dial tcp: address rpc.test-sentry.goc.earthball.xyz: missing port in address
```
Update the address and run the inventory again.
Remove nodejs from the droplet
Run the inventory again
Add the hypha logos next.
Set up the faucet:
We'll try to install it on the same droplet as the seed node.
In order for the faucet to give out tokens, we need to recover the faucet account on the node first.
Recover the faucet key in the seed node:
```
gaiad keys add faucet --home ~/.isp --recover
```
Run this inventory:
```
---
# yamllint disable rule:line-length
all:
vars:
ansible_user: root
faucet_address: cosmos16h4y2kjnax4s9vwfn87tpl37emy7h4hhg3wn69
faucet_use_tls_proxy: true
letsencrypt_email: "dante@hypha.coop" # Required for TLS setup
node_user: provider
chain_home: "{{node_user_home}}/.isp"
chain_binary_name: gaiad
chain_id: provider
chain_denom: usit
amount_to_send: 1000
request_timeout: 604800
reboot: false
children:
faucet:
hosts:
"test-faucet.goc.earthball.xyz":
```
Set up the consensus monitor
```yaml=
---
# yamllint disable rule:line-length
all:
vars:
ansible_user: root
consensus_use_tls_proxy: true # Enables TLS, requires a domain name
letsencrypt_email: "dante@hypha.coop" # Required for TLS setup
children:
consensus:
hosts:
"test-consensus.goc.earthball.xyz":
consensus_api_node_url: "http://localhost:1317"
consensus_rpc_node_url: "http://localhost:26657"
```
## Step 2: Try adding a consumer chain
- Propose and vote for an interchain-security-cd consumer
- Start the consumer chain
- Set up the relayer
-
## Step 3: Start the provider chain
## fixing certificate issue
Enable default site
``ln -s /etc/nginx/sites-available/default /etc/nginx/sites-enabled/``
Disable test-consensus.goc.earthball.xyz in sites-enabled
``mv test-consensus.goc.earthball.xyz /root/``
Restart nginx
``systemctl restart nginx``
Request cert
``certbot certonly --webroot -w /var/www/html/ -d test-consensus.goc.earthball.xyz --rsa-key-size 4096``
Re-enable test-consensus.goc.earthball.xyz
``mv /root/test-consensus.goc.earthball.xyz /etc/nginx/sites-enabled/``
Restart nginx
``systemctl restart nginx``