Synopsis
Learn how to define custom packet and acknowledgement structs and how to encode and decode them.Pre-requisite readings
Custom packets
Modules connected by a channel must agree on what application data they are sending over the channel, as well as how they will encode/decode it. This process is not specified by IBC as it is up to each application module to determine how to implement this agreement. However, for most applications this will happen as a version negotiation during the channel handshake. While more complex version negotiation is possible to implement inside the channel opening handshake, a very simple version negotiation is implemented in the ibc-transfer module. Thus, a module must define its custom packet data structure, along with a well-defined way to encode and decode it to and from[]byte.
Note that the CustomPacketData struct is defined in the proto definition and then compiled by the protobuf compiler.
Then a module must encode its packet data before sending it through IBC.
PacketData into a structure it expects so that it can
act on it.