Introducing a new way to review your PRs.

Read the announcement

lfdt-ibc / ibc-go

Inter-Blockchain Communication Protocol (IBC) implementation in Golang.

View on GitHub

20 documents · Updated Nov 13, 2026

docs / interchain-accounts

Interchain accounts

Interchain accounts implement the ICS-27 pattern for controlling an account on one chain from another chain through IBC. A controller chain opens the relationship and sends work. A host chain owns the account and runs approved Cosmos SDK messages under that account's address. This page complements IBC application modules, token transfer, general message passing, packet forwarding, and callbacks and rate limiting.

Controller and host responsibilities

The controller and host are two roles in one cross-chain account relationship. The controller starts the channel and requests work. The host creates the account, checks each request, and applies the work to its own state.

RoleMain responsibilityChannel behavior
Controller chainRegister an account relationship, track its channel, and send transaction packetsStarts the handshake and sends packets
Host chainCreate or recover the account, track its address, and execute approved messagesAccepts the handshake and receives packets

The controller can serve applications through its direct message service. It can also run as middleware for a legacy authentication application that needs packet callbacks. The host is an IBC application for the host side of the channel. It does not originate packets or process acknowledgements and timeouts as a sender.

References: modules/…/ibc_middleware.go• L27-49 modules/…/ibc_middleware.go• L195-269 modules/…/ibc_module.go• L26-35 modules/…/ibc_module.go• L140-158

Account registration

Registration turns a controller-side owner and an IBC connection into a usable remote account. The owner is an identifier used to derive the controller port. It is not a private key for the host account.

The normal registration flow is:

  1. The controller receives MsgRegisterInterchainAccount with an owner, connection, optional version, and channel ordering.
  2. The controller derives a port with the icacontroller- prefix and starts ChanOpenInit toward the fixed icahost port.
  3. The host accepts ChanOpenTry, checks the relationship metadata, and creates the account if the relationship has no account.
  4. The host returns the account address in the accepted channel version.
  5. The controller accepts ChanOpenAck and stores the active channel and returned address.
  6. The host accepts ChanOpenConfirm and stores the active channel on its side.

This diagram shows how registration produces both an active channel and a host account address.

sequenceDiagram
    participant C as Controller chain
    participant I as IBC channel
    participant H as Host chain
    C->>C: Derive controller port from owner
    C->>I: ChanOpenInit
    I->>H: ChanOpenTry
    H->>H: Validate metadata and create or recover account
    H-->>I: ChanOpenTry response with account address
    I-->>C: ChanOpenAck
    C->>C: Store active channel and account address
    I->>H: ChanOpenConfirm
    H->>H: Store active channel

The direct message service is the normal registration path. The older keeper API enables callback routing to an underlying authentication application and remains only for that compatibility use case.

References: modules/…/msgs.go• L31-59 modules/…/msg_server.go• L29-61 modules/…/account.go• L17-33 modules/…/handshake.go• L16-92 modules/…/handshake.go• L95-112

Remote transaction execution

Remote execution lets the controller ask the host to run one or more Cosmos SDK messages as the interchain account. The host uses the stored account address as the signer, so the controller does not provide a host private key.

The controller sends an EXECUTE_TX packet. The packet carries a list of encoded messages and may carry a memo. The host performs these checks before changing state:

  • The packet can be decoded and has a supported action.
  • Each message type is in the host allowlist.
  • Every message signer is the registered interchain account address for the source port and connection.
  • Each message has a valid route and passes its basic validation.

The host runs the complete message list in a temporary state view. It commits that view only when every message succeeds. A successful acknowledgement carries transaction response data. A failed acknowledgement carries the error and leaves the host state unchanged for that packet.

The host allowlist is the main policy boundary for remote work. It can name selected message type URLs or use the wildcard setting to allow all host message types. Separate controller and host enable settings can disable the two roles.

References: modules/…/msg_server.go• L64-81 modules/…/relay.go• L19-49 modules/…/relay.go• L51-95 modules/…/relay.go• L97-128 modules/…/params.go• L11-51

Packet handling

ICA packets carry an envelope rather than a complete signed transaction. The envelope identifies the action, carries encoded transaction data, and may carry application data in a memo. The supported action is EXECUTE_TX.

When the controller sends a packet, it uses the open active channel and a future absolute timeout. The host handles the packet during IBC receive processing and returns the acknowledgement during that processing. The controller does not receive a normal packet on this channel. It handles acknowledgements and timeouts for packets that it sent. In legacy mode, those callbacks can continue to an attached authentication application.

An ordered-channel timeout closes the channel under IBC channel rules. The relationship can be used again only after a new handshake restores an active channel.

References: modules/…/relay.go• L16-55 modules/…/ibc_middleware.go• L195-257 modules/…/ibc_module.go• L111-158 modules/…/packet.go• L22-50

State model

The relationship is identified by a controller port and an IBC connection. Both chains map that relationship to an active channel. The host also stores the account object. The controller stores the address returned by the host.

