wavesplatform / Waves

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

[FEATURE] **Synchronization Management.** (If still - does not exists). #2521

Closed username1565 closed 5 years ago

username1565 commented 5 years ago

Аbstract Is your feature request related to a problem? Please describe. I see here https://dev.pywaves.org/nodes/ the list of nodes. And someone has status forked at block_N. So my question about synchronization management to perevent loading the blocks from forked blockchain or loading this specially from specified branch from specified segment of decentralized network...

Motivation and Purposes A clear and concise description of what the problem is. Ex. I'm always frustrated when [need to run slow re-checking and re-verification the blocks on my node].

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

I just want to select the node with actual longer blockchain, and just download the blocks from there, from this specified node, not from the nodes, where is exist the forked blockchain. I don't know where is the node as the source of actual blockchain, so, now, I using the binary file, with archive of blocks, and this guide for import the blocks. But after the import those blocks (the loading blocks from this binary file is so slow, because need verification of blocks...), there can be, on my node, the fork of blockchain at N-th block... And if there is a fork of blockchain, and if I'll know the block where is my blockchain forked, I want to be able to select that block, and make the re-synchronize blockchain from this selected block by loading actual blockchain from - specified node (where the actual blockchain is exist), and then, run re-verification of blocks on my node - from that selected block.

Backwards Compatibility Can your proposition affect any existing features? I think, no. Just some parameters for synchronization, and maybe this already exists.

Examples and Implementation Examples of implementation in other projects? Hm... Maybe somewhere this is already implemented, but in bitcoin mainnet, there is working an auto override invalid blockchain every mature blocks value, and as actual blockchain there is sellected the longer blockchain, by blockchain height, and mining difficulty.

pivoo81 commented 5 years ago

When you use import file form the node which is not on fork you will not have problems. And this link provides blockchain import file which our team operates. It's very unlikely that it will be incorrect.

Also for faster getting node operable you can use state downloading described here, but in this case your node will not check every transaction by itself.

About forked state - you can use /debug/rollback API method to rollback your node for up to 2000 blocks. 2000 - is default value for the node, it can be changed by waves.db.max-rollback-depth. Increasing value of this option will lead to increasing Node disk space consumption.

Also we don't plan to provide API which can download blockchain from the node, because it will increase load of the node, thus it's insecure.

username1565 commented 5 years ago

Hello. When .tar-archive with blockchain used, and when this is unpacked, after running the node need to verify blocks! To import this... This verification is very slow... Import blocks, like a synchronization may go on 10-11 hour for that shorter blockchain in this tests And in the case of damage the database, or in the case of including a block that is not backward compatible, with the previous version of the node (invalid array size error, for example), or in the case of just deletion latest files, after blocks (LOG, CURRENT, LOG.old, MANIFEST-block, etc...) - need to resynchronize the blockchain again and again! Is it possible to disable block validation?!! This strings [appender-49]?? Do you have the lite-version of the mining-node to don't download and store FULL blockchain, to do mining, and be generator??? Is it possible to specify start block, to synchronize the partial of latest blockchain, beginning from specified assume valid block (checkpoint)? Can I restore the damaged database, without 2-or-3-days re-synchronization and validation for import this blocks, if I already have full blockchain downloaded, but latest blocks are damaged?