wavesplatform / Waves

⛓️ Reference Waves Blockchain Node (client) implementation on Scala
https://wavesplatform.com/
MIT License
1.17k stars 418 forks source link

Checkpoints for downloading the blockchain #3043

Open username1565 opened 4 years ago

username1565 commented 4 years ago

Аbstract

Is your feature request related to a problem? Please describe.

Yes. Blockchain is too large for start synchronization, and resynchronize this.

Motivation and Purposes

A clear and concise description of what the problem is. Ex. I'm always frustrated when [need to synchronize all blockchain, with old unactual transactions].

Specification

A clear and concise description of what you want to happen. Describe alternatives you've considered

I want to you make the checkpoints for the fast synchronization of blockchain + lists of balances for all the tokens, which WavesPlatrofm have. For example, the block 2000000 is verified, and valid block: https://wavesblockexplorer.com/blocks/200000 The hash of this block can be a checkpoint, and this can be hardcoded for start synchronization. Then, you can make a snapshoot of all balances, and start the synchronization from block 2000000, without downloading, and verify all transactions for all 2000000 previous blocks, without synronize full blockchain, and without store all this old data.

Backwards Compatibility

Can your proposition affect any existing features?

No, this can be optional parameters, and can have full backward-compatibility. This is something, like half-peer, or half-node, to do mining, and to don't store all blockchain. Also, there is possible to download the part of blockchain. For example, 500 active nodes can save 500 parts with 2000000 / 500 = 4000 blocks, and broadcast this in the network, when full blockchain need to downloading for someone.

Examples and Implementation

Examples of implementation in other projects?

Bitcoin blockchain checkpoins for Bitcoin Core. Also, see the parameter "-prune=N" (Means save no more than N Megabyte of last blocks from blockchain ). Also, electrum bitcoin-wallet can working without synchronize full blockchain.

pivoo81 commented 4 years ago

Hello. This good point. But it's not in current plans. Currently we improving time of processing blockchain itself, it's already in stagenet, and will be ready for mainnet in June. Now if you want to get actual blockchain state fast you can download state. It's not as safe as 'checkpoint feature' you propose. Please read details on this here https://docs.wavesplatform.com/en/waves-node/options-for-getting-actual-blockchain/state-downloading-and-applying

username1565 commented 4 years ago

Hello, @pivoo81! I know about this bootstrap .tar-archive, http://blockchain.wavesnodes.com and to use this, need to download full blockchain inside this .tar-archive, and after import this on the node, there is running the validation for all blocks again, beginning from 0 block, and up to last block. This process of validation is so slow, and validation is processed by 100 blocks from 0-th block, and all blocks are processed again, within one re-synchronization. For all 2000000 blocks this take many time, and if database will be corrupted and damaged (for example, after power off), need to make re-syncronization again and again! Maybe I can skip this validation for ALL BLOCKS, by running the node with some parameters?

pivoo81 commented 4 years ago

Hi @username1565 Actually you telling about import-file (Look "Import Blocks from Binary file" chapter), but I told you about data-state download.