When a new node joins the Spacemesh network, it must first get up to speed with the rest of its peers. This process is referred to as "syncing" and is a pre-requisite to running a full or a smeshing node. Historically, it has been difficult for smeshers to successfully sync their nodes owing to how time-consuming the syncing process is. Primarily, syncing includes downloading and independently verifying all blocks, transactions, ATXs, along with some other data, and reconstructing the current state from scratch. Naturally, this took the average smesher a lot of time. As such, in response to the growing difficulty of syncing a fresh node, we have prepared a way to speed up the syncing process. Introducing, Quicksync.
With Quicksync, instead of performing all of the syncing actions as stated above and calculating the network state from genesis, one just needs to download the current state from a trusted peer like the Spacemesh dev team or some other node. While this runs contrary to the web3 philosophy of "Don't trust, verify", we believe that this could be a choice some smeshers may be interested in given the high rate of trouble with syncing. Moreover, nothing precludes a smesher from verifying this state in the background once it is downloaded.
The state (also called an archive) that is downloaded is in the form of a state.sql file and can either be downloaded automatically using Smapp, or manually by using the quicksync-rs
utility.
Instructions for using quicksync-rs
to download the latest state are given below. Note that if you use the latest version of Smapp, it will automatically offer to use quicksync to fetch the latest state.
quicksync-windows-vX.X.X.zip
from the GitHub releases section.quicksync.exe
from the zip file downloaded in step 1.quicksync.exe
to your spacemesh
folder. By default, this folder is located at: C:Users{USERNAME}spacemesh
.state.sql
file in your node data folder (located inside the spacemesh
directory and named node-data
by default), delete it. Otherwise, continue to step 5.spacemesh
directory where the quicksync.exe
file is. You can do this by holding the "shift" key, right-clicking, and selecting the "Open Powershell here" option..quicksync.exe --help
and press enter. This will show you the available options..quicksync.exe download --node-data .node-data
. Here, .node-data
is the path to the node data folder.quicksync-rs
utility will download, unzip, and verify the downloaded state.state.sql
file.quicksync-linux-vX.X.X.zip
from the GitHub releases section.quicksync
file from the zip file downloaded in step 1.quicksync
file executable by using this CLI command: chmod +x quicksync
. Now you have the quicksync
executable.quicksync
executable to the spacemesh
directory ( located at ~/spacemesh
by default).state.sql
file in your node data folder (located inside the spacemesh
directory and named node-data
by default), delete it. Otherwise, continue to step 6.spacemesh
directory where the quicksync
executable is, and run this command: ./quicksync download --node-data ./node-data
. Here, ./node-data
is the path to the node data folder.quicksync-rs
utility will download, unzip, and verify the downloaded state.state.sql
file.quicksync-macos-vX.X.X.zip
(or quicksync-macos-arm64-vX.X.X.zip
if you have an M-series Mac) from the GitHub releases section.quicksync
file from the zip file downloaded in step 1.quicksync
file executable by using this CLI command: chmod +x quicksync
. Now you have the quicksync
executable.quicksync
executable to the spacemesh
directory. (located at ~/spacemesh
by default).state.sql
file in your node data folder (located inside the spacemesh
directory and named node-data
by default), delete it. Otherwise, continue to step 6.spacemesh
directory where the quicksync
executable is, and run this command: ./quicksync download --node-data ./node-data
. Here, ./node-data
is the path to the node data folder.quicksync-rs
utility will download, unzip, and verify the downloaded state.state.sql
file.Listed below are the exit codes and what they mean:
0
- All good.1
- Failed to download archive within max retries (any reason).2
- Cannot unpack archive: not enough disk space.3
- Cannot unpack archive: any other reason.4
- Invalid checksum of downloaded state.sql
.5
- Cannot verify checksum for some reason.6
- Cannot create a backup file.7
- Invalid checksum of archive.8
- Cannot validate archive checksum.It is also possible to download and apply delta-based quicksync. Assuming that the state.sql
is already present, it's worth considering applying only deltas on top of that.
Please note that syncing large portions will be faster with full quicksync, but if you are already synced and just need to catch up with the latest state, incrementa quicksync is the way to go.
Incremental quicksync works by checking the latest verified layer in the database and then downloading small files (usually about 50MB but up to 200MB) and applying them on top of the existing state.sql
. Each batch can be interrupted.
Restoring the same batch twice is considered a no-op and will not affect the database.
The list of available commands for the quicksync
utility is presented below. Note that these commands are for Linux. Simply, Change ./quicksync
to .quicksync.exe
For the Windows commands.
./quicksync download
: Downloads the latest state.sql
file../quicksync check
: Checks if the current state.sql
is up to date../quicksync help
: Displays all operations that quicksync
can perform../quicksync incremental
: Allows to work with delta based quicksync../quicksync --version
: Displays the quicksync version.cargo run -- help
: Displays helpful commands for running the package. Relevant for developers.