> ## Documentation Index
> Fetch the complete documentation index at: https://cosmos-docs-cosmjs-docs.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# ClientState

> The 09-localhost ClientState maintains a single field used to track the latest sequence of the state machine i.e. the height of the blockchain.

The 09-localhost `ClientState` maintains a single field used to track the latest sequence of the state machine i.e. the height of the blockchain.

```go theme={"system"}
type ClientState struct {
  / the latest height of the blockchain
  LatestHeight clienttypes.Height
}
```

The 09-localhost `ClientState` is instantiated in the `InitGenesis` handler of the 02-client submodule in core IBC.
It calls `CreateLocalhostClient`, declaring a new `ClientState` and initializing it with its own client prefixed store.

```go theme={"system"}
func (k Keeper)

CreateLocalhostClient(ctx sdk.Context)

error {
    var clientState localhost.ClientState
  return clientState.Initialize(ctx, k.cdc, k.ClientStore(ctx, exported.LocalhostClientID), nil)
}
```

It is possible to disable the localhost client by removing the `09-localhost` entry from the `allowed_clients` list through governance.

## Client updates

The latest height is updated periodically through the ABCI [`BeginBlock`](/sdk/v0.53/build/building-modules/beginblock-endblock) interface of the 02-client submodule in core IBC.

[See `BeginBlocker` in abci.go.](https://github.com/cosmos/ibc-go/blob/v8.5.0/modules/core/02-client/abci.go#L12)

```go theme={"system"}
func BeginBlocker(ctx sdk.Context, k keeper.Keeper) {
  / ...
    if clientState, found := k.GetClientState(ctx, exported.Localhost); found {
    if k.GetClientStatus(ctx, clientState, exported.Localhost) == exported.Active {
    k.UpdateLocalhostClient(ctx, clientState)
}
 
}
}
```

The above calls into the 09-localhost `UpdateState` method of the `ClientState` .
It retrieves the current block height from the application context and sets the `LatestHeight` of the 09-localhost client.

```go theme={"system"}
func (cs ClientState)

UpdateState(ctx sdk.Context, cdc codec.BinaryCodec, clientStore sdk.KVStore, clientMsg exported.ClientMessage) []exported.Height {
    height := clienttypes.GetSelfHeight(ctx)

cs.LatestHeight = height

  clientStore.Set(host.ClientStateKey(), clienttypes.MustMarshalClientState(cdc, &cs))

return []exported.Height{
    height
}
}
```

Note that the 09-localhost `ClientState` is not updated through the 02-client interface leveraged by conventional IBC light clients.
