Note: we assume that you've already initialized the test smart contract. You will need the contract address to put it in
config.toml
to make the relayer only work with packets coming from this contract.
This tutorial is for connecting with cosmoshub testnet network (theta-testnet-001). To connect hermes with juno, go through the same steps (from step 2) but change the user name and service name, and uncomment the chain config for juno in config.toml
. This tutorial installs hermes as a daemon.
curl -L "https://github.com/informalsystems/ibc-rs/releases/download/v1.0.0/hermes-v1.0.0-${PLATFORM}-unknown-linux-gnu.tar.gz" > hermes.tar.gz && \
tar -C ./ -vxzf hermes.tar.gz && \
rm -f hermes.tar.gz && \
sudo mv ./hermes /usr/local/bin/ && \
sudo chgrp root /usr/local/bin/hermes && \
sudo chown root /usr/local/bin/hermes
Check that it works and version is ok (Should be hermes 1.0.0+ed4dd8c
)
$ hermes --version
$ sudo useradd -m ibc-cosmoshub-rly
$ sudo su ibc-cosmoshub-rly
$ cd ~/
$ mkdir ~/.hermes
Create file /etc/systemd/system/neutron-ibc-cosmoshub-relayer.service
with content:
[Unit]
Description=Neutron IBC CosmosHub Relayer
After=network.target
[Service]
User=ibc-cosmoshub-rly
ExecStart=/usr/local/bin/hermes start
[Install]
WantedBy=multi-user.target
Copy the example config into ~/.hermes/config.toml
and fill the missing parameters.
Don't forget to fill in the missing parameters (marked by TODO comments).
NOTE: websocket_addr
must start with ws|wss protocol
Check that config is valid:
$ hermes health-check
Don't forget to generate your mnemonics for accounts and fill in in bash commands below:
$ sudo su ibc-cosmoshub-rly
$ export NEUTRON_MNEMONIC="TODO"
$ export TARGET_CHAIN_MNEMONIC="TODO"
$ export TARGET_CHAIN_ID="TODO" # e.g., "theta-testnet-001" for Cosmos Hub testnet or "uni-5" for Juno testnet
$ export TARGET_KEY_NAME="TODO" # e.g. "cosmoshub-ibc-relayer" or "juno-ibc-relayer" (matches key-name in config.toml)
$ hermes keys add --chain quark-1 --mnemonic-file <(echo "$NEUTRON_MNEMONIC") --key-name neutron-ibc-relayer
$ hermes keys add --chain $TARGET_CHAIN_ID --mnemonic-file <(echo "$TARGET_CHAIN_MNEMONIC") --key-name $TARGET_KEY_NAME
Make sure that the relayer keys provided on previous step have enough funds. You can find top up istructions here.
Start it:
$ sudo systemctl start neutron-ibc-cosmoshub-relayer.service
Make it run on each boot:
$ sudo systemctl enable neutron-ibc-cosmoshub-relayer.service
Service status:
$ sudo systemctl status neutron-ibc-cosmoshub-relayer.service
Logs:
$ journalctl --unit=neutron-ibc-cosmoshub-relayer
For Cosmos hub:
$ sudo su ibc-cosmoshub-rly
$ hermes create connection --a-chain quark-1 --b-chain theta-testnet-001
$ exit
For Juno:
$ sudo su ibc-juno-rly
$ hermes create connection --a-chain quark-1 --b-chain uni-5
$ exit
You will see a lot of text, but you are only interested in the connection_id
on Neutron at the end of the output:
SUCCESS Connection {
delay_period: 0ns,
a_side: ConnectionSide { <<< IMPORTANT: a_side
chain: BaseChainHandle {
chain_id: ChainId {
id: "neutron-devnet-1",
version: 1,
},
runtime_sender: Sender { .. },
},
client_id: ClientId(
"07-tendermint-7",
),
connection_id: Some(
ConnectionId(
"connection-7", <<< THIS CONNTECTION_ID
),
),
},