# IBC testing
## Test locally
### Env.
- 2 Namada chains or forked Gaia
- IBC relayer "Hermes"
- We can use a [prototype](https://github.com/heliaxdev/ibc-rs/tree/yuji/v0.14.0_anoma) to support Namada chains
### Limitations
- A received token address is same as the original one, but it should be fixed for ICS20
- e.g. you have 1000 XAN, then receive 1000 XAN, you will 2000 XAN. (According to ICS20, you should have 1000 XAN and 1000 "origin-specific XAN")
- Packet timeout is temporarily supported with the forked ics23 crate
- The packet timeout with the original ics23 crate failed due to issue [#1007](https://github.com/anoma/anoma/issues/1007)
- The branch (yuji/ibc_test_ibc-rs_v0.14) is using the forked [ics23](https://github.com/heliaxdev/ics23/tree/yuji/for_smt_0.7) for the SMT
- We can transfer between Namada and only forked Gaia with the forked ics23 crate => [Setup Gaia](#Setup-GaiaCosmos)
- Hermes for Anoma is a prototype. The wallet handling is tentative so far
### Set up
#### Automatic Set-up
We can now automatically set up Namada and Hermes via the following scripts:
<https://github.com/anoma/dev-utils/blob/main/scripts/>
See the [README.md](https://github.com/anoma/dev-utils/blob/main/scripts/README.md) for more information.
#### Manual Set-up
Alternatively, we can manually setup the required Namada chains along with Hermes:
1. Run 2 Namada chains
1. Get the branch of Anoma ([yuji/ibc_test_ibc-rs_v0.14](https://github.com/anoma/anoma/tree/yuji/ibc_test_ibc-rs_v0.14))
2. Build Anoma by `make install` or `make build` and wasm by `make build-wasm-scripts` (this requires `wasm-opt`, provided by [binaryen](https://github.com/WebAssembly/binaryen), which can be compiled from source if unavailable)
3. Check `genesis/e2e-tests-single-node.toml` and confirm the hash for `vp_token` matches what was generated by `make build-wasm-scripts`, and update if necessary. If this step is ignored, the `vp_token` may reject transfers to new accounts on the destination chain.
```
# anoma/genesis/dev.toml
[wasm.vp_token]
filename = "vp_token.wasm"
sha256 = "1f40ac...5c597e5"
# 👆 should match 👇
# anoma/wasm/checksums.json
"vp_token.wasm": "vp_token.1f40ac9348a5...c597e5.wasm",
```
4. init-network for Chain A
```bash
cd ${ANOMA_DIR}
GENESIS_PATH="genesis/e2e-tests-single-node.toml"
CHECKSUM_PATH="wasm/checksums.json"
${ANOMAC} utils init-network \
--unsafe-dont-encrypt \
--genesis-path ${GENESIS_PATH} \
--chain-prefix anoma-test \
--localhost \
--dont-archive \
--wasm-checksums-path ${CHECKSUM_PATH}
```
- We can get the chain ID from the result
```
...
Derived chain ID: anoma-test.a483620e269c61d84f7
# on the first run do
CHAIN_A_ID="<the_chain_id_here>"
# on the second run do
CHAIN_B_ID="<the_chain_id_here>"
# these _A_ and _B_ are used later
```
5. Copy wasms and wallet
```bash
CHAIN_ID=${CHAIN_A_ID}
cp ${ANOMA_DIR}/wasm/checksums.json .anoma/${CHAIN_ID}/setup/validator-0/.anoma/${CHAIN_ID}/wasm/
cp ${ANOMA_DIR}/wasm/*.wasm .anoma/${CHAIN_ID}/setup/validator-0/.anoma/${CHAIN_ID}/wasm/
# for client
cp wasm/checksums.json .anoma/${CHAIN_ID}/wasm/
cp wasm/*.wasm .anoma/${CHAIN_ID}/wasm/
# wallet for client
cp .anoma/${CHAIN_ID}/setup/other/wallet.toml .anoma/${CHAIN_ID}/
```
6. init-network for Chain B
- Edit the genesis file "genesis/e2e-tests-single-node.toml" to set another port for `net_address`
```
net_address = "127.0.0.1:28656"
```
- Then, execute init-network like Chain A
7. copy wasms and wallet
- same as Chain A
8. Run chains
```bash
${ANOMAN} --base-dir .anoma/${CHAIN_A_ID}/setup/validator-0/.anoma --mode validator ledger run
# in another terminal
${ANOMAN} --base-dir .anoma/${CHAIN_B_ID}/setup/validator-0/.anoma --mode validator ledger run
```
2. Set up Hermes
1. Get the branch (https://github.com/heliaxdev/ibc-rs/tree/yuji/v0.14.0_anoma)
2. Copy wallets
```bash
mkdir -p ${IBC_RS_DIR}/anoma_wallet/${CHAIN_A_ID}
mkdir -p ${IBC_RS_DIR}/anoma_wallet/${CHAIN_B_ID}
cp ${ANOMA_DIR}/.anoma/${CHAIN_A_ID}/setup/other/wallet.toml ${IBC_RS_DIR}/anoma_wallet/${CHAIN_A_ID}
cp ${ANOMA_DIR}/.anoma/${CHAIN_B_ID}/setup/other/wallet.toml ${IBC_RS_DIR}/anoma_wallet/${CHAIN_B_ID}
```
- This is for the test. It allows for Hermes to send a token by `ft-transfer` command. The signer `albert` is hard-coded for now. But, we should make the relayer's account to the both chains to sign transactions in the future.
3. Copy wasm
```bash
mkdir ${IBC_RS_DIR}/anoma_wasm
cp ${ANOMA_DIR}/wasm/checksums.json ${IBC_RS_DIR}/anoma_wasm
cp ${ANOMA_DIR}/wasm/tx_ibc.* ${IBC_RS_DIR}/anoma_wasm
```
4. Make a config file "config.toml"
- Edit the following config to set the chain IDs and the ports of `rpc_addr` and `websocket_addr`, which have been set in the genesis file
```toml
[global]
log_level = 'debug'
[mode]
[mode.clients]
enabled = true
refresh = true
misbehaviour = true
[mode.connections]
enabled = false
[mode.channels]
enabled = false
[mode.packets]
enabled = true
clear_interval = 10 # relay packets frequently
clear_on_start = false
tx_confirmation = true
[telemetry]
enabled = false
host = '127.0.0.1'
port = 3001
[[chains]]
id = 'anoma-test.fbac1fe7a63e39f6d41' # set your chain ID
rpc_addr = 'http://127.0.0.1:27657' # set the port of the chain
grpc_addr = 'http://127.0.0.1:9090'
websocket_addr = 'ws://127.0.0.1:27657/websocket' # set the port of the chain
rpc_timeout = '10s'
account_prefix = 'cosmos'
key_name = 'albert' # tentative signer
store_prefix = 'ibc'
max_gas = 3000000
max_msg_num = 30
max_tx_size = 2097152
gas_price = { price = 0.001, denom = 'stake' }
clock_drift = '5s'
trusting_period = '14days'
trust_threshold = { numerator = '1', denominator = '3' }
[[chains]]
id = 'anoma-test.19a97ff158649fe43dd' # set your chain ID
rpc_addr = 'http://127.0.0.1:28657' # set the port of the chain
grpc_addr = 'http://127.0.0.1:9090'
websocket_addr = 'ws://127.0.0.1:28657/websocket' # set the port of the chain
rpc_timeout = '10s'
account_prefix = 'cosmos'
key_name = 'albert' # tentative signer
store_prefix = 'ibc'
max_gas = 3000000
max_msg_num = 30
max_tx_size = 2097152
gas_price = { price = 0.001, denom = 'stake' }
clock_drift = '5s'
trusting_period = '14days'
trust_threshold = { numerator = '1', denominator = '3' }
```
3. Now, in the ibc-rs root folder, setup the connection and the channel between chains by Hermes
#### Create a connection
```bash
cargo run --bin hermes -- -c ${HERMES_CONFIG} \
create connection ${CHAIN_A_ID} ${CHAIN_B_ID}
```
Once this succeeds, you should see a value in the `Success` output under `connection_id` (Chain A), e.g.:
```json
a_side: ConnectionSide {
chain: BaseChainHandle {
chain_id: ChainId {
id: "anoma-test.19a97ff158649fe43dd",
version: 0,
},
runtime_sender: Sender { .. },
},
client_id: ClientId(
"07-tendermint-0",
),
connection_id: Some(
ConnectionId(
"connection-0",
),
),
},
```
See the Hermes docs for [New connection over new clients](https://hermes.informal.systems/commands/path-setup/connections.html#new-connection-over-new-clients) for more information.
#### Create a channel
Take note of the `ConnectionId` (in this case, `connection-0`), then proceed to establish a channel on this connection:
```bash
cargo run --bin hermes -- -c ${HERMES_CONFIG} \
create channel \
--port-a transfer --port-b transfer \
${CHAIN_A_ID} connection-0
```
- We can get the created channel IDs to be used for token transfer
- In the following example, the channel ID of Chain `anoma-test.19a97ff158649fe43dd` is `channel-0`.
```json
Success: Channel {
ordering: Unordered,
a_side: ChannelSide {
chain: ProdChainHandle {
chain_id: ChainId {
id: "anoma-test.19a97ff158649fe43dd",
version: 0,
},
runtime_sender: Sender { .. },
},
client_id: ClientId(
"07-tendermint-0",
),
connection_id: ConnectionId(
"connection-0",
),
port_id: PortId(
"transfer",
),
channel_id: Some(
ChannelId(
"channel-0",
),
),
version: None,
},
b_side: ChannelSide {
chain: ProdChainHandle {
chain_id: ChainId {
id: "gaia",
version: 0,
},
runtime_sender: Sender { .. },
},
client_id: ClientId(
"07-tendermint-0",
),
connection_id: ConnectionId(
"connection-0",
),
port_id: PortId(
"transfer",
),
channel_id: Some(
ChannelId(
"channel-0",
),
),
version: None,
},
connection_delay: 0ns,
}
```
4. Start Hermes
```bash
cargo run --bin hermes -- -c ${HERMES_CONFIG} start
```
- Hermes monitors chains. If IBC-related event is emitted from a chain, Hermes checks it and submits a transaction with the corresponding IBC message.
### Token transfer
There are currently 3 ways to test IBC transfers: From the `hermes` CLI, the `anoma` CLI, and from the Wallet UI app.
#### Transaction from Hermes (Hermes submits a transaction)
```bash
cargo run --bin hermes -- -c ${HERMES_CONFIG} \
tx raw ft-transfer ${DST_CHAIN} ${SRC_CHAIN} \
${SRC_PORT_ID} ${SRC_CHANNEL_ID} ${AMOUNT} \
-o ${TIMEOUT_HEIGHT} -d ${TOKEN_ADDRESS}
```
- `SRC_PORT_ID` is `transfer` in this case
- `TIMEOUT_HEIGHT` should be positive
- `${TOKEN_ADDRESS}` should be the address as string
- e.g. XAN: `atest1v4ehgw36x3prswzxggunzv6pxqmnvdj9xvcyzvpsggeyvs3cg9qnywf589qnwvfsg5erg3fkl09rg5`
#### Anoma CLI
1. Set the source chain ID to `default_chain_id` in `${ANOMA_DIR}/.anoma/global-config.toml`
2. Get the receiver's address from the wallet of the counterpart chain
3. Execute `ibc-transfer` command
```bash
${ANOMAC} ibc-transfer --ledger-address ${SOURCE_LEDGER_ADDRESS} \
--source ${SOURCE_ALIAS} --receiver ${RECEIVED_ADDRESS} --token ${TOKEN}\
--amount ${AMOUNT} --channel-id ${CHANNEL_ID}
```
- `RECEIVED_ADDRESS` should be a raw address, not alias
#### Anoma Wallet UI
1. Download and install `anoma-apps` from <https://github.com/anoma/anoma-apps>:
```bash
git clone git@github.com:anoma/anoma-apps.git
```
2. Install dependencies for `anoma-apps`:
```bash
cd anoma-apps && git checkout feat/39-ibc-setup && yarn
```
3. Create a `.env`:
```bash
# Switch to anoma-wallet
cd packages/anoma-wallet
# Create a .env file
vi .env # or whichever editor you prefer
```
4. Configure `.env` variables (minimum config, assumes several defaults):
```bash
# Chain A
REACT_APP_CHAIN_A_ALIAS=Anoma Fractal Instance - 1
REACT_APP_CHAIN_A_ID=anoma-test.1e670ba91369ec891fc
REACT_APP_CHAIN_A_FAUCET=atest1v4ehgw36gfprwdekgg6rsdesg3rry3pjx9prqv3exumrg3zzx3q5vv3nx4zr2v6yggurgwp4rzjk2v
# Chain B
REACT_APP_CHAIN_B_ALIAS=Anoma Fractal Instance - 2
REACT_APP_CHAIN_B_ID=anoma-test.89060614ce340f4baae
REACT_APP_CHAIN_B_FAUCET=atest1v4ehgw36xscyvdpcxgenvdf3x5c523j98pqnz3fjgfq5yvp4xpqnvv69x5erzvjzgse5yd3suq5pd0
```
_NOTE_ See [.env.sample](https://github.com/anoma/anoma-apps/blob/feat/39-ibc-setup/packages/anoma-wallet/.env.sample) for complete list of configurable options to match your environment
5. From `anoma-apps/packages/anoma-wallet`, run `yarn dev:local`
6. This should launch a dev server on port `3000`, and open a tab in the browser
7. Follow the process of establishing a master account in the wallet
8. By default, this will initialize a default token account, and fund it with 1000 tokens of XAN (aliased as NAM token in the app). From the top navigation, click `Settings`, then `Wallet Settings`. Under `Network`, select `Anoma Fractal Instance - 2` (or whichever `Chain B` alias you entered)
9. From the top menu, click `Wallet`, then `Add Account`. Choose `NAM` as the token, give it an alias, then click `Add`
10. Once this account has been initialized, click `Details`, then copy the address
11. From `Settings > Wallet Settings`, change the `Network` back to `Anoma Fractal Instance - 1`, then click `Wallet`
12. Select `Details` for the default account, then `IBC Transfer`
13. Click `Add Channel`, and enter `channel-0`, then click `Add` (This channel should match a valid channel ID on your source chain)
14. Paste the address you copied into `Recipient`, then enter an amount to transfer, then click `Transfer`
15. You should see a `Success` message once it completes. It may take a minute for the recipient balance to update.
16. Click `Settings > Wallet Settings` and switch to the destination network (`Anoma Fractal Instance - 2`), then click `Wallet`
17. You can click `Details` for that account to refresh the balance. Once the destination chain has been successfully updated, the new balance should appear.
### Setup Gaia(Cosmos)
There are a couple methods for setting up Gaia (Cosmos) with Hermes. Before doing either, download and install Gaia:
1. Get [the forked Gaia](https://github.com/heliaxdev/gaia/tree/yuji/ics23_smt)
```bash
git clone https://github.com/heliaxdev/gaia
```
2. Build and install `gaiad` from the source (using branch `yuji/ics23_smt` supporting SMT proofs)
```bash
cd gaia
git checkout yuji/ics23_smt
make install
```
__NOTE__ If `gaiad` is not in your path after installing, you can try the following:
```bash
make build
export PATH=$PATH:$(pwd)/build
```
This will add the `gaiad` binary to your path
#### Method 1: Invoke via one-chain script in Hermes:
1. In `ibc-rs`, invoke the following command to set up and run `gaiad`:
```bash
./scripts/one-chain gaiad gaia ./data 26657 26656 26660 9092 100
```
FYI: The order of these arguments should follow:
```
./scripts/one-chain BINARY CHAIN_ID CHAIN_DIR RPC_PORT P2P_PORT PROFILING_PORT GRPC_PORT SAMOLEANS
```
2. Configure Hermes to use Gaia
Edit Hermes' config file to add the Gaia chain
```toml
[[chains]]
id = 'gaia'
rpc_addr = 'http://127.0.0.1:26657'
grpc_addr = 'http://127.0.0.1:9092'
websocket_addr = 'ws://127.0.0.1:26657/websocket'
rpc_timeout = '10s'
account_prefix = 'cosmos'
key_name = 'testkey'
store_prefix = 'ibc'
max_gas = 3000000
max_msg_num = 30
max_tx_size = 2097152
gas_price = { price = 0.001, denom = 'stake' }
clock_drift = '5s'
trusting_period = '14days'
trust_threshold = { numerator = '1', denominator = '3' }
```
3. Import `gaia` user keys into `hermes`:
```bash
cargo run --bin hermes -- -c config.toml keys add gaia -f data/gaia/user_seed.json
cargo run --bin hermes -- -c config.toml keys add gaia -f data/gaia/user2_seed.json
```
4. Establish a connection between `gaia` and a Namada chain:
```bash
cargo run --bin hermes -- -c config.toml create connection anoma-test.19a97ff158649fe43dd gaia
```
5. Establish a channel on this connection
```bash
cargo run --bin hermes -- -c config.toml create channel --port-a transfer --port-b transfer gaia connection-0
```
Note the channel and counterpary channel ID here. The "counterparty channelId" will be the `channelId` to specify when broadcasting an IBC transfer to the `anoma-test.19a97ff158649fe43dd` chain (chain A -> gaia).
6. Start `hermes` (if not already started):
```bash
cargo run --bin hermes -- -c config.toml start
```
If you need to kill `gaiad` and restart later, from the `ibc-rs` directory, you can run:
```bash
gaiad --home data/gaia start --grpc.address="0.0.0.0:9092"
```
Also, you can query addresses and balances on the Gaia chain as follows (from the `ibc-rs` directory):
```bash=
# Query address of user 1
gaiad --home data/gaia keys --keyring-backend="test" show user -a
# Query address of user 2
gaiad --home data/gaia keys --keyring-backend="test" show user2 -a
# Balance for user 1
gaiad --node tcp://localhost:26657 query bank balances $(gaiad --home data/gaia keys --keyring-backend="test" show user -a)
# Balance for user 2
gaiad --node tcp://localhost:26657 query bank balances $(gaiad --home data/gaia keys --keyring-backend="test" show user2 -a)
```
#### Method 2: Invoke dev set up with dev-env in Hermes:
_NOTE: I was not able to get this method to work, but leaving this here for reference -**JRE**_
1. Move to `ibc-rs` directory (https://github.com/heliaxdev/ibc-rs/tree/yuji/v0.14.0_anoma is recommended) and apply a patch
```
cd ${ibc-rs}
git patch gaia_1_node.patch
```
- The default script sets up 2 gaia chains.
- `gaia_1_node.patch` sets only 1 node up and initializes XAN
```diff
diff --git a/scripts/dev-env b/scripts/dev-env
index eeb3dd87..1b3f3a7a 100755
--- a/scripts/dev-env
+++ b/scripts/dev-env
@@ -19,9 +19,9 @@ if [ -z "$2" ]; then
missing "CHAIN_0_ID"
fi
-if [ -z "$3" ]; then
- missing "CHAIN_1_ID"
-fi
+#if [ -z "$3" ]; then
+# missing "CHAIN_1_ID"
+#fi
if [ "$#" -gt 4 ]; then
diff --git a/scripts/init-hermes b/scripts/init-hermes
index 22d2a81d..be71aa20 100755
--- a/scripts/init-hermes
+++ b/scripts/init-hermes
@@ -21,9 +21,9 @@ if [ -z "$2" ]; then
missing "CHAIN_0_ID"
fi
-if [ -z "$3" ]; then
- missing "CHAIN_1_ID"
-fi
+#if [ -z "$3" ]; then
+# missing "CHAIN_1_ID"
+#fi
if [ "$#" -gt 4 ]; then
@@ -46,10 +46,10 @@ if ! grep -q -s "$CHAIN_0_ID" "$CONFIG_FILE"; then
usage
fi
-if ! grep -q -s "$CHAIN_1_ID" "$CONFIG_FILE"; then
- echo "error: configuration for chain [$CHAIN_1_ID] does not exist in file $CONFIG_FILE."
- usage
-fi
+#if ! grep -q -s "$CHAIN_1_ID" "$CONFIG_FILE"; then
+# echo "error: configuration for chain [$CHAIN_1_ID] does not exist in file $CONFIG_FILE."
+# usage
+#fi
if [ -n "$CHAIN_2_ID" ] && ! grep -q -s "$CHAIN_2_ID" "$CONFIG_FILE"; then
echo "error: configuration for chain [$CHAIN_2_ID] does not exist in file $CONFIG_FILE."
@@ -65,8 +65,8 @@ cargo build -q --locked
echo "Importing keys..."
cargo run -q --bin hermes -- -c "$CONFIG_FILE" keys add "$CHAIN_0_ID" -f "$GAIA_DATA/$CHAIN_0_ID/user_seed.json"
cargo run -q --bin hermes -- -c "$CONFIG_FILE" keys add "$CHAIN_0_ID" -f "$GAIA_DATA/$CHAIN_0_ID/user2_seed.json" -n user2
-cargo run -q --bin hermes -- -c "$CONFIG_FILE" keys add "$CHAIN_1_ID" -f "$GAIA_DATA/$CHAIN_1_ID/user_seed.json"
-cargo run -q --bin hermes -- -c "$CONFIG_FILE" keys add "$CHAIN_1_ID" -f "$GAIA_DATA/$CHAIN_1_ID/user2_seed.json" -n user2
+#cargo run -q --bin hermes -- -c "$CONFIG_FILE" keys add "$CHAIN_1_ID" -f "$GAIA_DATA/$CHAIN_1_ID/user_seed.json"
+#cargo run -q --bin hermes -- -c "$CONFIG_FILE" keys add "$CHAIN_1_ID" -f "$GAIA_DATA/$CHAIN_1_ID/user2_seed.json" -n user2
if [ -n "$CHAIN_2_ID" ]; then
cargo run -q --bin hermes -- -c "$CONFIG_FILE" keys add "$CHAIN_2_ID" -f "$GAIA_DATA/$CHAIN_2_ID/user_seed.json"
diff --git a/scripts/one-chain b/scripts/one-chain
index 30a1af78..f6f3f373 100755
--- a/scripts/one-chain
+++ b/scripts/one-chain
@@ -70,7 +70,7 @@ fi
STAKE="100000000000stake"
# The user also needs stake to perform actions
-USER_COINS="${STAKE},${SAMOLEANS}samoleans"
+USER_COINS="${STAKE},${SAMOLEANS}samoleans,100000000000atest1v4ehgw36x3prswzxggunzv6pxqmnvdj9xvcyzvpsggeyvs3cg9qnywf589qnwvfsg5erg3fkl09rg5"
# Hermes also needs stake to perform actions
HERMES_COINS="${STAKE},${SAMOLEANS}samoleans"
diff --git a/scripts/setup-chains b/scripts/setup-chains
index a95e84db..b4d523ff 100755
--- a/scripts/setup-chains
+++ b/scripts/setup-chains
@@ -17,9 +17,9 @@ if [ -z "$1" ]; then
missing "CHAIN_0_ID"
fi
-if [ -z "$2" ]; then
- missing "CHAIN_1_ID"
-fi
+#if [ -z "$2" ]; then
+# missing "CHAIN_1_ID"
+#fi
if [ "$#" -gt 3 ]; then
@@ -78,14 +78,14 @@ CHAIN_1_SAMOLEANS=100000000000
CHAIN_2_SAMOLEANS=100000000000
"$ONE_CHAIN" gaiad "$CHAIN_0_ID" ./data $CHAIN_0_RPC_PORT 26656 6060 $CHAIN_0_GRPC_PORT $CHAIN_0_SAMOLEANS
-"$ONE_CHAIN" gaiad "$CHAIN_1_ID" ./data $CHAIN_1_RPC_PORT 26556 6061 $CHAIN_1_GRPC_PORT $CHAIN_1_SAMOLEANS
+#"$ONE_CHAIN" gaiad "$CHAIN_1_ID" ./data $CHAIN_1_RPC_PORT 26556 6061 $CHAIN_1_GRPC_PORT $CHAIN_1_SAMOLEANS
if [ -n "$CHAIN_2_ID" ]; then
"$ONE_CHAIN" gaiad "$CHAIN_2_ID" ./data $CHAIN_2_RPC_PORT 26456 6062 $CHAIN_2_GRPC_PORT $CHAIN_2_SAMOLEANS
fi
[ -f "$GAIA_DATA/$CHAIN_0_ID.log" ] && echo "$CHAIN_0_ID initialized. Watch file $GAIA_DATA/$CHAIN_0_ID.log to see its execution."
-[ -f "$GAIA_DATA/$CHAIN_1_ID.log" ] && echo "$CHAIN_1_ID initialized. Watch file $GAIA_DATA/$CHAIN_1_ID.log to see its execution."
+#[ -f "$GAIA_DATA/$CHAIN_1_ID.log" ] && echo "$CHAIN_1_ID initialized. Watch file $GAIA_DATA/$CHAIN_1_ID.log to see its execution."
if [ -n "$CHAIN_2_ID" ]; then
[ -f "$GAIA_DATA/$CHAIN_2_ID.log" ] && echo "$CHAIN_2_ID initialized. Watch file $GAIA_DATA/$CHAIN_2_ID.log to see its execution."
```
2. Edit Hermes' config file to add the Gaia chain
```toml
[[chains]]
id = 'gaia'
rpc_addr = 'http://127.0.0.1:26657'
grpc_addr = 'http://127.0.0.1:9090'
websocket_addr = 'ws://127.0.0.1:26657/websocket'
rpc_timeout = '10s'
account_prefix = 'cosmos'
key_name = 'testkey'
store_prefix = 'ibc'
max_gas = 3000000
max_msg_num = 30
max_tx_size = 2097152
gas_price = { price = 0.001, denom = 'stake' }
clock_drift = '5s'
trusting_period = '14days'
trust_threshold = { numerator = '1', denominator = '3' }
```
3. Run Gaia with the scripts in the `ibc-rs` repository (__NOTE__ If you setup Gaia via `one-chain`, it should already be running. Check with: `ps -e | grep gaiad`)
```
./scripts/dev-env ${HERMES_CONFIG} gaia
```
- The scripts set and initialize the chain
4. Check the balances
```
gaiad --node tcp://localhost:26657 query bank balances $(gaiad --home data/gaia keys --keyring-backend="test" show user -a)
```
- The chain should have `user` and `user2`
###### tags: `IBC`