Here I will describe the process of creating a relayer between two cosmos networks Kichain and osmosis.
git clone https://github.com/osmosis-labs/osmosis
cd osmosis
git checkout v1.0.1
make install
cd ~
chain-maind keys add WALLET_NAME
chain-maind keys show WALLET_NAME -a
git clone https://github.com/cosmos/relayer.git
cd relayer
make install
cd
rly config init
mkdir rly_config
cd rly_config
nano kichain-t-4_config.json
{
"chain-id": "kichain-t-4",
"rpc-addr": "http://127.0.0.1:26657",
"account-prefix": "tki",
"gas-adjustment": 1.5,
"gas-prices": "0.025utki",
"trusting-period": "48h"
}
save ctrl+x yes enter
nano cygnusx-osmo-1_config.json
{
"chain-id": "cygnusx-osmo-1",
"rpc-addr": "http://54.166.148.90:26657",
"account-prefix": "osmo",
"gas-adjustment": 1.5,
"gas-prices": "0.025uosmox",
"trusting-period": "48h"
}
save ctrl+x yes enter
rly chains add -f kichain-t-4_config.json
rly chains add -f cygnusx-osmo-1_config.json
cd
6. We add wallets in both networks to the relayer (it is recommended to create separate wallets for this). Remember to save your seed phrases and addresses
rly keys add kichain-t-4 kidrly
rly keys add cygnusx-osmo-1 osmorly
rly chains edit kichain-t-4 key kidrly
rly chains edit cygnusx-osmo-1 key osmorly
8. Change the waiting timeout in the relayer settings so that it can accurately process transactions
nano ~/.relayer/config/config.yaml
Looking for a line
timeout: 10s
Replace with
timeout: 3m
kid tx bank send WALLET_NAME_KICHAIN_WALLET_ADDRESS 10000000utki --home PATH_TO_YOUR_NODE_DIRECTORY --chain-id kichain-t-4
osmosisd tx bank send WALLET_NAME_OSMO WALLET_ADDRESS_osmorly 10000000uosmox --node http://54.166.148.90:26657/ --chain-id cygnusx-osmo-1 --fees 5000uosmox
rly q balance kichain-t-4
rly q balance cygnusx-osmo-1
rly light init kichain-t-4 -f
rly light init cygnusx-osmo-1 -f
rly paths generate kichain-t-4 cygnusx-osmo-1 transfer --port=transfer
rly paths list -d
0: transfer -> chns(✔) clnts(✔) conn(✔) chan(✔)
(kichain-t-4:transfer<>cygnusx-osmo-1:transfer)
sudo tee /etc/systemd/system/rlyd.service > /dev/null <<EOF
[Unit]
Description=relayer client
After=network-online.target, kichaind.service
[Service]
User=$USER
ExecStart=$(which rly) start transfer
Restart=always
RestartSec=3
LimitNOFILE=65535
[Install]
WantedBy=multi-user.target
EOF
sudo systemctl daemon-reload
sudo systemctl enable rlyd
sudo systemctl start rlyd
journalctl -u rlyd -f
16. To carry out an ibc transaction, you can use both the subcommands of the relay and, accordingly, the wallets that are added to it, as well as the subcommands of the clients of the networks and the wallets added to them. Examples:
rly tx transfer kichain-t-4 cygnusx-osmo-1 1000000utki USER_ADDRESS_On_OSMO_NETWORK --path transfer
kid tx ibc-transfer transfer transfer CHANNEL_ID RECIPIENT_ADDRESS IN_OSMO_NET 1000000utki --from WALLET_NAME_KICHAIN --home PATH_TO_YOUR_NODE_DIRECTORY_chain-id kichain-t-4
rly paths show transfer --yaml
17. After the transaction, we check the balance of the recipient's wallet to make sure that the tokens have arrived
osmosisd q bank balances RECEIVER_ADDRESS_IN_OSMO_NETWORK --node http://54.166.148.90:26657/