MsgRegisterInterchainAccount
An Interchain Accounts channel handshake can be initiated using MsgRegisterInterchainAccount:
Owneris an empty string or contains more than 2048 bytes.ConnectionIDis invalid (see 24-host naming requirements).
MsgChannelOpenInit on chain and route it to the core IBC message server to initiate the opening step of the channel handshake.
The controller submodule will generate a new port identifier. The caller is expected to provide an appropriate application version string. For example, this may be an ICS-27 JSON encoded Metadata type or an ICS-29 JSON encoded Metadata type with a nested application version.
If the Version string is omitted, the controller submodule will construct a default version string in the OnChanOpenInit handshake callback.
ChannelID and PortID are returned in the message response.
MsgSendTx
An Interchain Accounts transaction can be executed on a remote host chain by sending a MsgSendTx from the corresponding controller chain:
Owneris an empty string or contains more than 2048 bytes.ConnectionIDis invalid (see 24-host naming requirements).PacketDatacontains anUNSPECIFIEDtype enum, the length ofDatabytes is zero or theMemofield exceeds 256 characters in length.RelativeTimeoutis zero.
PacketData and send it via the channel associated with the Owner and ConnectionID.
The PacketData is expected to contain a list of serialized []sdk.Msg in the form of CosmosTx. Please note the signer field of each sdk.Msg must be the interchain account address.
When the packet is relayed to the host chain, the PacketData is unmarshalled and the messages are authenticated and executed.
Sequence is returned in the message response.
Queries
It is possible to useMsgModuleQuerySafe to execute a list of queries on the host chain. This message can be included in the list of encoded sdk.Msgs of InterchainPacketData. The host chain will return on the acknowledgment the responses for all the queries. Please note that only module safe queries can be executed (deterministic queries that are safe to be called from within the state machine).
The queries available from Cosmos SDK are:
MsgModuleQuerySafe can be used to query the account balance of an account on the host chain. The resulting packet data variable is used to set the PacketData of MsgSendTx.
Atomicity
As the Interchain Accounts module supports the execution of multiple transactions using the Cosmos SDKMsg interface, it provides the same atomicity guarantees as Cosmos SDK-based applications, leveraging the CacheMultiStore architecture provided by the Context type.
This provides atomic execution of transactions when using Interchain Accounts, where state changes are only committed if all Msgs succeed.