• Stars
    star
    389
  • Rank 110,443 (Top 3 %)
  • Language
    Go
  • License
    Apache License 2.0
  • Created over 4 years ago
  • Updated 15 days ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

An IBC relayer for ibc-go

Relayer

banner

Project Status: Initial Release GitHub Workflow Status GoDoc Go Report Card License: Apache-2.0 Lines Of Code Version

In IBC, blockchains do not directly pass messages to each other over the network. This is where relayer comes in. A relayer process monitors for updates on opens paths between sets of IBC enabled chains. The relayer submits these updates in the form of specific message types to the counterparty chain. Clients are then used to track and verify the consensus state.

In addition to relaying packets, this relayer can open paths across chains, thus creating clients, connections and channels.

Additional information on how IBC works can be found here.


Table Of Contents


Basic Usage - Relaying Packets Across Chains

The -h (help) flag tailing any rly command will be your best friend. USE THIS IN YOUR RELAYING JOURNEY.


  1. Clone, checkout and install the latest release (releases page).

    Go needs to be installed and a proper Go environment needs to be configured

    $ git clone https://github.com/cosmos/relayer.git
    $ cd relayer && git checkout v2.3.0
    $ make install
  2. Initialize the relayer's configuration directory/file.

    $ rly config init

    Default config file location: ~/.relayer/config/config.yaml

    By default, transactions will be relayed with a memo of rly(VERSION) e.g. rly(v2.3.0).

    To customize the memo for all relaying, use the --memo flag when initializing the configuration.

    $ rly config init --memo "My custom memo"

    Custom memos will have rly(VERSION) appended. For example, a memo of My custom memo running on relayer version v2.3.0 would result in a transaction memo of My custom memo | rly(v2.3.0).

    The --memo flag is also available for other rly commands also that involve sending transactions such as rly tx link and rly start. It can be passed there to override the config.yaml value if desired.

    To omit the memo entirely, including the default value of rly(VERSION), use - for the memo.

  3. Configure the chains you want to relay between.

    In our example, we will configure the relayer to operate on the canonical path between the Cosmos Hub and Osmosis.

    The rly chains add command fetches chain meta-data from the chain-registry and adds it to your config file.

    $ rly chains add cosmoshub osmosis

    Adding chains from the chain-registry randomly selects an RPC address from the registry entry.
    If you are running your own node, manually go into the config and adjust the rpc-addr setting.

    NOTE: rly chains add will check the liveliness of the available RPC endpoints for that chain in the chain-registry.
    It is possible that the command will fail if none of these RPC endpoints are available. In this case, you will want to manually add the chain config.

    To add the chain config files manually, example config files have been included here

    $ rly chains add --url https://raw.githubusercontent.com/cosmos/relayer/main/docs/example-configs/cosmoshub-4.json cosmoshub
    $ rly chains add --url https://raw.githubusercontent.com/cosmos/relayer/main/docs/example-configs/osmosis-1.json osmosis
  4. Import OR create new keys for the relayer to use when signing and relaying transactions.

    key-name is an identifier of your choosing.

    If you need to generate a new private key you can use the add subcommand.

    $ rly keys add cosmoshub [key-name]  
    $ rly keys add osmosis [key-name]  

    If you already have a private key and want to restore it from your mnemonic you can use the restore subcommand.

    $ rly keys restore cosmoshub [key-name] "mnemonic words here"
    $ rly keys restore osmosis [key-name] "mnemonic words here"
  5. Edit the relayer's key values in the config file to match the key-name's chosen above.

    This step is necessary if you chose a key-name other than "default"

    Example:

    - type: cosmos
       value:
       key: YOUR-KEY-NAME-HERE
       chain-id: cosmoshub-4
       rpc-addr: http://localhost:26657
  6. Ensure the keys associated with the configured chains are funded.

    Your configured addresses will need to contain some of the respective native tokens for paying relayer fees.


    You can query the balance of each configured key by running:
    $ rly q balance cosmoshub
    $ rly q balance osmosis
  7. Configure path meta-data in config file.
    We have the chain meta-data configured, now we need path meta-data. For more info on path terminology visit here.

    NOTE: Thinking of chains in the config as "source" and "destination" can be confusing. Be aware that most path are bi-directional.


    rly paths fetch will check for IBC path meta data from the chain-registry and add these paths to your config file.

    $ rly paths fetch

    NOTE: Don't see the path metadata for paths you want to relay on?
    Please open a PR to add this metadata to the GitHub repo!

  8. Configure the channel filter.

    By default, the relayer will relay packets over all channels on a given connection.

    Each path has a src-channel-filter which you can utilize to specify which channels you would like to relay on.

    The rule can be one of three values:

    • allowlist which tells the relayer to relay on ONLY the channels in channel-list
    • denylist which tells the relayer to relay on all channels BESIDES the channels in channel-list
    • empty value, which is the default setting, and tells the relayer to relay on all channels

    Since we are only worried about the canonical channel between the Cosmos Hub and Osmosis our filter settings would look like the following.

    Example:

    hubosmo:
       src:
           chain-id: cosmoshub-4
           client-id: 07-tendermint-259
           connection-id: connection-257
       dst:
           chain-id: osmosis-1
           client-id: 07-tendermint-1
           connection-id: connection-1
       src-channel-filter:
               rule: allowlist
               channel-list: [channel-141]  

    Because two channels between chains are tightly coupled, there is no need to specify the dst channels. If you only know the "dst" channel-ID you can query the "src" channel-ID by running: rly q channel <dst_chain_name> <dst_channel_id> <port> | jq '.channel.counterparty.channel_id'

  9. Finally, we start the relayer on the desired path.

    The relayer will periodically update the clients and listen for IBC messages to relay.

    $ rly paths list
    $ rly start [path]
    # Optionally you can omit the `path` argument to start all configured paths
    $ rly start 

    When running multiple instances of rly start, you will need to use the --debug-addr flag and provide an address:port. You can also pass an empty string '' to turn off this feature or pass localhost:0 to randomly select a port.


    [TROUBLESHOOTING]


