IBC CLI runtime and service interfaces
The IBC CLI runtime turns checked configuration into a running relayer or attestor process. The ibc command is the operator boundary. Bootstrap, services, RPC, signers, and live checks connect that process to chains, storage, and attestation work. See Link relayer system, Link chain connectivity, Link relay execution, Link attestation and transactions, Link deployment and persistence, and Link operational observability for related systems.
Runtime boundary
The runtime has three roles. The command entrypoint selects the operation and shared process inputs. The bootstrap layer builds the dependencies for a relayer or attestor. The server layer exposes the selected services through one RPC boundary.
This diagram shows how the command turns checked input into a serving process and a readiness result.
flowchart LR
A[ibc command] --> B[load and check config]
B --> C{runtime role}
C -->|relayer| D[assemble relay services]
C -->|attestor| E[assemble attestor service]
D --> F[register RPC handlers]
E --> F
F --> G[start HTTP server]
D --> H[start relay work]
G --> I[readiness event]
H --> I
The relayer keeps relay work and relay state for the life of the process. The attestor serves signed chain data without relayer storage. A relayer can also serve local attestors, so one process can provide both APIs.
Command entrypoint
The ibc command is the process boundary for operators and scripts. It groups configuration, relaying, attestation, queries, deployment, transactions, keys, and migration under one root command (cli/…/main.go• L42-46, cli/…/main.go• L82-91). Shared flags define the home directory, configuration, database override, logging, and other runtime inputs. Interrupt and termination signals enter the command context so long-running commands use one stop path (cli/…/main.go• L64-69).
The command reports the CLI build version and the pinned ibc-contracts and ibc-go versions. The --version flag exposes the CLI version string directly for operators and scripts. This gives operators a clear identity for the binary before they start a long-lived process (cli/…/main.go• L32-61).
The command tree also supports short operations that do not start a long-lived RPC process. Deployment can set up core routing, light clients, GMP, IFT tokens, and IFT bridges. It can verify deployment manifests and report both configured chains and chains found only through manifests. It can render relay settings from matching client records. Query and transaction commands support IFT actions. Key commands manage signing material. Migration commands update the relayer store (cli/…/main.go• L93-177, cli/…/main.go• L169-278, cli/…/deploy.go• L76-147).
Configuration loading
Configuration loading establishes the process context before a command uses chains, signers, storage, or live checks. The loader expands --home, creates the home directory when needed, changes into that directory, reads the configured file, and applies a --db override when one is provided (cli/…/config.go• L177-212).
The validation command first checks the configuration and can then check the requirements for a relayer or an attestor. The --live flag adds checks against current external systems without starting either process (cli/…/config.go• L132-175, cli/…/main.go• L93-96).
References: cli/…/config.go• L132-175 cli/…/config.go• L177-212
Deployment commands
The deployment command family turns configured chain access and signer choices into repeatable on-chain setup. It can plan or preview core routing, client, GMP, IFT, and IFT-bridge work. It requests confirmation before transaction steps, records deployment manifests, verifies those manifests against live chain state, and reports each configured or manifest-only chain without hiding failures in the rest of the sweep (cli/…/deploy.go• L76-147, cli/…/deploy.go• L254-312, cli/…/deploy.go• L508-595, cli/…/deploy.go• L948-1005).
Client setup supports attestation and Besu tracking. The resulting deployment records carry the chain and client state needed to build a relay configuration. The rendered configuration is a bridge between deployment and runtime. It carries deployed router addresses, mutual client pairs, relay signers, and attestor identities into the configuration used by relayer startup (cli/…/deploy.go• L312-427, cli/…/deploy.go• L667-741).
render-config can print a merged draft or populate the configuration file. It loads incomplete drafts so an operator can repair them later. It preserves existing settings that the operator does not replace and checks signer identity conflicts and unknown YAML fields before it writes. If the merged result is not runnable yet, it warns but still stores the draft for repair (cli/…/deploy.go• L744-846).
Core deployment can also copy deployed router and multicall addresses into the configuration after a successful non-dry run. IFT deployment keeps token ownership separate from rate-limit setup: a non-deployer owner must set the limit later, while a deployer-owned token requires a positive capacity and refill window (cli/…/deploy.go• L274-310, cli/…/deploy.go• L877-945, cli/…/deploy_test.go• L60-199, cli/…/deploy_test.go• L482-535).
References: cli/…/deploy.go• L76-147 cli/…/deploy.go• L254-312 cli/…/deploy.go• L312-427 cli/…/deploy.go• L508-595 cli/…/deploy.go• L667-846 cli/…/deploy.go• L877-945 cli/…/deploy.go• L948-1005 cli/…/deploy_test.go• L60-199 cli/…/deploy_test.go• L222-385 cli/…/deploy_test.go• L482-535 cli/…/deploy_test.go• L662-849
Relayer commands
ibc relayer run loads the configuration, builds the relayer, applies database migrations unless --no-migrate is set, and starts the RPC server before it starts the relay dispatch loop (cli/…/relayer.go• L81-138). After both parts start, it writes a JSON readiness event with the connected chain IDs and the actual HTTP address. Shutdown stops relay work, the server, and the store in order.
The ibc relayer relay command asks a running relayer to record packets from one source transaction. The ibc relayer packets command asks the same service for filtered and paged packet state with related transaction IDs. Both commands resolve the server address from configuration unless --host is set, then print the RPC result as JSON (cli/…/relayer.go• L140-246).
References: cli/…/relayer.go• L81-138 cli/…/relayer.go• L140-246 proto/…/relayer.proto• L9-16
Attestor commands
ibc attestor run builds a process from the local attestors in configuration and exposes their attestation API. It does not create relay storage. The command emits an attestor readiness event after the server starts and waits for shutdown (link/…/attestor.go• L60-89).
The ibc attestor info, latest-height, and state-attestation commands query an attestor through the same RPC server. Without --host, the command requires the named attestor to be local in the current configuration. A remote attestor must be addressed directly because another process serves it (link/…/attestor.go• L92-164).
References: link/…/attestor.go• L60-89 link/…/attestor.go• L92-164 proto/…/attestor.proto• L9-22
Process assembly
The bootstrap layer is the composition point for a runnable process. It turns configuration into shared dependencies and connects those dependencies to services and RPC handlers. The result is a Services bundle that gives the command the server, store, signers, and role-specific services it must start and stop (cli/…/bootstrap.go• L24-35).
Relayer assembly
Relayer assembly creates storage and chain clients first. It then resolves signers and local or remote attestors. These dependencies support proof generation, transaction building, and transaction submission. Bootstrap combines them into relay pipelines, a dispatcher, and packet watchers that support both commanded relay work and automatic packet discovery (cli/…/bootstrap.go• L39-127, cli/…/signer.go• L43-87).
The server always registers the relayer handler. When local attestors are configured, bootstrap also registers an attestor handler and returns both services. This dual mode shares chain setup while keeping relay and attestation roles separate (cli/…/bootstrap.go• L66-86, cli/…/bootstrap.go• L126-148).
The relayer service starts the dispatcher and packet watchers as background work. It stops watchers before the dispatcher so no new packets enter the dispatcher while it drains (cli/…/service.go• L184-212).
References: cli/…/bootstrap.go• L24-37 cli/…/bootstrap.go• L39-127 cli/…/bootstrap.go• L126-148 cli/…/service.go• L184-212 cli/…/signer.go• L43-87
Attestor assembly
Attestor assembly creates chain clients, signers, and local attestors. It rejects a configuration with no local attestor because a standalone process must have something to serve. The service has no relay store, so the process registers only the attestor handler (cli/…/bootstrap.go• L151-199).
Local attestors run inside the process and can be exposed by its server. Remote attestors remain dependencies that a relayer can query. They do not become endpoints of that relayer's server. Resolution checks remote identity through its Info call before the relayer uses it. An unreachable remote is skipped so other attestors can still load, while a bad TLS setup is treated as a configuration error (cli/…/resolve.go• L17-85, cli/…/remote.go• L33-70).
References: cli/…/bootstrap.go• L151-199 cli/…/resolve.go• L17-85 cli/…/remote.go• L33-70 cli/…/service.go• L88-109
Service interfaces
Services hold the business rules behind the RPC adapters. They accept domain values instead of transport messages. This keeps the service contract independent of HTTP and protobuf details while allowing the running process and other callers to use the same behavior.
Relayer service
The relayer service accepts a source chain, a source transaction hash, and a packet selection. It checks the request, finds packet events, keeps packets with configured routes, records the request and packet state, and leaves relay execution to the dispatcher (cli/…/service.go• L215-307). Its relay result reports every observed packet as selected, not selected, or unconfigured. This lets a caller distinguish a request that selected nothing from one that selected everything (cli/…/service.go• L310-342).
Its packet listing operation reads recorded packets, applies filters, and returns bounded pages with related send, receive, acknowledgement, or timeout transactions (cli/…/service.go• L414-458, cli/…/service.go• L483-543). The selection contract separates packet discovery from relay control. AllPackets selects every relayable packet in the source transaction. Explicit selection requires each named packet to exist and have a configured route. A discovered packet can remain unselected when this relayer instance did not choose it, which supports permissionless IBC relaying (proto/…/relayer.proto• L19-45, proto/…/relayer.proto• L58-73).
References: cli/…/service.go• L165-212 cli/…/service.go• L215-342 cli/…/service.go• L414-543 proto/…/relayer.proto• L19-45
Attestor service
The attestor service is a named registry of attestors. It routes requests for the latest attestable height, state attestations, and packet attestations to the selected attestor. It also returns identity data so callers can link an attestor to its chain and signing address (cli/…/service.go• L14-59, cli/…/service.go• L123-165).
Attestation requests carry signed data for chain state or packet commitments. The service limits packet request size and count before forwarding work. Its errors distinguish an unknown attestor, bad input, unavailable finality, missing commitments, and an existing receipt so the RPC layer can return the correct client-visible result (cli/…/service.go• L61-85, cli/…/service.go• L167-189).
The service readiness check does not probe chains or signers. It reports the service as ready when its process context is valid. Live dependency checks remain the responsibility of startup validation and the attestor operation itself (cli/…/service.go• L107-110).
References: cli/…/service.go• L20-59 cli/…/service.go• L78-110 cli/…/service.go• L123-189 proto/…/attestor.proto• L24-89
Signer set
The signer set gives bootstrap and relay services access to local key files or remote signing systems through stable aliases. A remote signer resolves its endpoint and key ID before it enters the set, so the runtime knows its public key and supported key type before relay work starts (cli/…/signer.go• L43-97, cli/…/remote.go• L33-123).
This interface keeps private-key location and remote key transport behind the same signing contract. Other runtime layers can request a signature without needing to know where the key is held (cli/…/signer.go• L17-24, cli/…/metrics.go• L15-80).
References: cli/…/signer.go• L17-24 cli/…/signer.go• L43-97 cli/…/remote.go• L49-123 cli/…/metrics.go• L15-80
RPC server
The server provides one HTTP endpoint for the handlers registered by bootstrap. It supports Connect RPC over HTTP/1 and unencrypted HTTP/2. It also bounds request size and connection read time. Command clients and deployed callers therefore use the same service boundary without requiring TLS at this layer (cli/…/server.go• L20-80).
Handler boundary
Handlers translate protobuf requests into service requests and domain results back into protobuf responses. The relayer handler exposes relay and packet queries. The attestor handler exposes identity, height, state, and packet-attestation calls. Both map known domain errors to RPC status codes and hide unexpected errors behind an internal-server response (cli/…/relayer_handler.go• L17-31, cli/…/relayer_handler.go• L39-95, cli/…/attestor_handler.go• L17-34, cli/…/attestor_handler.go• L41-142).
The relayer response preserves the selection state of every observed packet, including packets that have no configured route. The packet query boundary accepts filters and cursors, while rejecting unknown packet states before they reach the service (cli/…/relayer_handler.go• L58-119, cli/…/relayer_handler.go• L123-211). This boundary keeps transport concerns out of the services (cli/…/AGENTS.md• L3-6).
References: cli/…/relayer_handler.go• L17-50 cli/…/relayer_handler.go• L53-95 cli/…/relayer_handler.go• L123-211 cli/…/attestor_handler.go• L17-58 cli/…/attestor_handler.go• L60-142 cli/…/AGENTS.md• L3-6
Server lifecycle
Handlers are registered before the server listens. Starting the server binds the configured TCP address and returns the bound address used in the readiness event. Reflection is added once at start when enabled, based on the registered service names (cli/…/server.go• L83-99, cli/…/server.go• L113-127, cli/…/server.go• L141-152).
When observability is enabled, the server wraps registered Connect handlers so RPC activity uses the shared telemetry layer. Stopping the server uses a short shutdown context so active requests can finish without holding process shutdown open indefinitely (cli/…/server.go• L101-127).
The relayer command stops background work before the server and closes storage last. The attestor command only needs to stop its server (link/…/relayer.go• L105-111, link/…/attestor.go• L71-89).
References: cli/…/server.go• L83-152 link/…/relayer.go• L77-111 link/…/attestor.go• L71-89
Health interface
The health interface separates server liveness from service readiness. The health service itself reports serving when the HTTP server is active. A named registered service runs that service's readiness check. An empty service name checks every registered service, with a one-second limit for dependency checks (cli/…/health.go• L16-79).
The relayer readiness check pings its store, so database reachability affects relayer health. The attestor readiness check only confirms that its service context is active. It does not prove that a chain or signer is reachable. Shutdown marks the server not serving and prevents a late dependency result from restoring readiness (cli/…/service.go• L184-187, cli/…/service.go• L107-110, cli/…/health.go• L36-79).
Unknown service names return not found. Health watch is not a streaming readiness mechanism, so callers must make on-demand checks (cli/…/health.go• L49-79).
References: cli/…/health.go• L16-79 cli/…/server.go• L60-68 cli/…/server_test.go• L32-59 cli/…/server_test.go• L94-173
Live validation
Live validation checks whether a configuration can work with current external systems without starting a relayer or attestor. The ibc config validate --live path checks database reachability, chain access, on-chain client links, and attestor quorum before it reports success (cli/…/main.go• L93-96, cli/…/config.go• L132-168, link/…/validate.go• L17-35).
Connection checks
For every configured two-way connection, live validation checks both client ends. It reads each on-chain counterparty and compares it with the configured opposite end. This catches a locally valid configuration that points to the wrong on-chain client relationship (link/…/connections.go• L14-54).
References: link/…/connections.go• L14-54
Attestor quorum checks
Live validation creates the configured signer set and resolves every local and remote attestor before it builds the proof-generation view. That proof view confirms that each attestation-type client can meet its current quorum against on-chain state. This links operator configuration to the state the running relayer needs for proofs (cli/…/quorum.go• L18-39).
References: link/…/validate.go• L17-35 cli/…/quorum.go• L18-39 cli/…/resolve.go• L17-85
Change checklist
When these files or sections are changed, remember to consider these:
- When an RPC method or message changes, keep the raw proto, generated client and handler contract, service method, and CLI request or response mapping aligned.
- When bootstrap dependencies change, preserve the readiness order. The process must not announce readiness before the server and required background service are running.
- When a local or remote attestor rule changes, check both dual-mode relayer assembly and standalone attestor assembly. The same configuration also controls live quorum checks.
- When a service error changes, preserve its mapping to the intended RPC status code and the JSON shape printed by the CLI.
- When packet filters, selection states, or cursor rules change, check the service, relayer handler, and
ibc relayer packetsflags together so paging and filter values keep the same meaning. - When the listen address or server protocol changes, check external RPC callers and the CLI address resolution path, including unspecified listen hosts.
- When health checks change, preserve the difference between server liveness, named service readiness, and the aggregate check. Check shutdown behavior and the readiness timeout.
- When home, config, or database override handling changes, check one-shot and long-running commands together because both use the same configuration boundary.
- When deployment manifest or rendered-config behavior changes, preserve the link between deployed mutual clients and the generated relay connections. Check that existing user settings are retained unless an explicit override is supplied.
- When deployment status or config rendering changes, keep manifest-only chain reporting, mutual-client matching, identity checks, draft repair behavior, and the warning for non-runnable drafts aligned with the generated runtime configuration (cli/…/deploy.go• L508-595, cli/…/deploy.go• L698-846).
- When IFT deployment rules change, keep ownership, rate-limit validation, address normalization, and the paired bridge steps aligned with the contract calls and generated deployment records (cli/…/deploy.go• L877-1005).
- When the root command or its flag wiring changes, check command-family registration and the validation path together. The entrypoint binds the shared
--livevalidation flag and all runtime command groups in one initialization path (cli/…/main.go• L71-105).
Important failure modes
| Trigger | Consequence | Guard |
|---|---|---|
| A required chain client, signer, attestor, proof generator, transaction builder, or submitter cannot be built | Bootstrap returns an error and no runnable process is returned | Run normal config validation and ibc config validate --live before startup |
Database migration fails during ibc relayer run | The relayer exits before it starts serving | Apply migrations through the run command or use --no-migrate only when the database is already ready |
| The configured TCP address cannot be bound | The server has no usable endpoint and readiness is not emitted | Use a valid and available listen address and check the reported readiness address |
| The relay dispatch loop fails after the server starts | The server stops and the run command exits without claiming readiness | Treat a missing or failed readiness event as a failed startup |
| A standalone attestor configuration has no local attestor | Bootstrap returns an error and the process cannot serve the attestor API | Configure at least one local attestor for ibc attestor run |
| A remote attestor cannot be reached during resolution | That attestor is skipped and the process continues with the remaining sources | Treat the configured attestor set and quorum result as the readiness check |
| A remote signer cannot load its key metadata or uses an unsupported key scheme | Signer-set construction fails before relay work starts | Check the signing endpoint, key ID, and supported signing scheme during validation |
| On-chain client counterparty data differs from the configured connection | Live validation fails even if the YAML structure is valid | Correct the connection or on-chain client registration before starting relay work |
| An attestor quorum cannot be satisfied from current local and remote sources | Live validation fails before a relayer is run | Restore the required attestors or correct their chain and signer configuration |
| Deployment manifests do not contain a mutual client pair | Rendered relay configuration cannot define a connection for the chain pair | Deploy or register the client on both chains before rendering runtime configuration |
| A deployment status sweep finds an undeclared chain or an unreachable chain RPC | That chain receives an error entry and the overall command returns verification failure after reporting other chains | Treat the JSON report and exit status as one result; declare the chain or restore its RPC |
| A command is not registered under the root or its parent command | The operator cannot invoke that command even when its implementation exists | Keep command registration and flag binding in the single root initialization path |
| A relayer store becomes unreachable after startup | Named relayer health becomes not serving even while the HTTP endpoint remains live | Restore database access and use the service health result rather than only endpoint liveness |
| A health dependency check exceeds its one-second deadline | The named or aggregate health result is not serving | Keep readiness probes bounded and inspect the dependency that did not respond |
| IFT ownership, amount, address, or rate-limit inputs are invalid | The one-shot deployment stops before a valid contract call | Use a configured chain, valid addresses, positive token values, and a valid owner-rate-limit pair |
| Rendered deployment settings are incomplete | The CLI stores a repairable draft and warns that it is not runnable; startup still fails until missing values are filled | Review the warning and run config validation after adding missing routers, signers, or other settings |
| A rendered configuration has duplicate signer aliases or unknown YAML fields | The CLI rejects the draft without overwriting the existing file | Resolve alias conflicts and remove unsupported fields before rendering again |
Key files
| File | Why to read it |
|---|---|
| cli/…/main.go | Shows the root command, shared flags, signal context, version identity, and command-family registration that form the operator interface. |
| cli/…/config.go | Shows shared home and config loading plus structural and live validation entrypoints. |
| cli/…/config_test.go | Shows the command-level contract for configuration validation, build version output, and the --version flag. |
| cli/…/deploy.go | Shows deployment planning, client setup, manifest verification, app and token setup, status reporting, and conversion of mutual client pairs into relay configuration. |
| cli/…/deploy_test.go | Illustrates deployment status and render-config contracts, including per-chain reporting, preservation of user settings, draft repair, incomplete-config warnings, and safe rejection of invalid drafts. |
| cli/…/relayer.go | Shows relayer startup, readiness, shutdown, relay requests, and packet queries. |
| link/…/attestor.go | Shows standalone attestor startup and local-versus-remote query behavior. |
| cli/…/bootstrap.go | Shows how configuration becomes relayer, attestor, signer, and server services. |
| cli/…/service.go | Defines relayer readiness, background lifecycle, relay selection, and packet-query behavior exposed by RPC. |
| cli/…/service.go | Defines the attestor registry, readiness contract, request limits, and attestation service contract. |
| cli/…/resolve.go | Shows how configured local and remote attestors become runtime dependencies and how resolution failures affect assembly. |
| cli/…/remote.go | Shows the remote attestor identity handshake and RPC access used by relay work. |
| cli/…/signer.go | Defines the local and remote signer contract and alias-based signer set. |
| cli/…/remote.go | Shows remote key discovery and signing through the common signer contract. |
| cli/…/server.go | Defines server registration, transport support, request limits, observability wrapping, reflection, and shutdown. |
| cli/…/health.go | Defines liveness, named readiness, aggregate readiness, timeouts, and shutdown state. |
| cli/…/relayer_handler.go | Shows the relayer RPC-to-service boundary, packet selection reporting, and error mapping. |
| cli/…/attestor_handler.go | Shows the attestor RPC-to-service boundary and error mapping. |
| cli/…/server_test.go | Illustrates health behavior during startup, dependency failure, timeout, cancellation, and shutdown. |
| link/…/validate.go | Gives the top-level live validation sequence. |
| link/…/connections.go | Shows the two-way on-chain connection check. |
| cli/…/quorum.go | Shows how live validation resolves all attestors and checks quorum readiness. |
| proto/…/relayer.proto | Defines the public relay and packet-query RPC contract. |
| proto/…/attestor.proto | Defines the public attestation RPC contract. |