Lava IBC Relayer Guide


0
  • 8-core (4 physical core), x86_64 architecture processor
  • 32 GB RAM
  • 1 TB+ nVME drives
  • Tested in Ubuntu Server 22.04 / Rocky Linux 8 x64

In this guide, we will create a channel between Lava and Cosmos with Hermes and prepare IBC relayer.

Firstly, we install the full node of both networks, Lava mainnet and Cosmos-hub4, on our server and match the network.

Lava Daemon Settings

First, set grpc server on port 9090 in the app.toml file from the $HOME/.lava/config/app.toml directory:

nano $HOME/.lava/config/app.toml
[grpc]

# Enable defines if the gRPC server should be enabled.
enable = true

# Address defines the gRPC server address to bind to.
address = "0.0.0.0:9090"

Then, set the pprof_laddr to port 6060, rpc laddr to port 26657, and prp laddr to 26656 in the config.toml file from the $HOME/.lava/config directory:

nano $HOME/.lava/config/config.toml
# pprof listen address (https://golang.org/pkg/net/http/pprof)
pprof_laddr = "localhost:6060"
[rpc]

# TCP or UNIX socket address for the RPC server to listen on
laddr = "tcp://127.0.0.1:26657"
[p2p]

# Address to listen for incoming connections
laddr = "tcp://0.0.0.0:26656"

Cosmos Daemon Settings

First, set grpc server to port 9092 in the app.toml file from the $HOME/.gaia/config directory:

nano $HOME/.gaia/config/app.toml
[grpc]

# Enable defines if the gRPC server should be enabled.
enable = true

# Address defines the gRPC server address to bind to.
address = "0.0.0.0:9092"

Then, set the pprof_laddr to port 6062, rpc laddr to port 36757, and prp laddr to 36756 in the config.toml file from the $HOME/.gaia/config directory:

nano $HOME/.gaia/config/config.toml
# pprof listen address (https://golang.org/pkg/net/http/pprof)
pprof_laddr = "localhost:6062"
[rpc]

# TCP or UNIX socket address for the RPC server to listen on
laddr = "tcp://127.0.0.1:36757"
[p2p]

# Address to listen for incoming connections
laddr = "tcp://0.0.0.0:36756"

Make the updates and install the necessary packages.

sudo apt update && sudo apt upgrade

Install Rust Dependencies

curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh

source $HOME/.cargo/env

sudo apt-get install pkg-config libssl-dev

sudo apt install librust-openssl-dev build-essential git

Install Hermes via Cargo

cargo install ibc-relayer-cli --bin hermes --locked

export PATH="$HOME/.cargo/bin:$PATH"

#Check hermes version
hermes version

Make the hermes directory and keysand create config.toml and save this config

mkdir -p $HOME/.hermes
mkdir -p $HOME/.hermes/keys
cd .hermes
nano config.toml
[global]
log_level = "debug"

[mode.clients]
enabled = true
refresh = true
misbehaviour = true

[mode.connections]
enabled = true

[mode.channels]
enabled = true

[mode.packets]
enabled = true
clear_interval = 100
clear_on_start = true
tx_confirmation = false
auto_register_counterparty_payee = false

[rest]
enabled = false
host = "127.0.0.1"
port = 3000

[telemetry]
enabled = false
host = "127.0.0.1"
port = 3001

[telemetry.buckets]
latency_submitted = { start = 500, end = 20000, buckets = 10 }
latency_confirmed = { start = 1000, end = 30000, buckets = 10 }

[tracing_server]
enabled = false
port = 5555

[[chains]]
id = "lava-mainnet-1"
type = "CosmosSdk"
rpc_addr = "http://127.0.0.1:26657"
grpc_addr = "http://127.0.0.1:9090"
event_source = { mode = "push", url = "ws://127.0.0.1:26657/websocket", batch_delay = "500ms" }
rpc_timeout = "10s"
trusted_node = false
account_prefix = "lava"
key_name = "lava"
store_prefix = "ibc"
default_gas = 100000
max_gas = 4000000
gas_price = { price = 0.000000001, denom = "ulava" }
gas_multiplier = 1.1
max_msg_num = 30
max_tx_size = 1707152
clock_drift = "5s"
max_block_time = "60s"
trusting_period = "14days"
trust_threshold = { numerator = "1", denominator = "3" }
address_type = { derivation = "cosmos" }
memo_prefix = "Relayed by CoinHunters"


