StateRoot
32-byte Merkle Patricia Trie root hash representing global Ethereum state.Overview
StateRoot represents the root hash of the Ethereum state trie. It uniquely identifies the entire global state at a given block - all account balances, nonces, contract code, and storage. Every block header includes a state root.Type Definition (Zig)
Usage
Create StateRoot
Convert to Hex
Compare State Roots
API Reference
Constructors
Hash.fromHex(hex) !Hash– Create from hex string
Methods
| Function | Description |
|---|
Hash.toHex(root)– Convert to hex stringHash.equal(a, b)– Equality check
Constants
| Constant | Value | Description |
|---|---|---|
SIZE | 32 | State root size in bytes |
State Trie Structure
The Ethereum state is a Merkle Patricia Trie mapping addresses to account states:Block Header Context
Every block header contains a state root:Empty State Root
The empty state root (no accounts) has a known value:Use Cases
Verify State Against Header
Track State Changes
Light Client Sync
Specification
Per the Yellow Paper, the state trie encodes mappings from addresses (160-bit identifiers) to account states. The state root is a 32-byte Keccak-256 hash of the root node of the state trie.See Also
- StateProof - Account state proofs
- StorageProof - Storage slot proofs
- Hash - Hash primitives
- RLP - RLP encoding

