cosmos-sdk

What does the bytes (like `0x34`) mean in the module specs?


In the specs of the Cosmos SDK, what does the byte 0x34 in a line like this mean?

Redelegations: 0x34 | DelegatorAddr | ValidatorSrcAddr | ValidatorDstAddr -> amino(redelegation)

And I guess amino is the decoder?


Solution

  • When you build a blockchain with Cosmos SDK, there is a key-value store abstraction for interacting with the on-chain data. Each module has its own KV store. A module may want to store different types of data in its store and so prefixes are used to differentiate between different types in the store.

    In your example, in the staking module there are "redelegations" and each redelegation is stored in the store with a prefix of 0x34. There are keys for other types as well.