Skip to main content

Module encoding

Module encoding 

Source
Expand description

Key encoding helpers for RocksDB keys (hash, height, epoch, metadata).

Normative

Rationale: Big-endian u64 keys (height_key, epoch_key) preserve lexicographic order equal to numeric order, enabling efficient range scans. Hash keys are raw Bytes32 with no prefix (chia_protocol::Bytes32).

Functions§

decode_epoch_key
Decode an epoch key produced by epoch_key (KEY-003).
decode_height_key
Decode a height key produced by height_key (KEY-002).
epoch_key
Encode an epoch number as an 8-byte big-endian key for crate::constants::CF_CHECKPOINTS (KEY-003, NORMATIVE §KEY-003).
hash_key
Raw 32-byte RocksDB key for CF_BLOCKS, CF_HEADERS, and CF_ATTESTED (KEY-001).
height_key
Encode a chain height as an 8-byte big-endian key for crate::constants::CF_CANONICAL (KEY-002).
metadata_key
UTF-8 bytes for a metadata key name in crate::constants::CF_METADATA (KEY-004, NORMATIVE §KEY-004).