- Introduction
- Installing the Relayer
- Relayer initialization
- Creating configuration files
- Light client initialization and working with channels
- Sending transactions
- Creating a service file for the Relayer
- Launching a Remote Relayer
- Remote Relayer transaction examples
Welcome to my guide 😃
I would like to tell you how to set up a relayer for cross-broadcasting for 2 networks that are built on Cosmos and use IBC.
Let's take KiChain and Umee as a basis.
Relayer can be located on the same server as the node, or also located on another server
In this example, I will be installing the relayer on the same server as the node
To check if your network supports IBC, you need to run the following command
kid q ibc-transfer params #
instead of kid, you can substitute the name of your network
If the answer looks like this
receive_enabled:
true send_enabled: true
So you have successfully taken the first step!
git clone https://github.com/cosmos/relayer.git
cd relayer
make install
cd
rly version
If you get a reply
version: 1.0.0-rc1–152-g112205b
This means the Relayer has been successfully installed.
rly config init
First, you must create a folder where the network configuration files will be located.
mkdir rly_config
cd rly_config
Let's create a file for Kichain
nano kichain-t-4.json
- CTRL + O - save file
- CTRL + X - close file
In the opened editor window, we must insert the following json
{ "chain-id": "kichain-t-4", "rpc-addr": "https://rpc-challenge.blockchain.ki:443", "account-prefix": "tki", "gas-adjustment": 1.5, "gas-prices": "0.025utki", "trusting-period": "48h" }
Now let's create a configuration file for Umee
nano umee-betanet-1.json
In the opened editor window, we must insert the following json
{ "chain-id": "umee-betanet-1", "rpc-addr": "http://localhost:26657", "account-prefix": "umee", "gas-adjustment": 1.5, "gas-prices": "0.025uumee", "trusting-period": "48h" }
Adding settings to the Relayer configuration
rly chains add -f umee-betanet-1.json
rly chains add -f kichain-t-4.json
cd
Create a new wallet
rly keys add umee-betanet-1 YOUR_WALLET_NAME
rly keys add kichain-t-4 YOUR_WALLET_NAME
Restore wallet
rly keys restore umee-betanet-1 YOUR_WALLET_NAME "MNEMONIC PHRASE"
rly keys restore kichain-t-4 YOUR_WALLET_NAME "MNEMONIC PHRASE"
Adding the generated keys to the Relayer configuration
rly chains edit umee-betanet-1 key YOUR_WALLET_NAME
rly chains edit kichain-t-4 key YOUR_WALLET_NAME
Change the wait timeout
nano ~/.relayer/config/config.yaml
Change the timeout to 10 seconds
timeout: 30s
->timeout: 10s
Both wallets must have coins, check it out
rly q balance umee-betanet-1
rly q balance kichain-t-4
If you have coins on your balance, then you can proceed to the next step.
Light client initialization
rly light init umee-betanet-1 -f
rly light init kichain-t-4 -f
Generating a channel between networks
rly paths generate umee-betanet-1 kichain-t-4 transfer --port=transfer
Opening a channel for relaying (debug)
rly tx link transfer --debug
If you see an error
You need to go to the config file
nano /root/.relayer/config/config.yaml
And remove the following lines:
- client-id
- connection-id
- channel-id
Light client reinitialization
rly light init umee-betanet-1 -f
rly light init kichain-t-4 -f
Opening the channel (debug)
rly tx link transfer --debug
We wait until the log appears
Checking
rly paths list -d
As a result, you should see the following text
Transaction template
rly transact transfer [source-chain] [destination-chain] [amount-token] [destination-wallet-address] [flags]
Example:
rly tx transfer umee-betanet-1 kichain-t-4 1000000uumee tki1v2eghxgmamlkwd4jtsxkev0csgzknhu7lcxwtl --path transfer
If the transaction was successful, you will see the following text:
The details of the transaction can be viewed in the explorer of your network.
sudo tee /etc/systemd/system/rlyd.service > /dev/null <<EOF
[Unit]
Description=relayer client
After=network-online.target,starsd.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
kid tx ibc-transfer transfer transfer channel-0 umee16vp4e0cft3052h59zlrfluvmjclaajxt9n4rsj 1000utki --from $kichain_wallet_name --fees=5000utki --gas=auto --chain-id kichain-t-4 --home $HOME/kichain/kid
- Find out the channel number
rly paths show transfer --yaml