Sync modes and storage

How a node gets the chain, what each sync mode trusts, and archive versus pruned storage.

On this page
  1. 1. How the node gets the chain the first time
  2. 2. What happens when the node restarts
  3. 3. How much history the node keeps
  4. Today

Three choices decide what your node trusts and how much disk it needs. None has a hidden default that skips checking.

1. How the node gets the chain the first time#

ModeWhat it doesWhat you are trustingCost
fullDownloads every block since the first one and checks every proof and rule itselfNobody. If validators had ever approved an invalid transaction, your node would refuse the chain.About 0.3 s per proof plus a download of about 232 kB per transaction. Needs a peer that still has the old proofs.
snapshotChecks the chain of headers and the validators' signatures, downloads the current state (not the history), checks it matches a signed header, then checks every later block in fullThe validators, for everything before the snapshot. Your node checks that more than two thirds of the validators signed each header. It does not re-check old proofs.Fast: about 130 bytes of download per past transaction; seconds to minutes to check

Two more things about snapshot:

  • Old validator keys. People who were validators long ago could sign a fake alternative history. A node that has been online does not fall for this because it never replaces blocks it accepted. A brand-new node can protect itself with a trusted checkpoint, a block height and hash you get from a source you trust, passed with --trusted-checkpoint <height>:<hash>. Without one, snapshot mode trusts the validator signatures all the way back to the first block.
  • Old payments. A snapshot holds state, not history, so a snapshot node cannot give a wallet the encrypted notes from before the snapshot. A wallet restored from a backup needs a full node to read those blocks. That is not a privacy problem as long as the wallet downloads whole ranges, not single notes.

2. What happens when the node restarts#

ModeWhat it doesWhat you are trusting
trusted restart (default)Loads the state your node saved, checks it matches the last header, continues. Well under a second.Your own disk. Anyone who can change files on your disk could also change the program.
--auditRecomputes every state value from the saved files and checks the header chain. No proofs.Catches a damaged disk or bad copy. Does not re-check proofs.
--reverifyChecks every proof since the first block againNobody. Works only on an archive node synced in full mode.

3. How much history the node keeps#

ModeKeepsDisk per transactionCan serve others
archiveEverything, including every proofabout 232 kBEverything, including full sync for new nodes
pruned (--prune-proofs N)Everything except proofs older than N blocksabout 9 kB plus the proofs of the last N blocksHeaders, wallet sync, snapshots, recent blocks. Not old blocks with proofs.

A network needs archive nodes. If nobody keeps the old proofs, nobody new can check the history independently, and "anyone can verify" stops being true. A pruned node states that it is pruned and never pretends to have what it dropped.

Today#

BehaviourDetail
Start-upChecks every stored proof again, one at a time (about 0.02 s per transaction on Linux, 0.33 s on Windows)
HistoryKeeps everything
First syncReplays the whole chain from a peer on the same computer

Pruned storage, snapshot sync and a persistent wallet scan cache are the work that makes running your own node light. They arrive with the public network.

Lathen documentation.