Skip to main content

Station Relayer Guide

What is a Station Relayer?

Guru station relies on the IBC Relayers for the smooth operation. Before executing the station-related transactions, the whole infrastructure including the IBC Relayers must be setup and tested for the seamless communications between both Guru and GuruX chains.

To minimize the number of setups, the station requires only one IBC Relayer for one GuruX chain. Meaning, each relayer connects two chains: Guru <=> GuruX.

Pre-requisities

  • Correctly installed Hermes relayer
  • All the requirements and setup guidelines mentioned in the previous section (Run an IBC Relayer) applies to station relayer as well.

Setup

Note. As Hermes is one of the most reliable IBC Relayers on this date with features, such as multi-chain support and easy configuration, it was selected as the main IBC relayer for the Guru Station by our core team. This guide will give the example of Hermes, but the same theory can be applied to any other IBC Relayer which is compatible with cosmos-sdk based chains.

This setup guide uses the exmaple of setting up a relayer between Guru and USGX chains.

Example config file

// global config
...

// chain config
[[chains]]
id = 'guru_631-1'
rpc_addr = 'HOST_URL:26657'
grpc_addr = 'HOST_URL:9090'
event_source = { mode = 'push', url = 'ws:/HOST_URL:26657/websocket', batch_delay = '500ms' }
rpc_timeout = '10s'
trusted_node = false
account_prefix = 'guru'
key_name = 'guru-hermes-key'
store_prefix = 'ibc'
default_gas = 30000
max_gas = 200000
gas_price = { price = 630000000000, denom = 'agxn' }
gas_multiplier = 1.1
max_msg_num = 30
max_tx_size = 2097152
clock_drift = '5s'
max_block_time = '30s'
trusting_period = '14days'
trust_threshold = '2/3'
address_type = { derivation = 'ethermint', proto_type = { pk_type = '/ethermint.crypto.v1.ethsecp256k1.PubKey' } }


[[chains]]
id = 'usgx_testnet'
rpc_addr = 'HOST_URL:46657'
grpc_addr = 'HOST_URL:49090'
event_source = { mode = 'push', url = 'ws://HOST_URL:46657/websocket', batch_delay = '500ms' }
rpc_timeout = '10s'
trusted_node = false
account_prefix = 'usgx'
key_name = 'usgx-station-key'
store_prefix = 'ibc'
default_gas = 30000
max_gas = 200000
gas_price = { price = 630000000000, denom = 'ausgx' }
gas_multiplier = 1.1
max_msg_num = 30
max_tx_size = 2097152
clock_drift = '5s'
max_block_time = '30s'
trusting_period = '14days'
trust_threshold = '2/3'
address_type = { derivation = 'ethermint', proto_type = { pk_type = '/ethermint.crypto.v1.ethsecp256k1.PubKey' } }


// Other chains
...

Commands

Add keys

hermes keys add --chain guru_631-1 --mnemonic-file ~/.hermes/mnic_guru.txt --hd-path "m/44'/60'/0'/0/0"

// other keys
...

Create a connection: Guru => USGX

hermes create connection --a-chain guru_631-1 --b-chain usgx_testnet

// expected output
...
a_side: ConnectionSide {
chain: BaseChainHandle {
chain_id: ChainId {
id: "guru_631-1",
version: 1,
},
runtime_sender: Sender { .. },
},
client_id: ClientId(
"07-tendermint-0",
),
connection_id: Some(
ConnectionId(
"connection-0",
),
),
},
...

Create a channel: Guru => USGX

  • connection: comes from the previous command result
  • a-port: transwap (fixed port on Guru chain for station transactions)
  • b-port: xswap (fixed port of GuruX chains for station transactions)
hermes create channel --a-chain guru_631-1 --a-connection connection-0 --a-port transwap --b-port xswap

// expected output
...
a_side: ChannelSide {
chain: BaseChainHandle {
chain_id: ChainId {
id: "guru_631-1",
version: 1,
},
runtime_sender: Sender { .. },
},
client_id: ClientId(
"07-tendermint-0",
),
connection_id: ConnectionId(
"connection-0",
),
port_id: PortId(
"transwap",
),
channel_id: Some(
ChannelId(
"channel-0",
),
),
version: None,
},
...

Create a connection: USGX => Guru

hermes create connection --a-chain usgx_testnet --b-chain guru_631-1

// expected output
...
a_side: ConnectionSide {
chain: BaseChainHandle {
chain_id: ChainId {
id: "usgx_testnet",
version: 1,
},
runtime_sender: Sender { .. },
},
client_id: ClientId(
"07-tendermint-0",
),
connection_id: Some(
ConnectionId(
"connection-0",
),
),
},
...

Create a channel: USGX => Guru

  • connection: comes from the previous command result
  • a-port: xswap (fixed port of GuruX chains for station transactions)
  • b-port: transwap (fixed port on Guru chain for station transactions)
hermes create channel --a-chain usgx_testnet --a-connection connection-0 --a-port xswap --b-port transwap

// expected output
...
a_side: ChannelSide {
chain: BaseChainHandle {
chain_id: ChainId {
id: "usgx_testnet",
version: 1,
},
runtime_sender: Sender { .. },
},
client_id: ClientId(
"07-tendermint-0",
),
connection_id: ConnectionId(
"connection-0",
),
port_id: PortId(
"xswap",
),
channel_id: Some(
ChannelId(
"channel-0",
),
),
version: None,
},
...

Run the relayer

hermes start

Adding more chains

To add mroe chains to Guru station, the same steps needs to be repeated with new chain config.

Only one instance of Hermes relayer can be used for multiple chains.