Security Notice

If you would like to report a security critical bug related to the relayer repo, please reach out @jackzampolin or @Ethereal0ne on telegram.

Code of Conduct

The Cosmos community is dedicated to providing an inclusive and harassment free experience for contributors. Please visit Code of Conduct for more information.


Create Path Across Chains -->

More Repositories

1

cosmos-sdk

⛓️ A Framework for Building High Value Public Blockchains ✨
Go
6,216
star
2

cosmos

Internet of Blockchains ⚛
TeX
1,266
star
3

ibc

Interchain Standards (ICS) for the Cosmos network & interchain ecosystem.
TeX
914
star
4

ethermint-archive

Ethereum on Tendermint using Cosmos-SDK!
Go
662
star
5

cosmjs

The Swiss Army knife to power JavaScript based client solutions ranging from Web apps/explorers over browser extensions to server-side clients like faucets/scrapers.
TypeScript
641
star
6

ibc-go

Inter-Blockchain Communication Protocol (IBC) implementation in Golang.
Go
541
star
7

awesome-cosmos

Collection of Cosmos related resources
516
star
8

chain-registry

Python
510
star
9

sdk-tutorials

Tutorials for building modules for the Cosmos SDK
Go
495
star
10

gravity-bridge

A CosmosSDK application for moving assets on and off of EVM based, POW chains
TypeScript
493
star
11

gaia

Cosmos Hub
Go
470
star
12

iavl

Merkleized IAVL+ Tree implementation in Go
Go
417
star
13

ethermint

Ethermint is a scalable and interoperable Ethereum, built on Proof-of-Stake with fast-finality using the Cosmos SDK.
Go
410
star
14

cosmos-rust

The home of all shared Rust resources for the Cosmos ecosystem.
Rust
302
star
15

ibc-rs

Rust implementation of the Inter-Blockchain Communication (IBC) protocol.
Rust
200
star
16

testnets

Cosmos Testnets
Shell
157
star
17

interchain-security

Replicated security (aka interchain security V1) is an open sourced IBC application which allows cosmos blockchains to lease their proof-of-stake security to one another.
Go
153
star
18

mainnet

It's happening!
Go
127
star
19

ics23

Building generic merkle proof format for IBC
Rust
116
star
20

gex

In-terminal explorer for Cosmos SDK blockchains.
Go
97
star
21

ibc-apps

IBC applications and middleware for Cosmos SDK chains.
Go
82
star
22

cosmos-multisig-ui

Create multisigs and multisig transactions on Cosmos chains
TypeScript
81
star
23

cosmos-academy

Content for Cosmos Academy
Go
68
star
24

stargate-launch

58
star
25

gogoproto

Protocol Buffers for Go with Gadgets for Cosmos
Go
57
star
26

relayer-archive

