@tevm/voltaire / primitives/StateRoot
primitives/StateRoot
Type Aliases
StateRootLike
StateRootLike =Defined in: src/primitives/StateRoot/StateRootType.ts:23 Inputs that can be converted to StateRootStateRootType|string|Uint8Array
StateRootType
StateRootType =Defined in: src/primitives/StateRoot/StateRootType.ts:15 Branded StateRoot type - represents a 32-byte Merkle Patricia Trie root hash of the global Ethereum state. The state root is the root hash of the state trie, which contains mappings from addresses to account states. It uniquely identifies the entire global state at a given block. Per the Yellow Paper, the state trie encodes mappings between addresses (160-bit identifiers) and account states. The state root is included in every block header.Uint8Array&object
Type Declaration
[brand]
readonly[brand]:"StateRoot"
length
readonlylength:32
Variables
SIZE
Defined in: src/primitives/StateRoot/StateRootType.ts:25constSIZE:32=32
Functions
equals()
equals(Defined in: src/primitives/StateRoot/equals.js:20 Compares two StateRoots for equality. Uses constant-time comparison to prevent timing attacks.a,b):boolean
Parameters
a
StateRootType
First StateRoot
b
StateRootType
Second StateRoot
Returns
boolean
- True if equal
Example
from()
from(Defined in: src/primitives/StateRoot/from.js:21 Creates a StateRoot from various input types. Accepts hex strings, Uint8Array, or existing StateRoot instances.value):StateRootType
Parameters
value
StateRootLike
The value to convert
Returns
StateRootType
- A branded StateRoot
Example
fromHex()
fromHex(Defined in: src/primitives/StateRoot/fromHex.js:18 Creates a StateRoot from a hex string.hex):StateRootType
Parameters
hex
string
Hex string (with or without 0x prefix)
Returns
StateRootType
- A branded StateRoot
Example
toHex()
toHex(Defined in: src/primitives/StateRoot/toHex.js:19 Converts a StateRoot to a hex string.stateRoot):string
Parameters
stateRoot
StateRootType
The StateRoot to convert
Returns
string
- Hex string with 0x prefix

