---
# System prepended metadata

title: Gaia ⇔ Starport IBC

---

Gaia ⇔ Starport IBC
===

*    Start 2 chains with different chains with gaia v4.0.2 - 
    first chain id: `ibc-0`
    second chain id: `ibc-1`
    
*    Create an account on each chain and put some tokens in it. These two accounts will be used to create client, connection, channel, etc on the chains. Create keys of both the accounts where `relayer` will be running.
    account on `ibc-0`: `acc_0`
    account on `ibc-1`: `acc_1`

    
*    Install relayer from https://github.com/cosmos/relayer

> Make sure relayer versions are same on both the systems. Use `rly version` to check the relayer version. If different, you can install desired version using `git checkout v<VERSION>`.

*    Create two json files for each chain with file names same as chain id `ibc-0.json` and `ibc-1.json` (Put both the files in a folder say `relayerChains`) with following content:

            {"key":"acc_0","chain-id":"ibc-0","rpc-addr":"http://localhost:26657","account-prefix":"cosmos","gas-adjustment":1.5,"gas-prices":"0.025denom_0","trusting-period":"336h"}
    
*    Change `rpc-address`, `chain-id`, `account-prefix`, `key`, `denom_0` (denom on `ibc-0`) and rest of the varaibles accordingly. 

* Create another folder with name say `linkChains` and craete a file `path.json` with content (change parameters accordingly):

        {"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"}}
    
*    `rly config init`
*    `rly config add-chains path_to_folder/relayerChains`
*    `rly keys restore ibc-0 acc_0 "[mnemonic_of_acc_0]" --coin-type 118`
*    `rly keys restore ibc-1 acc_1 "[mnemonic_of_acc_1]" --coin-type 750` (default value of coin-type is 118 - atom coin type)
*    `rly config add-paths path_to_folder/linkChains`
*    `rly light init ibc-0 -f`
*    `rly light init ibc-1 -f`
*    See if the chains are ready to relay over: `rly chains list`
*    See the current status of the path you will relay over: `rly paths list`
*    Connect the two chains: `rly tx link linkChains -d -o 3s`
*    Check balances on two chains: `rly q bal ibc-0` and `rly q bal ibc-1`
*    Send tokens from chain: 
    
    rly tx transfer [SRC-CHAIN-ID] [DST-CHAIN-ID] [AMOUNT] $(rly chains address [DST-CHAIN-ID])
    
Example: 
    `rly tx transfer ibc-0 ibc-1 1000000denom_0 $(rly chains address ibc-1)`
    
This will deduct balance from `acc_0` on `ibc-0` but it won't show on `ibc-1` until it is relayed.
*    Relay the tx: `rly tx rly linkChains -d` New tokens should come to `acc_1` on `ibc-1`
*    Coins can be transfered from main app on chain also with `portID` and `channelID` can be find by `gaiad q ibc channel channels`:

    gaiad tx ibc-transfer transfer [PORT_ID] [CHANNEL_ID] [TO-ADDRESS-ON-DST-CHAIN] [amount] --from acc_X --chain-id [SRC-CHAIN-ID]

Example:
    `gaiad tx ibc-transfer transfer [PORT_ID] [CHANNEL_ID] xprt1a7x2ls6c27klymwmwa257lrcpgn0gfm8mmuthj 9999denom0 --from acc_X --chain-id ibc-0`
    
*    Relay the tx using: `rly tx rly linkChains -d`
    