An example of a server side IBC relayer to be used for Game of Zones and beyond
Go
56
star
27

scaffold

Scaffolding for Cosmos-SDK based application
Go
55
star
28

game-of-stakes

Python
52
star
29

ledger-cosmos

C
52
star
30

ibc-proto-rs

Rust Protobuf definitions and gRPC clients for interacting with Cosmos SDK, IBC and Interchain Security
Rust
47
star
31

modules

Go
44
star
32

ledger-cosmos-obsolete

Ledger Nano S support for Tendermint/Cosmos
C++
42
star
33

governance

Resources for Cosmos governance
Shell
40
star
34

snap

Packages That Add Cosmos Support Into Metamask. The Cosmos is Expanding!
TypeScript
38
star
35

cosmos-proto

Go
36
star
36

b9-checkers-academy-draft

TypeScript
32
star
37

amino-js

go-amino + GopherJS + TypeScript
Go
31
star
38

faucet

Token faucet web app for the Cosmos Hub and Gaia testnets.
Vue
25
star
39

atlas

An open source Cosmos SDK module registry.
Vue
25
star
40

cips

The Cosmos Improvements Proposals
JavaScript
25
star
41

cosmos-db

Go
22
star
42

research

21
star
43

developer-portal

JavaScript
21
star
44

cosmos-sdk-js

(NOTICE: Very out of date) JavaScript client for the Cosmos SDK API
JavaScript
20
star
45

gosec

Go
18
star
46

sp1-ics07-tendermint

This is a zero knowledge IBC tendermint light client written using SP1 and ibc-rs (WIP)
Rust
18
star
47

stargate

Stargate Roadmap Website
Vue
17
star
48

burner-chains

Low-security temporary experimental application-specific blockchains
17
star
49

vuepress-theme-cosmos

This repository is deprecated and is not maintained. Please, use another system for documentation.
Vue
16
star
50

v1.cosmos.network

DEPRECATED - The website for Cosmos - Internet of Blockchains
HTML
15
star
51

qa-integration

Python
15
star
52

ethermint_abci

DEPRECATED - moved to https://github.com/cosmos/ethermint
Go
15
star
53

interchain-attestation

Go
13
star
54

vega-test

Shell
12
star
55

fundraiser-cli

CLI tool for participating in Cosmos Fundraiser
Go
12
star
56

registry

11
star
57

community

11
star
58

cosmos-registrar

A tool for pulling data from cosmos networks and pushing it to git repos
Go
10
star
59

solidity-ibc-eureka

This is a work-in-progress solidity implementation of IBC Eureka.
Solidity
9
star
60

fundraiser-lib

JS module for participating in Cosmos Fundraiser
JavaScript
9
star
61

composer

TypeScript
9
star
62

cosmos-sdk-docs

HTML
9
star
63

ledger-cosmos-go

Go
8
star
64

groups-ui

TypeScript
7
star
65

security

Cosmos Security contains guidelines (and tools in the future) for a responsible security incident disclosure
7
star
66

rollkit-ibc

Rollkit Wasm light client (WIP)
Go
6
star
67

iavl-bench

Go
6
star
68

interchain-security-gravity

Python
6
star
69

faucet-backend

Faucet Backend
Go
6
star
70

ibc-docs

5
star
71

chainparse

Go
5
star
72

advocates

Cosmos Advocates
5
star
73

images

Cosmos Docker Images
Shell
4
star
74

keystone

Go
4
star
75

rosetta

Rosetta implementation for cosmos zones
Go
4
star
76

academy-checkers-ui

TypeScript
4
star
77

.github

GitHub Actions, Workflows, and templates used across the Cosmos org.
4
star
78

vanity

HTML
4
star
79

fundraiser

Code for the fundraiser subdomain
Vue
3
star
80

did-cosmos

3
star
81

tools

Tools used in our various repos
Go
3
star
82

gravity-dex-site

Gravity DEX: The Cosmos Interchain Exchange
Vue
3
star
83

hackatom2021

HackAtom VI
Vue
3
star
84

jobs

PHP
3
star
85

cosmos-sdk-ics-fork

2
star
86

nightly-stack

2
star
87

gravity-bridge-site

Vue
1
star
88

temp-archive

1
star
89

crypto

Go
1
star
90

conversations-site

CSS
1
star
91

hackatom2020

HackAtom V
Vue
1
star
92

wallet-registry

1
star
93

gogogateway

Go
1
star