Module storage_key

Module storage_key 

Source
Expand description

Storage Key Computation Module

Computes deterministic storage keys for Neo N3 smart contract state variables. This module implements the storage slot derivation algorithm compatible with Neo N3’s storage model.

§Key Derivation

Storage keys are derived using SHA-256 hashing:

  • Simple variables: SHA256(variable_name)
  • Mappings: SHA256(base_slot || encoded_key1 || encoded_key2 || ...)

§Key Types

Enums§

KeyFragment
Represents a single mapping key fragment used to derive a storage slot.

Functions§

compute_state_slot
Compute the canonical storage slot hash for a state variable name.
derive_mapping_slot
Derive the storage slot for a mapping entry given the base slot and key fragments.
encode_fragment 🔒
encode_integer 🔒