On Cosmos
Cosmos SDK Modules handle custom message types that modify and update state on a block chain. The module decodes the tx, extracts and routes message(s), routes to the correct module to be processed and returns the result of the committed state change to Tenderment consensus engine. Multistore persist state in KVStores and only accepts a [ ] byte, needs to be marshelled using a codec before being stored.
The modules transcations and queries can be accessed via CLI (cobra), REST and GRPC Services defined proto.
Cosmos SDK is the framework used for building application specific blockchain networks.
IBC is like TCP/IP for Blockchain Networks.
To learn more see ibcprotocol.org
Interoperability is a key component for developing the next generation of blockchain and cryptographic networks by having traversable and configurable chains that have metadata that is immutable but data that is mutable.
Metadata can control governance structures, consensus algos, modifications for different type of blockchain transaction mechanisms and other types of modules.
The inter-blockchain communication protocol is a catalyst for the polycentric interchain.
Different application specific blockchain networks are going in to be used in different use cases.
The Problem: Before IBC, blockchains cannot talk to each other, transfer packets, between blockchains such as token transfers, signatures, votes and other types of transactions. Currently all of the assets on different chains are siloed.
The Solution: IBC is a messaging protocol for the interchain. Authenticated, Ordered and Route topology between networks. IBC enables chain innovation and continuous innovation across multiple state machines.
IBC ecosystem:
IBC/APP: Application-layer packet semantics.
Relayer during the hackathon. Application layer protocols sit on top of IBC. Cross-Chain account abstraction: delegate control to another chain. What state machine interacts. Interchain code relocation: transport contracts in packets.
IBC/TAO: Transport, authencation ordering.
Transport data, assets, tokens from one zone to another another.
Authenticating that the data came from this Blockchain and is going to a different blockchain network or state machine.
Authenticating that data came from another Blockchain network is interacting with a contract on another Blockchain.
The Ordering abstraction allows to reason about the ordering of the transactions.
IBC Protocol Stack consist of clients, connections, channels, packets, and modules:
Client: verifying consensus transcripts
Connections: associating two chains. Created with a handshake. Paired set of identifiers.
Channels: data pipe between two modules. Channels handle Ordering Semantics and routing Semantics. Smart Contracts. Agoric’s JavaScript contracts on Swingset. Transfer of data between modules on different chains.
Packets: Where the action happens. The core messages, can contain different types of data. Token transfers, votes, etc. analogous to the core.
Flow
transfer from one to another.
start a transfer on one chain
Send an outgoing queue on the other
message on the other chain to receive that data
and client to verify data
send an acknowledgement that it completed
time out packets as well
after certain amount of blocks that packet can timeout
Module A wants to send some packet Module B on another. A relayer does the physical transfer. Routes it to Chain B. It goes to the module via Cosmos IBC.
The IBC Module
Bind to ports
Define packet data
Define acknowledgment structs
Implement the IBC Module interface
The IBC Callbacks
Channel Handshake Execution
ChanOpenInit
ChanOpenTry
ChanOpenAck
What application data is being sent over the channel, how to encode (before sending through IBC) and decode it.
Sending Packets
IBCChannelKeeper.SendPacket
Receiving Packets
OnRecvPacket
Acknowledgment
OnAcknowledgmentPacket
Use Protobuf services to define state transitions. Modelized as a Protobuf service, with a method request, and an (optionally empty) method response.
make proto-gen -> *.pb.go