Skip to content
This repository was archived by the owner on Oct 30, 2023. It is now read-only.

IBC channel verification

CyberHoward edited this page Apr 10, 2023 · 4 revisions

IBC basics

There are three key components to IBC.

  1. Clients: Light-client of a different blockchain. Can expire and be re-enabled after a governance vote.
  2. Connections: Connects two chains by establishing identities and preventing malicious interactions.
  3. Channels: Application-level connections. Handle packet processing. Channels can be closed through the application layer if implemented.

In CosmWasm item 3. need to be handled. Clients and Connections are maintained by the chain's relayers.

Account Identification

An Account ID is assigned to each Account and specifies the origin and unique identifier of the account. The origin of the account is an optional string that corresponds to the network id.

Connection creation

Abstract allows for channels between its client and host and stores these to be used for account resolution. Because of IBC's design there is no way to easily restrict channel creation between contracts, thus it is hard to verify the source of the connection.

In order for us to have the ability to easily query accounts related to an account on a different chain we need to select the connection and source port on the host side while selecting a connection and destination port on the client side.

On the host side the following state is stored:

/// ((connection-id, client-addr)) -> chain-id) 
pub const CLIENT_CHAINS: Map<(String,String), String> = Map::new("chns");
/// (chain-id,account_id) -> client_proxy_addr
pub const CLIENT_ACCOUNTS: Map<(&str, u32), String> = Map::new("clacc");

On the client side a similar store is present:

/// host_chain -> channel-id
pub const HOST_CHAINS: Map<&str, String> = Map::new("chns");
/// (chain-id,account_id) -> remote_addr
pub const ACCOUNTS: Map<(&str, AccountId), AccountData> = Map::new("accounts");

Clone this wiki locally