Introducing a new way to review your PRs.

Read the announcement

lfdt-ibc / ibc

The Inter-Blockchain Communication Protocol (IBC) is a neutral, open standard for secure cross-ledger interoperability

View on GitHub

18 documents · Updated Nov 23, 2026

docs / link-relayer-system

IBC CLI relayer system

IBC CLI is the repository's operational relayer for IBC v2 traffic between configured EVM chains. It deploys the on-chain IBC stack, watches packet events, builds proof-backed relay transactions, submits them, and keeps durable state for recovery and inspection. It can also run attestor services and application commands for the deployed IBC network.

System purpose

IBC CLI connects IBC routers on separate chains through paired light clients. A connection defines the two client ends and the signers that submit work on each chain. The relayer moves packets in either direction while each destination client verifies the source chain.

The system has two trust roles:

  • The relayer finds packet work and submits receive, acknowledgement, or timeout operations.
  • The attestor reads chain state and signs claims for an attestation light client.

The main flow joins live events, durable work, proof data, and confirmed chain actions:

flowchart LR
    A[Packet event] --> B[Route check]
    B --> C[Durable packet state]
    C --> D[Route pipeline]
    D --> E[Client update and packet proof]
    E --> F[Relay transaction]
    F --> G[Terminal packet state]
    G --> C

System boundaries

Chain boundary

The chain boundary supplies router events, chain heads, client state, commitments, proofs, and transaction results. The current service targets EVM chains through RPC and optional WebSocket access. It supports attestation clients and Besu BFT clients using QBFT or IBFT2 consensus.

The Besu path turns sealed headers into the trusted form expected by the light client. It also binds proofs to the configured counterparty router, so a valid chain header cannot be used for the wrong IBC deployment.

References: cli/…/besu.go• L18-68 cli/…/consensus.go• L10-30 cli/…/header.go• L34-72 cli/…/generator.go• L26-43

Service boundary

The service boundary gives operators and other processes a Connect RPC interface. Relayer methods accept source-chain transactions and expose durable packet selections. Attestor methods expose identity, height, state claims, and packet claims. Health methods report whether registered services can serve requests.

The command line also covers configuration, keys, migrations, deployment, queries, and application transactions. These commands prepare or inspect the relayer environment rather than replace packet coordination.

References: cli/…/main.go• L30-60 cli/…/server.go• L20-39 cli/…/health.go• L49-79 cli/…/relayer_handler.go• L23-31 cli/…/attestor_handler.go• L23-34

Trust boundary

The relayer does not treat one attestor response as proof. An attestation light client defines the accepted attestor addresses and the threshold. The relayer keeps only claims with the expected data, valid recovered signatures, and distinct signers that meet that threshold.

Attestation signatures use separate domains for state claims and packet claims. This prevents a signature for one claim type from being reused as the other type.

References: cli/…/quorum.go• L23-35 cli/…/quorum.go• L74-105 cli/…/signing.go• L17-47 cli/…/ecrecover.go• L16-51

Configuration model

Operator configuration

The operator configuration joins the resources that must agree for relay work: chains, storage, metrics, signers, attestors, and connections. A connection pairs two client ends and assigns the signer used to submit work on each side. The worked example in cli/…/ibc.yml shows this relationship.

Configuration loads from YAML with environment expansion. Structural checks validate references between chains, signers, attestors, clients, and connections. Live checks can also reach external resources and compare configured proof sources with on-chain client state.

Relay settings can tune polling, batching, clearing, and pending-transaction behavior by chain. Automatic packet discovery uses WebSocket endpoints when available. If a subscription cannot start, periodic clearing remains available as the recovery path. A client end may instead use a remote proof service for a supported or external light-client type.

References: cli/…/ibc.yml• L4-122 cli/…/config.go• L66-108 cli/…/config.go• L281-316 cli/…/config.go• L687-760 cli/…/relayer.go• L26-109

