State Trees
Last updated
Was this helpful?
Last updated
Was this helpful?
The protocol stores compressed state in multiple state trees
The hash of each is stored as a leaf in a state tree:
Note that each compressed account hash includes the public key of the state tree's respective on-chain account (i.e., state tree hash
) and the compressed account's position in the tree (i.e., leafIndex
). This ensures that each account hash is globally unique.
Each state tree has a single on-chain state tree account that stores only the tree's final root hash and other metadata. Storing the final tree root hash on-chain allows the protocol to efficiently verify the validity of any leaf (compressed account) in the tree. The raw state can thus be stored as calldata in the much cheaper Solana ledger space while preserving Solana's security guarantees.