Relayer

Relayers are in charge of delivering and tracking IBC packets.

Hermes

Prerequisites

  • Rust 1.72 +

Clone Repository

Open a terminal and clone Hermes repository.

git clone https://github.com/informalsystems/hermes.git

Change to the repository directory.

cd hermes

Install and Setup Hermes

cargo install --path ./crates/ibc-relayer-cli

# check installed herems
hermes --version

# create working directory for herems
mkdir ~/.hermes

# copy default config.toml to working directory
cp ./config.toml ~/.hermes/config.toml

Update Chain Configs

Append following chain configs to ~/.hermes/config.toml and remove pre-existing ibc-0 & ibc-1 chain configs. You need to replace all config sections with <> to real values.

You are highly recommended to use your own RPC endpoints for both l1 and l2.

...

[[chains]]
id = '<l1-chain-id>' # mahalo-1
type = "CosmosSdk"
rpc_addr = '<l1-rpc-endpoint>' # https://rpc.mahalo-1.initia.xyz (mahalo-1)
grpc_addr = '<l1-grpc-endpoint>' # http://34.143.171.2:9090 (mahalo-1)
event_source = { mode = 'push', url = '<l1-websocket-endpoint>', batch_delay = '500ms' } # wss://rpc.mahalo-1.initia.xyz/websocket (mahalo-1)
rpc_timeout = '10s'
trusted_node = false
account_prefix = 'init'
key_name = 'relayer'
store_prefix = 'ibc'
default_gas = 100000
max_gas = 3000000
gas_price = { price = 0.15, denom = 'uinit' }
gas_multiplier = 1.5
max_msg_num = 30
max_tx_size = 2097152
clock_drift = '5s'
max_block_time = '10s'
address_type = { derivation = 'cosmos' }

[[chains]]
id = '<l2-chain-id>' # $L2_CHAIN_ID
type = "CosmosSdk"
rpc_addr = '<l2-rpc-endpoint>' # http://127.0.0.1:26657
grpc_addr = '<l2-grpc-endpoint>' # http://127.0.0.1:9090
event_source = { mode = 'push', url = '<l2-websocket-endpoint>', batch_delay = '500ms' } # ws://127.0.0.1:26657/websocket
rpc_timeout = '10s'
trusted_node = false
account_prefix = 'init'
key_name = 'relayer'
store_prefix = 'ibc'
default_gas = 100000
max_gas = 3000000
gas_price = { price = 0.15, denom = '<denom>' } # $DENOM
gas_multiplier = 1.5
max_msg_num = 30
max_tx_size = 2097152
clock_drift = '5s'
# this should be configured as `2 * create_empty_blocks_interval`
# in your ~/.minitia/config/config.toml
max_block_time = '2m0s' 
address_type = { derivation = 'cosmos' }

Create Relayer Key

You need to fund the relayer account before setting the keys on both L1 and L2.

# create temporal keyfile for herems
echo "relayer mnemonic" > mnemonic.key

# add relayer key for the chains
hermes keys add --key-name relayer --chain $L1_CHAIN_ID --mnemonic-file ./mnemonic.key
hermes keys add --key-name relayer --chain $L2_CHAIN_ID --mnemonic-file ./mnemonic.key

rm ./mnemonic.key

Channel transfer channel

# create channel with clients and connections
# tooks 5 minutes (send any tx to boost)
hermes create channel \
  --a-chain $L1_CHAIN_ID \
  --b-chain $L2_CHAIN_ID \
  --a-port transfer \
  --b-port transfer \
  --new-client-connection 

SUCCESS Channel {
    ...
}

Start Hermes

hermes start

Last updated