In this article, we describe the different kinds of key-value pairs which are stored in smartBCH's world state.
In the following descriptions, we use "+" to denote concatenation.
Key: byte(23) + 20-byte-address
32-byte Balance (Big Endian)
8-byte Nonce (Big Endian)
8-byte Sequence (Big Endian). For EOA, the sequence is always uint64(-1). For contract account, the sequence is assigned a unique value when created.
Key: byte(21) + first-byte-of-address
Values: 8-byte Counter (Big Endian)
All the smart contracts who have the same value in the first byte of address share one counter. Each time a new contract is created, this counter get increased by one. And the address of the new contract is calculated by: new-value-of-counter * 256 + first-byte-of-address.
Key: byte(27) + 8-byte-account-sequence + 32-byte-key
Value: Non-zero-length byte string (not required to be 32 bytes)
Please note after a smart contract's self-destruction, there will never be another contract which can have the same account sequence as it. So the self-destructed contract's storage slots can never be accessed.
Key: byte(25) + 20-byte-address
Value: arbitrary-length byte string
EOA has no bytecode. We only store byte codes for smart contracts.
8-byte start position (Big Endian)
8-byte end position (Big Endian)
You can find a standby transaction at a position in the range [start, end)
Key: byte(100) + 8-byte-position
Value: serialized bytes for a transaction
Value: serialized bytes of current Block's basic information