Gaia to Gaia Interblockchain Tx using two different coins === ### Install GoLang ```wget -c https://dl.google.com/go/go1.14.2.linux-amd64.tar.gz -O - | sudo tar -xz -C /usr/local``` Add `export PATH=$PATH:/usr/local/go/bin` to `~/.profile` (You can access it by typing in `gedit ~/.profile`). Run `source ~/,profile`. You should have GoLang by now. ### Install GoLang ``` git clone https://github.com/cosmos/gaia && cd gaia && make install ``` You now should have `gaiad` available on your command line. (NOTE: `gaiacli` is a deprecated command, use `gaiad` for all purposes). ### Set up relayer ``` git clone https://github.com/cosmos/relayer make install ``` ### Set up a local, one node testnet ``` sudo rm -rf ~/.gaia gaiad init main --chain-id ibc-1 gaiad keys add acc_1 --recover ``` Use this key: `fluid cereal trash miracle casino menu true method exhaust pen fiber rural grape purchase rather table omit youth gain cage erase puppy sibling expand` ``` gaiad add-genesis-account acc_1 10000000000000000000stake gaiad gentx acc_1 100000000stake --chain-id ibc-1 ``` ``` gaiad collect-gentxs ``` We are going to run relayer on this chain. ### Use a custom denom `xyz` ``` cd $HOME/.gaia/config ``` Now open `genesis.json` and replace all of `stake` with `xyz`. I use VS Code for this. ``` code genesis.json ``` Once done, just run the chain once. ``` gaiad start ``` > If required, reset the chain using `gaiad unsafe-reset-all` ### Set up the second chain On another node on the network (or a virtual machine), set up another network. ``` sudo rm -rf ~/.gaia gaiad init main --chain-id ibc-0 gaiad keys add acc_0 --recover ``` phrase: ```wage thunder live sense resemble foil apple course spin horse glass mansion midnight laundry acoustic rhythm loan scale talent push green direct brick please``` ``` gaiad add-genesis-account acc_0 10000000000000000000stake gaiad gentx acc_0 100000000stake --chain-id ibc-0 gaiad collect-gentxs gaiad start ``` You can use other denoms apart from `stake`. I personally use `xyz` on `ibc-1` chain. ### Set up relayer on `ibc-1` Make a folder and inside of it, create two more folders, `path` and `relayerChains`. For each chain, create a JSON file inside relayerChains such as this. #### relayerhains/ibc-0.json ```json { "key":"acc_0", "chain-id":"ibc-0", "rpc-addr":"http://localhost:26657", "account-prefix":"cosmos", "gas-adjustment":1.5, "gas-prices":"0.025stake", "trusting-period":"336h" } ``` #### relayerChains/ibc-1.json ```json { "key":"acc_1", "chain-id":"ibc-1", "rpc-addr":"http://[IP ADDRESS OF OTHER NETWORK]:26657", "account-prefix":"cosmos", "gas-adjustment":1.5, "gas-prices":"0.025xyz", "trusting-period":"336h" } ``` Now in `path` folder, create a `path.json` file. #### path/path.json ```json { "src":{ "chain-id":"ibc-0", "client-id":"", "connection-id":"", "channel-id":"", "port-id":"transfer", "order":"unordered", "version":"ics20-1" }, "dst":{ "chain-id":"ibc-1", "client-id":"", "connection-id":"", "channel-id":"", "port-id":"transfer", "order":"unordered", "version":"ics20-1" }, "strategy":{ "type":"naive" } } ``` Now let's configure `relayer`. 1. `rly config init` (If a config file already exists, delete the .relayer file in $HOME) 2. `rly config add-chains path_to_folder/relayerChains ` 3. `rly keys restore ibc-0 acc_0 "wage thunder live sense resemble foil apple course spin horse glass mansion midnight laundry acoustic rhythm loan scale talent push green direct brick please`" --coin-type 118 4. `rly keys restore ibc-1 acc_1 "fluid cereal trash miracle casino menu true method exhaust pen fiber rural grape purchase rather table omit youth gain cage erase puppy sibling expand" --coin-type 118 5. `rly config add-paths path_to_folder/path` > TIP: You can use `pwd` to find the path of the current folder. 6. `rly light init ibc-0 -f` 7. `rly light init ibc-1 -f` 8. See if the chains are ready to relay over: `rly chains list` 9. See the current status of the path you will relay over: `rly paths list` 10. Connect the two chains: `rly tx link path -d -o 3s` 11. Check balances on two chains:` rly q bal ibc-0` and `rly q bal ibc-1` 12. `rly tx transfer ibc-0 ibc-1 1000000xyz $(rly chains address ibc-1)` > In the screenshot below, `pCrust-1` is equivalent to `ibc-0`. ![](https://i.imgur.com/q72ZNKx.png)