IBC Relaying with Go Relayer
Learn how to run the Go relayer to create a transfer channel between any Cosmos chain and Secret Network.
Overview
The Go relayer is a relayer implementation written in Golang. It can create clients, connections, and channels, as well as relay packets and update and upgrade clients.
In order to use Secret Network's IBC Developer Toolkit, you need an IBC transfer channel established between Secret Network and your Cosmos chain.
In this section, you will learn:
How to get started with the Go relayer.
Basic Go relayer commands.
How to create a transfer channel between Secret Network testnet and Neutron testnet.
Let's get started! π
Installing Go Relayer
Clone the Go relayer repository:
git clone https://github.com/cosmos/relayer.git
Install Go:
brew install go
Set Go path:
export GOPATH=$HOME/go
export PATH=$PATH:$GOPATH/bin
Build the Go relayer:
cd relayer
make install
export GOBIN=$HOME/go/bin
mkdir -p $GOBIN
go clean -cache
go build -ldflags "-X github.com/cosmos/relayer/v2/cmd.Version=$(git describe --tags | sed 's/^v//') \
-X github.com/cosmos/relayer/v2/cmd.Commit=$(git log -1 --format='%H') \
-X github.com/cosmos/relayer/v2/cmd.Dirty=$(git status --porcelain | wc -l | xargs)" \
-o $GOBIN/rly main.go
To check that the installation was successful, run:
rly version
Which returns:
version: 2.6.0-rc.1
commit: 3b9ec008999973469aeab4bbdbcb44ff4886b8b8
cosmos-sdk: v0.50.5
go: go1.23.4 darwin/arm64
Configuring Go Relayer
The configuration data is added to the config file, stored at $HOME/.relayer/config/config.yaml
by default.
If this is the first time you run the relayer, first initialize the config with the following command:
rly config init
And check the config with:
rly config show
Now you are all set to add the chains and paths you want to relay on, add your keys and start relaying. You will set up two testnet chains: Neutron's pion-1
and Secret Network's pulsar-3
.
Add chain configs
The rly chains add
command fetches chain metadata from the chain registry and adds it to your config file:
rly chains add testnets/secretnetworktestnet
rly chains add testnets/neutrontestnet
Create wallet keys
Create new keys for the relayer to use when signing and relaying transactions:
rly keys add secretnetworktestnet secret-test #this is the name of your key
rly keys add neutrontestnet neutron-test #this is the name of your key
Query your key balances:
rly query balance secretnetworktestnet secret-test
rly query balance neutrontestnet neutron-test
Then, edit the relayer's key
values in the config file to match the key-name
s chosen above.
The configuration data is added to the config file, stored at $HOME/.relayer/config/config.yaml:
chains:
neutrontestnet:
type: cosmos
value:
key-directory: /Users/yourname/.relayer/keys/pion-1
key: neutron-test
chain-id: pion-1
rpc-addr: https://rpc-lb-pion.ntrn.tech:443
secretnetworktestnet:
type: cosmos
value:
key-directory: /Users/yourname/.relayer/keys/pulsar-3
key: secret-test
chain-id: pulsar-3
rpc-addr: https://pulsar.rpc.secretnodes.com:443
Configure path metadata in the config file
You configured the chain metadata, now you need path metadata.
Update your config file like so to use a configuration path that has been tested in production:
global:
debug-listen-addr: 127.0.0.1:5183
metrics-listen-addr: 127.0.0.1:5184
timeout: 10s
memo: ""
light-cache-size: 20
log-level: info
ics20-memo-limit: 0
max-receiver-size: 150
chains:
neutrontestnet:
type: cosmos
value:
key-directory: /Users/<your-user-name>/.relayer/keys/pion-1
key: neutron-test
chain-id: pion-1
rpc-addr: https://rpc-lb-pion.ntrn.tech:443
backup-rpc-addrs: []
account-prefix: neutron
keyring-backend: test
dynamic-gas-price: true
gas-adjustment: 2
gas-prices: 0.043untrn
min-gas-amount: 400000
max-gas-amount: 500000
debug: false
timeout: 20s
block-timeout: ""
output-format: json
sign-mode: direct
extra-codecs: []
coin-type: 118
signing-algorithm: ""
broadcast-mode: batch
min-loop-duration: 0s
extension-options: []
feegrants: null
secretnetworktestnet:
type: cosmos
value:
key-directory: /Users/<your-user-name>/.relayer/keys/pulsar-3
key: secret-test
chain-id: pulsar-3
rpc-addr: https://pulsar.rpc.secretnodes.com:443
backup-rpc-addrs:
- https://pulsar.rpc.secretnodes.com:443
account-prefix: secret
keyring-backend: test
dynamic-gas-price: false
gas-adjustment: 1.2
gas-prices: 0.1uscrt
min-gas-amount: 400000
max-gas-amount: 500000
debug: false
timeout: 20s
block-timeout: ""
output-format: json
sign-mode: direct
extra-codecs: []
coin-type: 529
signing-algorithm: ""
broadcast-mode: batch
min-loop-duration: 0s
extension-options: []
feegrants: null
Create a relayer path:
rly paths new pulsar-3 pion-1 my-path #this is the name of your path
Check Configuration Status
Before starting to relay and after making some changes to the config, you can check the status of the chains in the config:
rly chains list
Which returns this output when healthy:
0: pulsar-3 -> type(cosmos) key(β) bal(β) path(β)
1: pion-1 -> type(cosmos) key(β) bal(β) path(β)
And you can check the status of the paths in the config:
rly paths list
0: secretnetworktestnet-nuetrontestnet -> chns(β) clnts(β) conn(β) (pulsar-3<>pion-1)
Starting the Relayer
Finally, start the relayer on the desired path. The relayer will periodically update the clients and listen for IBC messages to relay:
rly start my-path
2024-12-13T17:40:56.021378Z info Chain is in sync {"chain_name": "neutrontestnet", "chain_id": "pion-1"}
2024-12-13T17:41:01.999823Z info Client update threshold condition met {"path_name": "my_demo_path", "chain_id": "pion-1", "client_id": "07-tendermint-543", "trusting_period": 72000000, "time_since_client_update": 85721551, "client_threshold_time": 0}
Further reading:
Last updated
Was this helpful?