neo icon indicating copy to clipboard operation
neo copied to clipboard

Ledger Sync: Add block hash checkpoint for the ease of the ledger sync.

Open Jim8y opened this issue 1 year ago • 21 comments

Summary or problem description Currenty it takes days to synchronize the whole neo chain, the major reason behind this is that for every single block we downloaded from the p2p network, we have to verify the witness of them to make sure that a block is authentic and integrate, yet the change of the consensus nodes can only be known after the previous blocks are processed, which is sequential and takes a very long time to finish. Thus we need to figure out a way to break this constrain.

Do you have any solution you want to propose? Add block hashs checkpoint during the consensus, such that user can download the whole block hashs file, that is easier to verify, seperately. And then user either download the fast sync file provided by others, or sync the whole ledger from the chain without verifying the witness but only check the block hash.

Data Structure:

block hash file:

`blockhash | blockhash | blockhash | .... | ... `

Consensus address file:

`address | index | address | index | address | index ... | ...`

Expected speed up:

From days to less than 1 hour.

Neo Version

  • Neo 3

Where in the software does this update applies to?

  • Consensus
  • CLI
  • Plugins
  • Ledger
  • Network Policy
  • P2P (TCP)

Jim8y avatar Jan 08 '24 10:01 Jim8y