Client lifecycle and verification
An IBC client stores a trusted view of a counterparty chain. Core IBC creates and advances that view, stops using it when it is unsafe or stale, and asks the selected light client to verify remote state before it accepts handshakes, packets, or timeouts.
Client trust model
Client state
Client state defines how a light client judges a counterparty and records the latest height that it represents. A light client is the client-specific trust rule that turns counterparty evidence into an accepted or rejected state change.
Each client has an identifier in the form <client-type>-<sequence>. The type selects the light client module. The sequence gives each client instance its own namespace. A client type must also be allowed by the client parameters before core IBC can use it.
References: modules/…/client.go• L97-119 modules/…/params.go• L30-49 modules/…/keeper.go• L71-90
Consensus state
Consensus state is the trusted snapshot for one counterparty height. It normally provides the data needed to identify a state root and its time. A client can retain many snapshots because later proof checks can need an older height.
Core IBC keeps client state separate from height-tagged consensus states. Queries and genesis data preserve the height with each consensus state so a caller can select the needed snapshot.
References: modules/…/client.go• L130-151 proto/…/client.proto• L21-36 modules/…/keeper.go• L143-160
Revision-aware height
An IBC height contains a revision number and a revision height. The revision number keeps height order valid when a chain resets its block height after a state-machine change.
Light clients use this order to reject evidence that is too new or too old for the client. They also use it to select the consensus state that supports a proof. A zero height means that no usable height was supplied.
References: proto/…/client.proto• L39-60 modules/…/height.go• L50-72 modules/…/height.go• L121-153
Client lifecycle
The lifecycle starts with an initial trust anchor and advances through verified counterparty evidence. Core IBC controls the common order of checks. The selected light client controls the trust rules and the client-specific state changes.
This diagram shows the main client states and transitions.
flowchart LR
A[Create client] --> B[Active client]
B --> C[Verify client message]
C -->|safe| D[Store consensus state]
C -->|verified misbehaviour| E[Frozen or unusable client]
B --> F[Proof-backed upgrade]
B --> G[Expired or unusable client]
E --> H[Recovery when supported]
G --> H
D --> B
Client creation
Creation accepts an initial client state and consensus state. Core IBC rejects the reserved localhost type, creates a new identifier, routes the type to its light client module, and accepts the client only when that module reports Active.
The initial pair is the trust anchor for later updates and proof checks. The transaction handler also records the creator. IBC v2 uses that record when the same creator registers counterparty information.
References: modules/…/client.go• L15-46 modules/…/msg_server.go• L30-53 modules/…/msgs.go• L47-112 proto/…/tx.proto• L42-62
Client updates
An update carries a client message. This is client-family evidence such as a header, a batch of headers, or misbehaviour evidence. Core IBC routes the message by client identifier and requires an active client before it calls the light client.
The light client verifies the message first. If the evidence is safe, it stores any new consensus states and may advance the latest height. An older valid update can fill a missing consensus snapshot without moving the latest height. A duplicate snapshot can have no effect.
References: modules/…/client.go• L49-85 modules/…/client.go• L54-69 modules/…/msgs.go• L114-148 modules/…/msg_server.go• L80-102
Misbehaviour handling
Misbehaviour is verified evidence that the counterparty supplied conflicting or unsafe information. The exact test belongs to the client family, but the common result is that the client becomes unavailable for normal IBC work.
Core IBC does not apply a normal update after verified misbehaviour. It calls the light client’s misbehaviour handler instead. The client remains in state so queries and operators can observe its frozen status.
References: modules/…/client.go• L54-69 modules/…/client.go• L60-75 modules/…/events.go• L79-92
Client upgrades
An upgrade replaces the client and consensus state after the old client verifies proofs that the counterparty committed to both new states. The light client must also bind the upgrade to the planned final height of the old chain revision.
A separate chain software upgrade prepares this trust data. Governance schedules the plan and the upgraded client state. At the last block before the upgrade, the client module stores the final consensus information so a client on the counterparty can verify the first block of the new chain.
References: modules/…/client.go• L88-115 modules/…/client.go• L113-127 modules/…/keeper.go• L489-516 modules/…/abci.go• L13-35 modules/…/msgs.go• L150-215
Client recovery
Recovery replaces an unusable subject client with state from an active substitute of the same client family. The substitute must represent a strictly greater latest height. The light client decides how to compare and copy the client-specific state.
Recovery is an authority-controlled transaction path, and it is not available to every client family. It is therefore a trust-rule operation, not an administrative bypass around normal client checks.
References: modules/…/client.go• L118-164 modules/…/msg_server.go• L127-138 modules/…/client.go• L109-111 modules/…/msgs.go• L217-245
Client availability and routing
Client status
Status tells core IBC whether a client can protect new IBC work. Active permits updates, upgrades, and proof checks. Frozen records misbehaviour. Expired means that the client’s trust window has passed. Unknown means that the module cannot determine the status. Unauthorized means that the client type is not currently allowed.
The light client owns the status rule. Core IBC applies one common boundary: every status other than Active blocks normal client use. Removing a type from the allowed-client parameter therefore disables its use even when its stored state remains present.
References: modules/…/client.go• L11-44 modules/…/keeper.go• L427-435 modules/…/client.go• L50-58 proto/…/client.proto• L62-68
Client type routing
Routing maps a client type to its light client module. Core IBC parses the client identifier, checks the allowed-client parameter, and then selects the registered module. This lets one lifecycle serve different trust systems without interpreting their evidence.
Each client receives an isolated store namespace. The light client can keep its own metadata beside the common client and consensus state without crossing into another client’s state.
References: modules/…/router.go• L11-52 modules/…/keeper.go• L71-90 modules/…/store.go• L18-38 modules/…/keeper.go• L419-425
Light client contract
Light client module contract
LightClientModule is the boundary between core IBC and each light client family. It covers initialization, message verification, misbehaviour handling, state updates, status, height and time lookup, recovery, upgrades, and proof checks.
Core IBC supplies the client identifier and request inputs. The module reads and writes the client’s state under its own trust rules. A native module and a contract-backed module can use different execution models while presenting the same core-facing contract.
References: modules/…/client.go• L46-127 modules/…/client.go• L49-115 modules/…/store.go• L18-38
Shared state and message interfaces
The shared interfaces define three kinds of client input. ClientState describes trust settings and the latest height. ConsensusState describes trusted counterparty data at one height. ClientMessage carries evidence for an update or a misbehaviour decision.
These values are carried through protocol messages and queries as typed interface values. This lets different client families use the same transaction and query shapes without sharing their trust model.
References: modules/…/client.go• L130-161 modules/…/client.go• L28-49 modules/…/msgs.go• L47-100 modules/…/query.go• L18-67
Client family boundaries
Client families share the lifecycle contract but differ in the evidence they trust, the data they store, and the lifecycle operations they support.
| Client family | Trust evidence | Lifecycle boundary |
|---|---|---|
| Tendermint | Signed chain headers and a trusted state root | Supports expiry, misbehaviour freezing, recovery, and proof-backed upgrades |
| Wasm | A verified light-client contract | The contract owns client-specific verification and state changes; its code checksum must be trusted before use |
| Solo machine | Signed messages from one machine | Uses sequence and signature checks; client upgrades are not supported |
| Attestations | Threshold-signed attestations | Uses attestation checks and freezing; recovery and upgrades are not supported |
Core IBC must call the selected module instead of interpreting client state itself. See IBC light clients for the client-family view.
References: modules/…/client.go• L46-127 modules/…/router.go• L11-52
Proof verification
Membership and non-membership proofs
Proof verification asks whether a value exists at a standard IBC commitment path at a trusted counterparty height. Membership proves that a key has a value. Non-membership proves that the key has no value. These checks support connection, channel, packet, acknowledgement, and timeout flows.
The caller supplies the client, height, delay periods, proof, path, and membership value. The light client selects the trusted consensus state and checks the proof against its commitment root or equivalent evidence.
References: modules/…/client.go• L71-94 modules/…/keeper.go• L336-362 modules/…/commitment.go• L10-32
Proof timing and height
A proof needs a stored consensus state at the requested height. The client must also have reached that height. Packet-related checks can require time and block delays, which are measured from metadata associated with the trusted state.
The path follows the IBC commitment contract, while the light client decides how to interpret the proof and its root. The query proof interface rejects an empty proof, zero proof height, empty path, or empty membership value before it delegates to the client. It runs verification in a cached context so proof checks do not change state.
References: modules/…/grpc_query.go• L361-435 modules/…/keeper.go• L336-362 modules/…/commitment.go• L21-32 proto/…/query.proto• L241-265
Downstream IBC checks
Connections and channels use client proofs to confirm that the counterparty committed to the expected state. Packet receive, acknowledgement, and timeout flows use the same client boundary to check commitments, receipts, acknowledgements, or their absence.
This makes client freshness and status a system-wide concern. A frozen, expired, unauthorized, or incomplete client cannot protect a new handshake or packet action. See connection handshake, channel and packet lifecycle, core state and keeper, and core IBC protocol for the main consumers.
References: modules/…/keeper.go• L336-362 modules/…/client.go• L96-107 proto/…/query.proto• L73-80
IBC v2 client metadata
Counterparty registration
IBC v2 adds counterparty information beside the shared client state. It records the counterparty’s commitment prefix and client identifier so v2 packet messages can address the correct remote client.
The same creator that created the client must register this information, and registration can happen only once. Successful registration also enables the v2 packet sequence for that client. The data uses the existing per-client namespace and is included in v2 genesis state.
References: modules/…/msg_server.go• L55-77 modules/…/keeper.go• L29-45 proto/…/counterparty.proto• L9-15 modules/…/genesis.go• L14-42
Client relay configuration
IBC v2 can attach a per-client allowlist of relayer addresses. An empty configuration permits permissionless v2 relaying. A non-empty configuration restricts client updates to the listed relayers.
The client creator or chain authority can change this configuration. When v2 is enabled, the transaction handler checks it before it sends an update to the light client. This adds an authorization gate without changing the light client verification contract.
References: proto/…/config.proto• L9-16 modules/…/config.pb.go• L25-32 modules/…/msg_server.go• L80-102 modules/…/msg_server.go• L649-663
State export and query surface
Client queries
The query surface exposes client state, consensus state at a chosen height, all stored consensus heights, status, creator, parameters, and prepared upgrade state. These views let relayers and operators determine whether a client can verify a proof and which trusted snapshot to use.
The proof query exposes membership verification as a safe query. It reports whether the light client accepts the proof and charges for the underlying state access, while discarding state changes made during verification.
References: modules/…/grpc_query.go• L43-71 modules/…/grpc_query.go• L120-164 modules/…/grpc_query.go• L250-328 modules/…/grpc_query.go• L361-435 proto/…/query.proto• L17-80
Genesis state
Genesis state preserves the client set, height-tagged consensus states, client metadata, allowed-client parameters, and the next identifier sequence. Validation keeps these records linked: every consensus state and metadata entry must belong to a known client, and the client and consensus types must agree.
This preserves the trust view across export and import. IBC v2 adds its counterparty records as a separate genesis state linked by client identifier.
References: modules/…/genesis.go• L77-111 modules/…/genesis.go• L114-210 proto/…/genesis.proto• L12-46 proto/…/genesis.proto• L12-25
Change checklist
When these files or sections are changed, remember to consider these:
- Changes to
LightClientModulemethods must preserve the order inKeeper.UpdateClient: verify the message before misbehaviour detection or state mutation. - Changes to client identifiers or the allowed-client parameter must keep identifier validation, module routing, status queries, and genesis validation aligned.
- Changes to consensus-state height or timestamp handling must preserve both proof lookup and packet timeout delay checks.
- Changes to upgrade proofs or software-upgrade scheduling must keep the old client’s final height bound to the new client and consensus state.
- Changes to client-specific metadata must keep creation, recovery, v1 genesis import/export, and v2 per-client state in agreement.
- Changes to the shared
ClientState,ConsensusState,ClientMessage,Height, orPathinterfaces must remain compatible with native and contract-backed light clients. - Changes to v2 counterparty registration or relayer configuration must preserve creator and authority checks, client-ID links, and v2 packet authorization.
Important failure modes
| Trigger | Consequence | Guard |
|---|---|---|
| Client type is not allowed, has no route, or is the reserved localhost type | Creation, updates, and proof checks fail before the light client can protect IBC state | Keep type validation, the allowlist, registered routes, and reserved-type rules aligned |
| Update message fails client verification | No client state change occurs | Treat VerifyClientMessage as the trust gate |
| Verified conflicting evidence is submitted | The client becomes frozen and normal IBC use stops | Route verified misbehaviour to UpdateStateOnMisbehaviour instead of UpdateState |
| Proof height is newer than the client or has no consensus state | Membership or non-membership verification fails | Update the client first and retain the required consensus snapshot |
| Proof delay has not passed | Packet-related proof checks fail until the required time and blocks pass | Preserve processed time and height metadata for each consensus state |
| Upgrade state is not committed at the old client’s final height | The client cannot safely cross the counterparty chain revision | Bind upgrade proofs to the planned upgrade height |
| A client is frozen, expired, or unauthorized | Core IBC rejects updates or proof checks | Query status before relying on the client for downstream protocol work |
| Recovery uses an active subject, an inactive substitute, an equal or lower height, or a different client family | The unusable subject client is not replaced | Require a non-active subject and an active same-family substitute with a greater height |
| V2 counterparty data is registered by a different creator or registered twice | Counterparty packet setup fails | Preserve the creator check and one-time registration rule |
| A v2 update signer is not in the configured allowlist | The update is rejected before light client verification | Keep the per-client configuration and relayer authorization check aligned |
Key files
| File | Why to read it |
|---|---|
| modules/…/client.go | Shows the shared create, update, misbehaviour, upgrade, and recovery lifecycle. |
| modules/…/client.go | Defines the module and state interfaces shared by core IBC and light clients. |
| modules/…/keeper.go | Shows routing, client stores, state access, status, upgrade preparation, and proof delegation. |
| modules/…/msgs.go | Defines transaction contracts for creation, updates, upgrades, recovery, and parameter changes. |
| modules/…/client.go | Shows how identified client state and height-tagged consensus state cross the protocol boundary. |
| modules/…/grpc_query.go | Shows the query view of client state, consensus state, status, upgrade state, and proof verification. |
| modules/…/genesis.go | Defines the relationships that must remain valid across state export and import. |
| modules/…/abci.go | Shows how a planned chain upgrade publishes the final consensus trust data. |
| modules/…/msg_server.go | Shows transaction authorization and the bridge from core messages to client lifecycle operations. |
| modules/…/keeper.go | Shows how v2 counterparty data and relayer configuration attach to each client. |
| modules/…/msgs.go | Defines v2 counterparty registration and per-client configuration contracts. |
| modules/…/commitment.go | Defines the shared commitment root, prefix, and path types used by proof checks. |
| proto/…/client.proto | Defines the common client, consensus-state, height, and parameter data shapes. |
| proto/…/tx.proto | Defines the public lifecycle message and response shapes. |
| proto/…/query.proto | Defines the public client and proof query surface. |
| proto/…/counterparty.proto | Defines the v2 counterparty information stored per client. |
| proto/…/config.proto | Defines the v2 per-client relayer policy. |