Signer and attestor choices

Signers provide keys for chain transactions and attestation claims. They can be local or remote. A remote signer keeps the private key in a key service and gives IBC CLI only the signing interface.

Attestors can run inside the relayer process or behind a remote RPC endpoint. The relayer resolves an attestor's chain and address before relay work starts. A remote outage removes that attestor from the usable quorum, while invalid TLS setup remains a startup error.

A local attestor signer is reserved for that attestor. It cannot also back another attestor, relay transactions, or deploy contracts because attestation signatures are not bound to a chain. Deployment address discovery needs a local ECDSA key. Remote signers remain suitable for runtime signing but cannot supply the raw key required by local deployment tooling.

References: cli/…/config.go• L140-193 cli/…/config.go• L765-805 cli/…/config.go• L523-641 cli/…/tls.go• L19-176 cli/…/signer.go• L17-95 cli/…/resolve.go• L17-85 cli/…/remote.go• L19-69

Configuration operations

Configuration commands create a starting file, add chain entries, and report structural or live validation results. Global flags select the home directory, config path, database override, log format, and log level.

Draft validation checks identities before all runtime values are present. Runnable validation then requires the chains, signers, connections, router addresses, and multicall addresses needed by the selected service.

Deployment rendering treats the config as operator-owned state. It matches mutual client pairs by identity and adds generated addresses and relay links without discarding existing aliases, automatic relay settings, proof sources, or attestor choices when the new input does not replace them. It can write an incomplete draft with TODO values when a signer or address is unresolved. Later runs can fill those values while keeping the operator's semantic settings. Repeated rendering is idempotent, and a client-type change requires an explicit operator change instead of an automatic replacement.

References: cli/…/main.go• L42-75 cli/…/config.go• L78-226 cli/…/flags.go• L26-65 cli/…/patch.go• L11-172 cli/…/deploy_test.go• L60-204 cli/…/deploy_test.go• L755-849 cli/…/patch_test.go• L124-205

Runtime model

Process startup

The ibc binary is the process entry point. ibc relayer run loads and validates configuration, builds chain and signer services, opens durable storage, resolves proof sources and attestors, then starts the RPC server and relay loop. ibc attestor run starts the attestor service without packet coordination state.

When local attestor settings are present, one relayer process can serve both roles. The same service can run in a small non-root container. Shutdown uses one signal context and changes health state before the server closes.

The binary reports its own version, source commit, and pinned contract and IBC-Go versions. Build metadata comes from the CLI Makefile and is set at build time.

References: cli/README.md• L3-8 cli/README.md• L24-68 cli/…/main.go• L32-69 cli/Makefile• L8-27 cli/Dockerfile• L5-41 cli/…/relayer.go• L83-143 cli/…/attestor.go• L61-93

Runtime child pages

Use these pages for focused explanations of the running service:

References: cli/…/main.go• L35-60 cli/…/relayer.go• L83-143 cli/…/attestor.go• L61-93

Relay lifecycle

Packet discovery and request intake

The relayer receives work from an explicit source transaction or from configured chain subscriptions. The watcher checks both client ends before it records a SendPacket event, so unrelated client traffic does not enter a route.

Automatic discovery starts from the current chain position. A subscription reconnects after a drop, while a clearing pass probes chain state for outstanding packets that live events did not record. If the initial subscription cannot start, the watcher logs the error and continues with periodic clearing. It does not depend on event history alone. An explicit transaction request remains the direct recovery path for a known missed transaction.

The store keeps observed but unselected packets visible. This lets operators distinguish packets that were seen from packets that the configured relay policy selected.

References: cli/…/watcher.go• L57-71 cli/…/watcher.go• L125-166 cli/…/watcher.go• L168-228 cli/…/watcher.go• L246-357 cli/…/set.go• L14-73 cli/…/service.go• L215-307

Route dispatch

