Skip to content

IBC Relayer implementations for heterogeneous blockchains

License

Notifications You must be signed in to change notification settings

dongrie/yui-relayer

 
 

Repository files navigation

Relayer

Test GoDoc

An IBC relayer implementation supports heterogeneous blockchains.

Supported chains

You can find a list of each supported combination of chains and examples of E2E testing with the Relayer here: https://github.com/datachainlab/yui-relayer-build

Compatibility with IBC

The Relayer uses "vX.Y.Z" as its version format. "v0.Y.Z" will be used until the Relayer's core and module interface is stable.

In addition, "Y" corresponds to the specific major version of ibc-go (i.e., "X"). The following table shows the Relayer version and its corresponding ibc-go version.

Relayer ibc-go
v0.4.0(current branch) v7.0.0
v0.3.0 v4.0.0
v0.2.0 v1.0.0-beta1

Glossary

  • Chain: supports sending a transaction to the chain and querying its state
  • Prover: generates or query a proof of a target chain's state. This proof is verified by on-chain Light Client deployed on the counterparty chain.
  • ProvableChain: consists of a Chain and a Prover.
  • Path: is a path of two ProvableChains that relay packets to each other.
  • ChainConfig: is a configuration to generate a Chain. It requires implementing Build method to build the Chain.
  • ProverConfig: is a configuration to generate a Prover. It also requires implementing Build method to build the Prover.

How to support a new chain

The Relayer can support additional chains you want without forking the repository.

You can use the Relayer as a library to configure your relayer that supports any chain or Light Client. You must provide a module that implements Module interface.

The following is the implementation of the tendermint module:

import (
	codectypes "github.com/cosmos/cosmos-sdk/codec/types"
	"github.com/hyperledger-labs/yui-relayer/chains/tendermint"
	"github.com/hyperledger-labs/yui-relayer/chains/tendermint/cmd"
	"github.com/hyperledger-labs/yui-relayer/config"
	"github.com/spf13/cobra"
)

type Module struct{}

var _ config.ModuleI = (*Module)(nil)

// Name returns the name of the module
func (Module) Name() string {
	return "tendermint"
}

// RegisterInterfaces register the module interfaces to protobuf Any.
func (Module) RegisterInterfaces(registry codectypes.InterfaceRegistry) {
	registry.RegisterImplementations(
		(*core.ChainConfig)(nil),
		&ChainConfig{},
	)
	registry.RegisterImplementations(
		(*core.ProverConfig)(nil),
		&ProverConfig{},
	)
}

// GetCmd returns the command
func (Module) GetCmd(ctx *config.Context) *cobra.Command {
	return cmd.TendermintCmd(ctx.Codec, ctx)
}

A module can be used through a relayer configuration file by registering a Config implementation for a target Chain or Prover in RegisterInterfaces method.

You can use it by specifying the package name of the proto definition corresponding to the Config in the "@type" field of the config file, as shown below. Then, the relayer creates an instance of the corresponding Chain or Prover using the Config at runtime.

{
  "chain": {
    "@type": "/relayer.chains.tendermint.config.ChainConfig",
    "key": "testkey",
    "chain_id": "ibc0",
    "rpc_addr": "http://localhost:26657",
    "account_prefix": "cosmos",
    "gas_adjustment": 1.5,
    "gas_prices": "0.025stake"
  },
  "prover": {
    "@type": "/relayer.chains.tendermint.config.ProverConfig",
    "trusting_period": "336h"
  }
}

About

IBC Relayer implementations for heterogeneous blockchains

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Go 92.8%
  • Shell 6.3%
  • Other 0.9%