Chaosnet is an expanded version of localnet that runs:
- up to two validators (nibiru-0 and nibiru-1)
- pricefeeders for each validator
- a hermes relayer between the two validators (if the
ibc
profile is used) - a postgres:14 database (if the
heartmonitor
profile is used) - a heartmonitor instance (if the
heartmonitor
profile is used) - a graphql server (if the
heartmonitor
profile is used)
- Make sure you have Docker installed and running
- Make sure you have
make
installed - (Optional) Docker login to ghcr.io (only if you want to use the
heartmonitor
profile)
docker login ghcr.io
Enter your GitHub username for the username
field, and your personal access token for the password.
- Run
make chaosnet
Note that this will take a while the first time you run it, as it will need to pull all the images from the registry, build the chaonset image locally, and set up the IBC channel (which has a lot of round trip packet commits).
Other profiles include
make chaosnet-ibc
: creates two validator instances and a hermes relayermake chaosnet-heartmonitor
: single validator with heartmonitor+graphql instance
By default, most images (heartmonitor, etc.) are cached locally and won't re-fetch from upstream registries. To force a pull, you can run
make chaosnet-build
To send an IBC transfer from nibiru-0 to nibiru-1, run:
-
SSH into nibiru-0
docker compose -f ./contrib/docker-compose/docker-compose-chaosnet.yml exec -it nibiru-0 /bin/ash
-
Transfer tokens from nibiru-0 to nibiru-1
nibid tx ibc-transfer transfer transfer \ channel-0 \ nibi18mxturdh0mjw032c3zslgkw63cukkl4q5skk8g \ 1000000unibi \ --from validator \ --fees 5000unibi \ --yes | jq
-
In a new shell, SSH into nibiru-1
docker compose -f ./contrib/docker-compose/docker-compose-chaosnet.yml exec -it nibiru-1 /bin/ash
-
Query the balance of nibiru-1
# set the config since nibiru-1 has different ports nibid config node "http://localhost:36657" nibid q bank balances $(nibid keys show validator -a) | jq
Output:
{ "balances": [ { "denom": "ibc/9BEE732637B12723D26E365D19CCB624587CE6254799EEE7C5F77B587BD677B0", "amount": "1000000" }, { "denom": "unibi", "amount": "9999100000000" } ], "pagination": { "next_key": null, "total": "0" } }
-
Send tokens from nibiru-1 to nibiru-0
nibid tx ibc-transfer transfer transfer \ channel-0 \ nibi1zaavvzxez0elundtn32qnk9lkm8kmcsz44g7xl \ 5555unibi \ --from validator \ --fees 5000unibi \ --yes | jq
-
Go back to the nibiru-0 and query the balance
nibid q bank balances $(nibid keys show validator -a) | jq
Output:
{ "balances": [ { "denom": "ibc/9BEE732637B12723D26E365D19CCB624587CE6254799EEE7C5F77B587BD677B0", "amount": "5555" }, { "denom": "unibi", "amount": "9999098995000" } ], "pagination": { "next_key": null, "total": "0" } }
-
Send IBC tokens back to nibiru-1
nibid tx ibc-transfer transfer transfer \ channel-0 \ nibi18mxturdh0mjw032c3zslgkw63cukkl4q5skk8g \ 5555ibc/9BEE732637B12723D26E365D19CCB624587CE6254799EEE7C5F77B587BD677B0 \ --from validator \ --fees 5000unibi \ --yes | jq
-
Verify tokens are sent
nibid q bank balances $(nibid keys show validator -a) | jq
Output:
{ "balances": [ { "denom": "unibi", "amount": "9999098990000" } ], "pagination": { "next_key": null, "total": "0" } }
-
Back in the nibiru-1 shell, send tokens back to nibiru-0
nibid tx ibc-transfer transfer transfer \ channel-0 \ nibi1zaavvzxez0elundtn32qnk9lkm8kmcsz44g7xl \ 1000000ibc/9BEE732637B12723D26E365D19CCB624587CE6254799EEE7C5F77B587BD677B0 \ --from validator \ --fees 5000unibi \ --yes | jq
-
Verify tokens are sent
nibid q bank balances $(nibid keys show validator -a) | jq
Output:
{ "balances": [ { "denom": "unibi", "amount": "9999099990000" } ], "pagination": { "next_key": null, "total": "0" } }
The following steps assume nibiru-0 is the controller chain and nibiru-1 is the host chain.
The goal is to have an nibiru-0 use an interchain account on nibiru-1 to stake to a validator.
-
SSH into nibiru-0
docker compose -f ./contrib/docker-compose/docker-compose-chaosnet.yml exec -it nibiru-0 /bin/ash
-
Register an Interchain Account on nibiru-0
# on nibiru-0 FROM=nibi1zaavvzxez0elundtn32qnk9lkm8kmcsz44g7xl nibid tx interchain-accounts controller \ register \ connection-0 \ --from $FROM \ --gas auto \ --gas-adjustment 1.5 \ --gas-prices 0.025unibi \ --yes
-
Query the interchain account address
# on nibiru-0 nibid q interchain-accounts controller \ interchain-account \ nibi1zaavvzxez0elundtn32qnk9lkm8kmcsz44g7xl \ connection-0 | jq # nibi124zc9yjjksxrfrzpfvkysl3r8zrlef2rce5ccqt9mavgy66hhzmqtrvvlr
-
In a new terminal, SSH into nibiru-1
docker compose -f ./contrib/docker-compose/docker-compose-chaosnet.yml exec -it nibiru-1 /bin/ash
-
Fund the interchain account
# on nibiru-1 nibid tx bank send \ nibi18mxturdh0mjw032c3zslgkw63cukkl4q5skk8g \ nibi124zc9yjjksxrfrzpfvkysl3r8zrlef2rce5ccqt9mavgy66hhzmqtrvvlr \ 1000000unibi \ --yes | jq nibid q bank balances nibi124zc9yjjksxrfrzpfvkysl3r8zrlef2rce5ccqt9mavgy66hhzmqtrvvlr | jq
-
Generate packet data from the host chain
# on nibiru-1 cat << EOF | jq | tee msg_delegate.json { "@type":"/cosmos.staking.v1beta1.MsgDelegate", "delegator_address":"nibi124zc9yjjksxrfrzpfvkysl3r8zrlef2rce5ccqt9mavgy66hhzmqtrvvlr", "validator_address":"nibivaloper18mxturdh0mjw032c3zslgkw63cukkl4qatcdn4", "amount": { "denom": "unibi", "amount": "500000" } } EOF nibid tx interchain-accounts host \ generate-packet-data \ "$(cat msg_delegate.json)" \ --encoding proto3 | jq # copy the output
-
Send the packet from the controller chain
# on nibiru-0 cat << EOF | jq | tee packet.json { "type": "TYPE_EXECUTE_TX", "data": "Cq4BCiMvY29zbW9zLnN0YWtpbmcudjFiZXRhMS5Nc2dEZWxlZ2F0ZRKGAQo/bmliaTEyNHpjOXlqamtzeHJmcnpwZnZreXNsM3I4enJsZWYycmNlNWNjcXQ5bWF2Z3k2Nmhoem1xdHJ2dmxyEjJuaWJpdmFsb3BlcjE4bXh0dXJkaDBtancwMzJjM3pzbGdrdzYzY3Vra2w0cWF0Y2RuNBoPCgV1bmliaRIGNTAwMDAw", "memo": "" } EOF FROM=nibi1zaavvzxez0elundtn32qnk9lkm8kmcsz44g7xl nibid tx interchain-accounts controller send-tx \ connection-0 \ packet.json \ --from $FROM \ --gas auto \ --gas-adjustment 1.5 \ --gas-prices 0.025unibi \ --yes | jq
-
Verify that the delegation worked on the host chain
# on nibiru-1 nibid q staking delegations nibi124zc9yjjksxrfrzpfvkysl3r8zrlef2rce5ccqt9mavgy66hhzmqtrvvlr | jq
-
(Optional) Verify the packet data on the host chain
nibid q interchain-accounts host packet-events channel-1 1 | jq
http://localhost:5555
-> GraphQL serverhttp://localhost:8000
-> Faucet server (HTTP POST only)http://localhost:26657
-> nibiru-0 Tendermint RPC servertcp://localhost:9090
-> nibiru-0 Cosmos SDK gRPC serverhttp://localhost:1317
-> nibiru-0 Cosmos SDK LCD (REST) serverhttp://localhost:36657
-> nibiru-1 Tendermint RPC servertcp://localhost:19090
-> nibiru-1 Cosmos SDK gRPC serverhttp://localhost:11317
-> nibiru-1 Cosmos SDK LCD (REST) server
Make sure to update your docker application to version >=23.0.1
No, all volumes are deleted and recreated every time you run make chaosnet
. This is to ensure that you always start with a clean network.
It usually takes a few minutes to set everything up and create the IBC channels. If it takes more than 5 minutes, then check the logs of the chaosnet containers to see if any step failed. Reach out to [email protected] for help.