The dispatcher polls durable state for selected packets that are not terminal. It maps each packet to a route made from its source chain, source client, destination chain, and destination client. Each route has one pipeline, and a packet already in flight is not pushed again.

The dispatcher releases work that left a pipeline before it reads the store again. This ordering prevents stale reads from creating duplicate submissions while still allowing later polls to retry work that really ended.

References: cli/…/dispatcher.go• L22-37 cli/…/dispatcher.go• L105-153 cli/…/opts.go• L12-74

Route pipeline

Each route pipeline moves a packet through finality checks, delivery checks, proof creation, transaction submission, retry handling, and terminal state. The relay kind selects one of three outcomes: receive, acknowledgement, or timeout.

Packets can share a destination transaction when they share a route and relay kind. The pipeline first applies client update payloads and then packet operations. If several client updates are needed, it submits and confirms the earlier updates before it submits the transaction with the final update and packet work.

The pipeline also reconciles work completed by another relayer. If the destination already received a packet, it records the existing receive transaction instead of submitting a duplicate. It then reads the write acknowledgement from that receive transaction. A missing acknowledgement clears the stale receive record so the next pass can find the successful receive or time out the packet.

References: cli/…/batch_relay.go• L59-75 cli/…/batch_relay.go• L73-165 cli/…/check_recv_packet_delivery.go• L13-73 cli/…/wait_for_write_ack.go• L15-122 cli/…/types.go• L35-105 cli/…/dispatcher.go• L105-153

Relay execution child page

Use Relay execution pipeline for the packet state machine, route dispatch, batching, finality checks, retries, and terminal outcomes.

References: cli/…/dispatcher.go• L105-153 cli/…/batch_relay.go• L73-165 cli/…/state_finisher.go• L18-75

Attestation and transaction flow

Proof production

A proof provider serves one configured light client. It chooses a usable height, creates any needed client update data, and creates packet membership or non-membership proofs at that same height. This keeps the client update and packet evidence aligned.

For attestation clients, the provider asks configured attestors in parallel. It selects the highest height reached by at least the configured quorum and confirms that the counterparty chain can read a header at that height. It then accepts claim data only when the signatures meet the configured quorum.

For Besu clients, the provider reads sealed headers and uses the supported QBFT or IBFT2 rules to create trusted header and storage-proof data. A remote proof provider can supply the same contract over RPC when proof generation does not run in IBC CLI. Each remote request names its chain and client so one prover service can serve more than one light client.

References: cli/…/prover.go• L26-55 cli/…/prover.go• L82-179 cli/…/quorum.go• L215-297 cli/…/remote.go• L29-92 cli/…/remote.go• L95-150 cli/…/consensus.go• L10-30 cli/…/header.go• L34-72 cli/…/generator.go• L45-80

Attestor service

The attestor service exposes identity, latest height, state-attestation, and packet-attestation operations. A local attestor reads its chain and signs claims. A remote entry points the relayer to another service that provides the same claims.

The relayer uses the attestor's identity to match it to the on-chain trust set. Later claims retain the data needed for quorum checks. Request limits protect the service from unsupported commitment types, excessive packet counts, and oversized packets.

References: cli/…/service.go• L14-38 cli/…/service.go• L40-86 cli/…/service.go• L136-189 cli/…/remote.go• L19-69

Transaction submission

Relay processors combine client update data with packet proofs and turn them into a transaction intent. The submitter uses the signer for the destination chain, simulates the EVM multicall, then signs and broadcasts it.

Simulation reports each update or packet operation in execution order. The relayer refuses a transaction that would report client misbehaviour or has no operation of the required kind that can succeed. A submitted transaction remains linked to the packet so a later pass can distinguish pending, reverted, and confirmed work.

The EVM submitter manages nonces, bounded fee replacement, pending transaction expiry, and a limit on in-flight transactions. These controls keep a stalled nonce from blocking the whole route indefinitely.

