3

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?

hjorthjort
  • 55
  • 4

2 Answers2

3

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.

Denis Fadeev
  • 188
  • 1
  • 1
  • 8
1

0x34 is the hexadecimal number 34. It corresponds with the decimal number 3*16+4=52. The | is a binary operator that uses infix notation and calculates the logical or of the two operands.

Xaver
  • 1,035
  • 9
  • 17
  • I could have been clearer. I meant, what is the purpose of the byte? I got the answer from Denis, though. And thanks for clearing up the fact that `|` is concatenation, I was reading this as an EBF grammar. Is there a place where this notation is recorded? – hjorthjort Jan 18 '21 at 14:25