[Ethereum] Geth’s “light” sync, and why is it so fast

fast-syncgo-ethereumlight-clientssynchronization

This question is in a similar vein to the past questions about geth --fast and parity --warp.

There was a recent question where the OP wanted to do as little syncing as possible, and one of the answers suggested the following:

Try geth --light, available since v1.5.2 . Syncs in minutes if
not seconds
.

How is this possible? What is it actually syncing?

Best Answer

I'll take my shot. Experts, please correct me.

  • "Full" Sync: Gets the block headers, the block bodies, and validates every element from genesis block.

  • Fast Sync: Gets the block headers, the block bodies, it processes no transactions until current block - 64(*). Then it gets a snapshot state and goes like a full synchronization.

  • Light Sync: Gets only the current state. To verify elements, it needs to ask to full (archive) nodes for the corresponding tree leaves.

EDIT (*) in newer version of geth it's -64

fsMinFullBlocks        = 64              // Number of blocks to retrieve fully even in fast sync