References: cli/…/batch_relay.go• L178-267 cli/…/simulation.go• L25-88 cli/…/evm.go• L24-41 cli/…/evm.go• L111-197 cli/…/evm.go• L249-267

Attestation and transaction child page

Use Attestation and transaction submission for attestor claims, quorum checks, proof encoding, signing, simulation, and chain transaction submission.

References: cli/…/quorum.go• L74-193 cli/…/quorum.go• L215-297 cli/…/signing.go• L23-47 cli/…/batch_relay.go• L73-165

Deployment and persistence

Deployment workflow

Deployment prepares the on-chain resources that relay work needs. It provisions the router and multicall, deploys and registers light clients, and can add application components such as GMP and IFT bridges. Each step checks live state so a rerun continues from completed work.

Core deployment also grants public access to the router operations used by relayers. This makes the relay access policy part of the deployed contracts. A deployment manifest records addresses, client parameters, applications, and bridge links for later verification and config rendering.

Deployment can render mutual client pairs into relay configuration. It preserves operator settings when generated data does not replace them and reports conflicts instead of guessing a client-type change. Direct IFT commands provide application actions such as minting, sending, and balance queries.

References: cli/…/deploy.go• L81-145 cli/…/deploy.go• L256-312 cli/…/deploy.go• L481-599 cli/…/deploy.go• L155-202 cli/…/driver.go• L119-208 cli/…/wiring.go• L38-67 cli/…/manifest.go• L19-69

Operational persistence

The store is the relayer's durable coordination point. It records packet identity, route data, relay status, transaction hashes, acknowledgement results, and the relayer address for each chain action.

The watcher and relay API write packet records. The dispatcher reads selected non-terminal records. Pipeline stages update the same record as they check chain state or submit transactions. Clearing writes recovered packets and its progress state in one transaction. Its forward watermark skips known sequences, while unresolved sequences stay eligible until a probe at or above their last live height confirms settlement. Operators can choose to stop probing an unrecoverable sequence without deleting its record.

References: cli/…/store.go• L19-84 cli/…/store.go• L96-117 cli/…/store.go• L171-265 cli/…/relayer.sql• L125-213 cli/…/clearer.go• L39-67 cli/…/clearer.go• L354-372 cli/…/relayer.go• L98-109

Deployment and persistence child page

Use Deployment, storage, and operational state for manifests, repeatable deployment steps, migrations, database choices, clearing, and packet state storage.

References: cli/…/manifest.go• L19-31 cli/…/deploy.go• L155-202 cli/…/store.go• L19-112

Operational telemetry

Metrics model

Metrics show whether the relayer discovers work, proves it, submits transactions, and reaches terminal state. Labels connect each signal to an operational unit such as a route, chain, client, relay kind, proof kind, signer, or attestor. OpenTelemetry also instruments the RPC boundary and can add runtime and host signals.

The main signals are:

  • Packet discovery, packet event stream health, and current pending packet counts.
  • Relay transitions, completed legs, duration, batch size, and excessive latency.
  • Proof duration, usable height, packet proof batch size, and attestation data matches.
  • Transaction attempts, confirmations, gas, balance, and retries.
  • Attestor and signer operation time with result status.

Pending work is a current-value signal. Excessive relay latency is an event signal, so its rate is more useful for alerting than its raw total. Operators can use a simple Prometheus endpoint or an OpenTelemetry configuration file. The latter can export the same service metrics with runtime and host data. A metrics setup error is logged without stopping the relayer. The local dashboard uses RPC latency and failure rates together with chain, prover, attestor, signer, and process signals.

References: cli/…/metrics.go• L13-45 cli/…/metrics_test.go• L21-68 cli/…/metrics.go• L38-179 cli/…/metrics.go• L25-121 cli/…/metrics.go• L17-154 cli/…/metrics.go• L14-109 cli/…/otel.go• L43-67 cli/…/otel.go• L97-121 cli/…/otel.go• L125-219 cli/…/dashboard-loadtest.json• L32-58 cli/…/dashboard-loadtest.json• L153-180 cli/…/config.go• L421-470

