Cosmos SDK Encoding
The Cosmos SDK utilizes two binary wire encoding protocols, Amino which is an object encoding specification, and Protocol Buffers, a subset of Proto3 with an extension for interface support.
Due to Amino having significant performance drawbacks, being reflection-based, and not having any meaningful cross-language/client support, Protocol Buffers, specifically gogoprotobuf, are being used in place of Amino. Note that this process of using Protocol Buffers over Amino is still an ongoing process.
Binary wire encoding of types in the Cosmos SDK can be broken down into two main categories, client encoding and store encoding. Client encoding mainly revolves around transaction processing and signing, whereas store encoding revolves around types used in state-machine transitions and what is ultimately stored in the Merkle tree.
For store encoding, protobuf definitions can exist for any type and will typically have an Amino-based "intermediary" type. Specifically, the protobuf-based type definition is used for serialization and persistence, whereas the Amino-based type is used for business logic in the state-machine where they may convert back-n-forth. You must take note of the Amino-based types, which may slowly be phased out in the future, so developers should take note to use the protobuf message definitions where possible.
More reading at:
Last updated