[[chains]]
id = "cosmoshub-4"
type = "CosmosSdk"
rpc_addr = "http://127.0.0.1:36457"
grpc_addr = "http://127.0.0.1:9092"
event_source = { mode = "push", url = "ws://127.0.0.1:36457/websocket", batch_delay = "500ms" }
rpc_timeout = "10s"
trusted_node = false
account_prefix = "cosmos"
key_name = "cosmos"
store_prefix = "ibc"
default_gas = 100000
max_gas = 4000000
gas_price = { price = 0.005, denom = "uatom" }
gas_multiplier = 1.1
max_msg_num = 30
max_tx_size = 1707152
clock_drift = "5s"
max_block_time = "60s"
trusting_period = "14days"
trust_threshold = { numerator = "1", denominator = "3" }
address_type = { derivation = "cosmos" }
memo_prefix = "Relayed by CoinHunters"

After editing the config file, we exit with CTRL X Y enter.

Now, let’s import our wallets for both lava and cosmos. To run IBC relayer, our wallets must have coins from both networks.

# Create mnemonic file for MNEMONIC_A and CHAIN_ID_A
MNEMONIC_A=‘private keys’
CHAIN_ID_A=‘lava-mainnet-1’
sudo tee $HOME/.hermes/${CHAIN_ID_A}.mnemonic > /dev/null <<EOF
${{MNEMONIC_A}
EOF
# Create mnemonic file for MNEMONIC_B and CHAIN_ID_B
MNEMONIC_B=‘private keys’
CHAIN_ID_B=‘cosmoshub-4’
sudo tee $HOME/.hermes/${CHAIN_ID_B}.mnemonic > /dev/null <<EOF
${{MNEMONIC_B}
EOF
# Add keys to Hermes using mnemonic files
hermes keys add --chain ${CHAIN_ID_A} --mnemonic-file $HOME/.hermes/${CHAIN_ID_A}.mnemonic
hermes keys add --chain ${CHAIN_ID_B} --mnemonic-file $HOME/.hermes/${CHAIN_ID_B}.mnemonic

Opening IBC channel

hermes create channel \
  --a-chain lava-mainnet-1 \
  --b-chain cosmoshub-4 \
  --a-port transfer \
  --b-port transfer \
  --order unordered \
  --chan-version ics20-1 \
  --new-client-connection

After running this command, wait for a while and you will get an output similar to the following.

SUCCESS Channel {
    ordering: Unordered,
    a_side: ChannelSide {
        chain: BaseChainHandle {
            chain_id: ChainId {
                id: "lava-mainnet-1",
                version: 1,
            },
            runtime_sender: Sender { .. },
        },
        client_id: ClientId(
            "07-tendermint-49",
        ),
        connection_id: ConnectionId(
            "connection-35",
        ),
        port_id: PortId(
            "transfer",
        ),
        channel_id: Some(
            ChannelId(
                "channel-50",
            ),
        ),
        version: Some(
            Version(
                "ics20-1",
            ),
        ),
    },
    b_side: ChannelSide {
        chain: BaseChainHandle {
            chain_id: ChainId {
                id: "cosmoshub-4",
                version: 4,
            },
            runtime_sender: Sender { .. },
        },
        client_id: ClientId(
            "07-tendermint-1308",
        ),
        connection_id: ConnectionId(
            "connection-1042",
        ),
        port_id: PortId(
            "transfer",
        ),
        channel_id: Some(
            ChannelId(
                "channel-881",
            ),
        ),
        version: Some(
            Version(
                "ics20-1",
            ),
        ),
    },
    connection_delay: 0ns,
}

The channel information you see in this command is an example.

Now, to add this channel information to our hermes config file, let’s edit the following commands. and add it to our config file.

cd .hermes
nano config.toml
[global]
log_level = "debug"

[mode.clients]
enabled = true
refresh = true
misbehaviour = true

[mode.connections]
enabled = true

[mode.channels]
enabled = true

[mode.packets]
enabled = true
clear_interval = 100
clear_on_start = true
tx_confirmation = false
auto_register_counterparty_payee = false

[rest]
enabled = false
host = "127.0.0.1"
port = 3000

[telemetry]
enabled = false
host = "127.0.0.1"
port = 3001

[telemetry.buckets]
latency_submitted = { start = 500, end = 20000, buckets = 10 }
latency_confirmed = { start = 1000, end = 30000, buckets = 10 }

[tracing_server]
enabled = false
port = 5555

[[chains]]
id = "lava-mainnet-1"
type = "CosmosSdk"
rpc_addr = "http://127.0.0.1:26657"
grpc_addr = "http://127.0.0.1:9090"
event_source = { mode = "push", url = "ws://127.0.0.1:26657/websocket", batch_delay = "500ms" }
rpc_timeout = "10s"
trusted_node = false
account_prefix = "lava"
key_name = "lava"
store_prefix = "ibc"
default_gas = 100000
max_gas = 4000000
gas_price = { price = 0.000000001, denom = "ulava" }
gas_multiplier = 1.1
max_msg_num = 30
max_tx_size = 1707152
clock_drift = "5s"
max_block_time = "60s"
trusting_period = "14days"
trust_threshold = { numerator = "1", denominator = "3" }
address_type = { derivation = "cosmos" }
memo_prefix = "Relayed by CoinHunters"

[chains.packet_filter]
policy = "allow"
list = [
 ["transfer", "channel-881"], # cosmos
]


[[chains]]
id = "cosmoshub-4"
type = "CosmosSdk"
rpc_addr = "http://127.0.0.1:13457"
grpc_addr = "http://127.0.0.1:9092"
event_source = { mode = "push", url = "ws://127.0.0.1:13457/websocket", batch_delay = "500ms" }
rpc_timeout = "10s"
trusted_node = false
account_prefix = "cosmos"
key_name = "cosmos"
store_prefix = "ibc"
default_gas = 100000
max_gas = 4000000
gas_price = { price = 0.005, denom = "uatom" }
gas_multiplier = 1.1
max_msg_num = 30
max_tx_size = 1707152
clock_drift = "5s"
max_block_time = "60s"
trusting_period = "14days"
trust_threshold = { numerator = "1", denominator = "3" }
address_type = { derivation = "ethermint" }
memo_prefix = "Relayed by CoinHunters"

[chains.packet_filter]
policy = "allow"
list = [
 ["transfer", "channel-50"], # lava
]

After editing, save with CTRL X Y enter.

hermes config validate

Now let’s check if Hermes is working correctly. If you get an output like below. The process is complete.

INFO ThreadId(01) using default configuration from '/root/.hermes/config.toml'
INFO ThreadId(01) running Hermes v1.7.4
SUCCESS "configuration is valid"

Let’s open the screen to start Hermes.

screen -S hermes
hermes start

Let’s exit the screen we opened with CTRL A + D and perform the first transfer operation.

hermes tx raw ft-transfer \
  --dst-chain cosmoshub-4 \
  --src-chain lava-mainnet-1 \
  --src-port transfer \
  --src-channel channel-50 \
  --amount 100000000 \
  --denom ulava \
  --receiver <cosmoshub_address> \
  --timeout-height-offset 1000

You successfully received the Txhash. It means that you have successfully completed all steps.

Bu Yazıya Tepkiniz Ne Oldu?
  • 0
    alk_l_yorum
    Alkışlıyorum
  • 0
    be_endim
    Beğendim
  • 0
    d_nceliyim
    Düşünceliyim
  • 0
    be_enmedim
    Beğenmedim

E-posta adresiniz yayınlanmayacak. Gerekli alanlar * ile işaretlenmişlerdir

Bültenimize Katılın

Hemen ücretsiz üye olun ve yeni güncellemelerden haberdar olan ilk kişi olun.