StateController chainHost chain
PortA registered port derived from the ownerThe fixed host port icahost
Active channelChannel for the connection and controller portChannel for the host connection and counterparty port
Account mappingHost account address for the relationshipHost account address for the relationship
Account objectNot created locally by ICAAn SDK account with the controller port recorded as its owner
Callback modeWhether legacy underlying-application callbacks are enabledNot applicable

An interchain account behaves as an SDK account on the host but has no local public key. Its address is derived for the host relationship. When a channel is reopened, the host recovers the existing account and address instead of creating a new account.

Channel close confirmation does not erase the relationship records. A replacement channel must wait until the old channel is closed. The account address remains the same while the active channel mapping moves to the replacement channel.

References: modules/…/keeper.go• L120-217 modules/…/keeper.go• L124-235 modules/…/account.go• L14-36 modules/…/account.go• L46-97 modules/…/keys.go• L32-70

Version negotiation

The channel version is a JSON-encoded metadata record. It lets both chains agree on how to interpret packets and which account relationship the channel serves. Each side validates the record during the handshake before it treats the channel as active.

The metadata contract contains:

  • The ICS-27 protocol version.
  • The controller and host connection identifiers.
  • The host interchain account address.
  • The message encoding.
  • The transaction type.

The current protocol version is ics27-1. The current transaction type is sdk_multi_msg. The supported encodings are proto3 and proto3json. The controller validates the connection identifiers and host port. The host fills in its connection identifier and account address before it returns the accepted version.

On channel reopening, the host restores the existing account address. The controller requires the prior protocol, connection, encoding, and transaction fields to match. The address is supplied again by the host. Channel ordering must remain the same when a relationship is reopened.

Channel upgrades can change the supported transaction type or encoding. They must preserve the account address, both connection identifiers, and the ICS-27 protocol version. This keeps an upgrade tied to the same remote account rather than creating a new relationship.

References: modules/…/metadata.go• L16-24 modules/…/metadata.go• L38-116 modules/…/handshake.go• L18-87 modules/…/handshake.go• L141-259 modules/…/handshake.go• L20-92

Change checklist

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

  • Keep controller and host metadata validation aligned. A change to the protocol version, connection fields, encoding, or transaction type affects both handshake sides.
  • Keep the controller port and host account mapping rules aligned. Registration, reopening, signer checks, and active-channel lookup use the same relationship key.
  • Keep packet decoding aligned with the negotiated encoding and transaction type. A packet can pass channel setup and still fail during host receive if these contracts drift.
  • Review the host message allowlist when a new message path becomes a supported remote operation. The allowlist uses message type URLs.
  • Preserve the account address and connection identifiers during channel upgrades and reopening. Changing them can strand the existing account or make the chains select different relationships.
  • Treat legacy controller callback routing as a separate compatibility path. Changes to direct message service behavior must not silently change callback delivery for legacy users.

Important failure modes

TriggerConsequenceGuard
Registration uses a non-ICA controller port or the wrong host portThe channel handshake is rejectedController and host handshake callbacks validate the port roles
A second channel is opened while the relationship is activeRegistration fails and no new active channel is selectedBoth sides allow one open active channel for a relationship
Metadata names an unsupported version, encoding, or transaction typeThe handshake or channel upgrade failsBoth sides validate metadata before activation
A packet message is not in the host allowlistThe host returns an error acknowledgement and commits no message stateHost parameters define the allowed message type URLs
A packet message has a signer other than the registered accountThe host rejects the complete transactionHost authentication compares every message signer with the stored account address
A packet times out on an ordered channelIBC closes the channel and later sends cannot use itReopen the relationship with a new channel and compatible metadata
A host message fails after an earlier message succeedsNo message state from that packet is committedHost execution uses an atomic temporary state view

Key files

FileWhy to read it
modules/…/msg_server.goShows the public controller actions for registration and transaction sending.
modules/…/handshake.goShows controller-side channel validation, reopening, and version rules.
modules/…/relay.goShows controller packet sending and timeout behavior.
modules/…/ibc_middleware.goShows the direct-versus-legacy integration boundary and controller callbacks.
modules/…/handshake.goShows host-side account creation, recovery, and channel confirmation.
modules/…/relay.goShows packet decoding, signer checks, message execution, atomic state changes, and acknowledgements.
modules/…/ibc_module.goShows host receive behavior and the one-way channel rules.
modules/…/metadata.goDefines the channel version contract and its validation rules.
modules/…/packet.goDefines packet validation, sender data, and memo behavior.
modules/…/account.goDefines host account identity and account restrictions.
modules/…/keeper.goShows controller relationship state and active-channel lookups.
modules/…/keeper.goShows host relationship state, account mappings, and host parameters.
proto/…/tx.protoDefines the controller registration and send-transaction interface.
proto/…/metadata.protoDefines the metadata fields exchanged during channel setup.
proto/…/packet.protoDefines the packet action and transaction envelope.