Open
Description
Snapchain currently syncs in two ways:
- Snapshot sync which syncs block state and account state at the same time by downloading a copy of the db
- block sync which syncs and replays blocks to regenerate current account state from historical transactions
Because snapchain design intends to throw away vast majority of historical blocks, we need an additional sync mechansim that's decentralized and works with nodes that don't have full block history.
Ideally, it would work like this:
- When you start a brand new node, it fetches the latest block.
- For all accounts in that block, atomically fetch the account state as of that block via a new API
- Persist account state, verify the merkle roots match for the account and proceed to the next block and repeat the process.
- Deal with complications like rapidly changing accounts, byzantine peers, etc