Skip to content
AdvancedLook up a term

What is a state root?

Author
CRYPTO PORT Editorial
Published
Updated
Reading time
5 min

In short

A state root condenses every account and contract on a chain into a hash tree and represents the top of that tree as a single value. If two nodes' 32-byte roots match, their entire states match. It is also the main value a rollup posts to layer 1.

Key points

  • Condenses the state of every account into one hash
  • Matching roots mean matching states
  • Allows proving a single balance without the whole state
  • The main value a rollup posts to layer 1

Definition

The top hash of the tree built from the state of every account and contract on a chain, recorded in the block header.

On Ethereum, every account's balance and nonce, along with contract code and storage, are organised into a tree-structured database. Each node is computed from the hashes of its children, converging on one value. The block header carries that value, binding the block to the state it produced.

The useful part is that you can prove a fragment without holding the whole state. Showing that an address holds a particular balance takes only the handful of hashes along the path to the root. This is what lets light clients verify without storing all the data.

A rollup posts the new state root to layer 1 after processing transactions on layer 2. On optimistic designs that value is what a challenge disputes; with validity proofs, the proof shows the transition from the old root to the new one was correct. Withdrawal verification also starts from this value.

Watch out for

  • · Matching roots say nothing about whether the rules that produced the state were correct
  • · Withdrawals based on a posted root cannot execute until that root is finalised
  • · Tree constructions differ by chain, so proof formats are not necessarily compatible

Related coins

Read next

Crypto quizzes

Answer a few questions and get your result instantly.

Start