State synchronisation has been a long time coming lol. It took some figuring out to do.
State sync incorporates BitTorrent-like downloads. Block headers and transactions are downloaded in parallel from multiple peers. There is a simple program that illustrates the algorithm in core/dumbtorrent. This was fun to figure out and should be illustrative to anyone who wants to understand it, although it's a proof-of-concept and not designed for standalone use.
The state sync PR does the following:
[x] identifies peers we can get history from by peeking their tip at relative heights. ie. asking each peer what their height at genesis.height + 2048, and then downloading the history in parallel from all peers who share that tip.
[x] download blocks and headers in parallel using SyncGetData messages.
[x] downloading headers on repeat, processing them into an ordered list for ingestion, ingesting each header which updates the tip
[x] runs the sync algorithm on repeat in the background.
For this PR, sync is just downloading the block headers. Next PR will include the full blocks, and a simple way to query your balance and send some transactions. $TNY coming soon
This contains the state sync engine.
State synchronisation has been a long time coming lol. It took some figuring out to do.
State sync incorporates BitTorrent-like downloads. Block headers and transactions are downloaded in parallel from multiple peers. There is a simple program that illustrates the algorithm in
core/dumbtorrent
. This was fun to figure out and should be illustrative to anyone who wants to understand it, although it's a proof-of-concept and not designed for standalone use.The state sync PR does the following:
For this PR, sync is just downloading the block headers. Next PR will include the full blocks, and a simple way to query your balance and send some transactions. $TNY coming soon
Part of https://github.com/tinychainorg/tinychain/issues/10