NewEconoLabs has released a tutorial on its fast synchronization solution for the NEO blockchain. NEL uses a modified neo-cli client, dubbed neo-cli-nel, alongside a custom quick sync plugin to enable developers to synchronize their node instances in minutes rather than hours.
Before a node is able to interact with the network, it needs a copy of the blockchain data. Currently there are two ways for a node to receive this data; it can synchronize naturally with other nodes in a peer-to-peer manner, or the ImportBlocks plugin can be used in conjunction with an offline data package.
Using ImportBlocks to bootstrap the node allows the process to be completed much quicker than a natural sync, but the process can still potentially take hours to finish. This is due to the large amount of data that must be parsed, with each block of data being analyzed, validated, appropriately classified and stored into a leveldb library.
NEL’s fast synchronization approach removes the data validation and classification steps, allowing data to be directly added or deleted in leveldb. NEL’s fast sync package is a record of an existing node’s leveldb operations, which can be quickly replicated by the new node. By following the same operations, both nodes will end up with identical data sets.
The speed of this process is limited by the read/write speeds of the node’s hard drive, however the removal of the data validation steps sacrifices some security. Due to this, NEL notes that it is very important to ensure a reliable data source.
Fast Sync Tutorial
To use the fast synchronization functionality, users must first download NEL’s revision of the neo-cli node software. Neo-cli-nel is mostly unchanged from v2.10.0 of the official client, however it also includes some additional functions. The node defaults both the config.json and protocol.json to the NEO TestNet environment.
To enable fast sync, users must then download NEL’s RestoreDB plugin. As with other NEL plugins, such as RecordToMongo, this must be placed into the node directory in a new folder named NEL_Plugins. Official NEO plugins should be instead added to a standard Plugins directory.
The final step is to download NEL’s fast sync blockchain data package, which should be placed in the same directory as neo-cli.dll. The data package is for the NEO TestNet, and includes all blocks up to height 2,400,000.
The node may be run by executing the startUp.bat file within the directory. At this point, a short wait is required while the blockchain data is restored, at which point remaining blocks are synchronized through other TestNet nodes.