Readiness and logs

Readiness marks the point at which the HTTP server is serving and registered handlers pass their checks. The health API can check all services or one named service within a short timeout. The relayer health check includes database reachability, while the attestor check reflects service construction and context state.

Structured logs add route, chain, client, transaction, and error context. Operators should use the packet API for durable packet state and telemetry for rates, latency, retries, and missing progress.

References: cli/…/server.go• L71-115 cli/…/health.go• L16-79 cli/…/service.go• L184-212 cli/…/service.go• L107-110 cli/…/relayer.go• L112-143 cli/…/README.md• L5-55

Observability child page

Use Operational observability for metric names, labels, readiness events, logging, and alert signals.

References: cli/…/metrics.go• L38-135 cli/…/metrics.go• L41-121 cli/…/metrics.go• L17-34 cli/…/metrics.go• L19-60 cli/…/otel.go• L43-121

Change checklist

When these files or sections are changed, remember to consider these:

  • A change to client or connection identity can affect route lookup, proof-provider matching, signer selection, automatic discovery, and rendered configuration together.
  • A change to packet states or transaction fields must stay aligned across the RPC contract, store, retry stages, terminal state, and packet queries.
  • A change to attestation tags, signature form, quorum rules, or height selection must remain compatible with on-chain client membership, signer recovery, counterparty headers, and proof height.
  • A change to Besu consensus, header normalization, or storage proofs must remain compatible with QBFT and IBFT2 light-client checks and the configured router.
  • A change to router relay access must remain aligned with deployment roles and multicall operations.
  • A change to event recovery or clearing must preserve the forward watermark and unresolved-sequence rules for the configured storage system.
  • A change to the clearing pass must keep packet recovery and its watermark or unresolved delta in the same transaction, including the option to abandon unrecoverable sequences without forgetting them.
  • A change to remote attestor, signer, or prover endpoints must preserve identity lookup, TLS validation, request limits, and the distinction between an outage and invalid configuration.
  • A change to remote prover responses must preserve the chain-and-client target and the one-proof-per-packet contract for all proof kinds.
  • A change to transaction retry or nonce handling must preserve pending-state recovery and route capacity limits.
  • A change to metric names or labels must preserve the route, chain, processor, relay-kind, result, and packet-event-stream health meaning used by alerts and dashboards.
  • A change to watcher startup or subscription recovery must preserve the fallback to clearing, the independent operation of sibling watchers, and the subscription health gauge.
  • A change to readiness or shutdown order must keep health state aligned with handler checks and stop packet intake before the dispatcher and store close.
  • A change to deployment manifest or config rendering must preserve idempotent reruns, mutual-client matching, operator aliases, and explicit handling of client-type changes.
  • A change to the store query contract must keep packet state and clearing state aligned with the active persistence layer.
  • A change to CLI build metadata must keep the Makefile inputs aligned with the values printed by ibc --version.

Important failure modes

