Skip to main content
Version: v7.8.x

09-localhost

Overview

Synopsis

Learn about the 09-localhost light client module.

The 09-localhost light client module implements a localhost loopback client with the ability to send and receive IBC packets to and from the same state machine.

Context

In a multichain environment, application developers will be used to developing cross-chain applications through IBC. From their point of view, whether or not they are interacting with multiple modules on the same chain or on different chains should not matter. The localhost client module enables a unified interface to interact with different applications on a single chain, using the familiar IBC application layer semantics.

Implementation

There exists a single sentinel ClientState instance with the client identifier 09-localhost.

To supplement this, a sentinel ConnectionEnd is stored in core IBC state with the connection identifier connection-localhost. This enables IBC applications to create channels directly on top of the sentinel connection which leverage the 09-localhost loopback functionality.

State verification for channel state in handshakes or processing packets is reduced in complexity, the 09-localhost client can simply compare bytes stored under the standardized key paths.

Localhost vs regular client

The localhost client aims to provide a unified approach to interacting with applications on a single chain, as the IBC application layer provides for cross-chain interactions. To achieve this unified interface though, there are a number of differences under the hood compared to a 'regular' IBC client (excluding 06-solomachine and 09-localhost itself).

The table below lists some important differences:

Regular clientLocalhost
Number of clientsMany instances of a client type corresponding to different counterpartiesA single sentinel client with the client identifier 09-localhost
Client creationRelayer (permissionless)ClientState is instantiated in the InitGenesis handler of the 02-client submodule in core IBC
Client updatesRelayer submits headers using MsgUpdateClientLatest height is updated periodically through the ABCI BeginBlock interface of the 02-client submodule in core IBC
Number of connectionsMany connections, 1 (or more) per clientA single sentinel connection with the connection identifier connection-localhost
Connection creationConnection handshake, provided underlying clientSentinel ConnectionEnd is created and set in store in the InitGenesis handler of the 03-connection submodule in core IBC
CounterpartyUnderlying client, representing another chainClient with identifier 09-localhost in same chain
VerifyMembership and VerifyNonMembershipPerforms proof verification using consensus state rootsPerforms state verification using key-value lookups in the core IBC store
IntegrationExpected to register codec types using the AppModuleBasic interfaceRegisters codec types within the core IBC module