TriggerConsequenceGuard
Automatic relay is enabled but the source WebSocket endpoint is unavailableLive packet discovery is unavailable, but periodic clearing can still recover outstanding packetsThe watcher logs the subscription error and continues with its clearing loop
A packet names an unconfigured client pairThe packet does not enter a relay routeWatcher and route selection check both client ends
The attestor quorum has too few distinct valid signersProof generation stops before transaction creationExpected-data checks, signature recovery, signer de-duplication, and threshold checks enforce quorum
The resolved attestor height is not readable on the counterparty chainClient update and packet proof creation cannot use that heightHeight selection reads the counterparty header before returning the height
A Besu header has unsupported or ambiguous consensus sealsThe light-client update is rejectedHeader parsing accepts only one supported QBFT or IBFT2 interpretation with validator signers
A relay simulation would report client misbehaviour or has no usable operationThe transaction is not broadcastMulticall simulation classifies every operation and blocks unsafe or unusable results
A relay transaction remains pending or its nonce is stalledLater relay work can wait behind the same accountPending expiry, bounded fee replacement, nonce reuse, and in-flight limits permit recovery
A source event is missed while automatic discovery is offlineThe packet is not recovered from event history aloneClearing probes outstanding commitments and explicit transaction intake handles known history
A source subscription fails during startupThat chain has no live event stream until a later start or recovery path succeedsThe watcher remains started and uses periodic clearing instead of failing the full watcher set
Another relayer delivers a packet while this relayer's receive work is pendingThe relayer could submit duplicate work or lose the transaction that produced the receiveThe pipeline checks destination receipt state and records the existing receive transaction
A recorded receive transaction has no write acknowledgement for the packetThe receive record is stale and the packet cannot move to acknowledgement handlingThe pipeline clears the receive record and lets a later pass find the real receive or time out
A deployment uses a remote or non-ECDSA deployerAddress discovery or on-chain provisioning cannot runDeployment requires a local ECDSA deployer key
Rendered deployment data changes an existing client typeConfig reconciliation stops instead of changing the proof model silentlyThe operator must change the client type explicitly
A stale chain read reports an absent commitmentClearing could remove a live packet from recovery workUnresolved sequences remain until a probe at or above the last live height resolves them
A remote prover returns fewer proofs than requestedThe relay cannot safely match proofs to packetsThe remote client rejects a response unless it contains one proof for every requested packet
OpenTelemetry mode has no valid config fileThe selected telemetry mode cannot startConfig validation checks the configured file and OTEL_CONFIG_FILE override

Key files

FileWhy to read it
cli/README.mdGives the product scope, supported chain and client types, and end-to-end CLI lifecycle.
cli/…/main.goShows the public command groups and the operator controls for runtime, deployment, and application actions.
cli/MakefileShows how builds inject CLI, contract, and IBC-Go version data into ibc --version.
cli/…/ibc.ymlShows how chains, connections, signers, attestors, storage, and observability fit together.
cli/…/config.go and cli/…/patch.goDefine configuration validation and the rules that reconcile generated deployment data with operator settings.
cli/…/relayer.go and cli/…/attestor.goShow how the relayer and standalone attestor processes start and stop.
cli/…/server.go and cli/…/health.goDefine the RPC and readiness boundary.
cli/…/besu.go and cli/…/header.goExplain chain-side Besu support and trusted header handling.
cli/…/watcher.go, cli/…/set.go, and cli/…/clearer.goShow how packet events, subscription recovery, sibling watcher startup, and clearing become durable relay work.
cli/…/dispatcher.go and cli/…/batch_relay.goShow route selection, batching, proof use, and transaction handoff.
cli/…/check_recv_packet_delivery.go and cli/…/wait_for_write_ack.goShow how the pipeline accounts for delivery by another relayer and reads synchronous write acknowledgements.
cli/…/quorum.goShows attestor height selection, claim checks, and quorum rules.
cli/…/remote.go and cli/…/remote.goShow the remote proof and attestor service boundaries.
cli/…/evm.go and cli/…/simulation.goShow EVM transaction safety, retry behavior, and multicall simulation.
cli/…/deploy.go, cli/…/driver.go, and cli/…/wiring.goShow how the on-chain IBC stack is provisioned, connected, and verified.
cli/…/manifest.goDefines the durable deployment record used by verification and config rendering.
cli/…/store.go and cli/…/relayer.sqlDefine packet state, clearing state, and transaction records used by relay coordination.
cli/…/otel.go, cli/…/metrics.go, and cli/…/dashboard-loadtest.jsonDefine metric setup, packet event stream health, and the local telemetry views for service and process health.