Snapshot Downloader

The Snapshot Downloader is a Rust-based automation tool that downloads a blockchain binary, snapshot (single or multi-part), and address book, then automatically extracts the binary and snapshot, initializes the node, merges custom settings into app.toml and config.toml, and starts the chain. It also provides lifecycle hooks to execute commands at different stages (post-download, post-extraction, post-start).

This guide walks you through the installation, setup, and configuration of the Snapshot Downloader for running a Cronos node. Follow the steps in order, adapting to your hardware setup (e.g. number of disks).

Environment Setup

The tool works best on Linux with Btrfs, as the tool leverages Btrfs subvolumes for efficient snapshot handling. On Linux, users can manually create snapshots of subvolumes and roll back to previous states if needed.

On macOS and Windows, the downloader still supports snapshot download, extraction, and node start, but Btrfs-specific snapshot and rollback features are unavailable.

Note: On Windows, it requires a Unix-compatible shell (e.g., Git Bash) to run the tool.

Linux Only – Btrfs Setup

Install btrfs-progs

sudo apt install -y btrfs-progs

Format and Mount Disk(s)

Choose one of the below according to the number of additional disk(s) mounted.

Format and Mount 2 Disks

sudo parted /dev/nvme0n2 -- mklabel gpt
sudo parted /dev/nvme0n2 -- mkpart downloads btrfs 0% 100%
sudo mkfs.btrfs /dev/nvme0n2p1
sudo parted /dev/nvme0n3 -- mklabel gpt
sudo parted /dev/nvme0n3 -- mkpart chain-data btrfs 0% 100%
sudo mkfs.btrfs /dev/nvme0n3p1
mkdir -p ~/test
sudo mount /dev/nvme0n3p1 ~/test
sudo btrfs sub create ~/test/data
sudo btrfs sub create ~/test/data/.snapshots
mkdir -p ~/.snapshot-downloader/downloads
mkdir -p ~/.snapshot-downloader/workspace/home/data
sudo mount /dev/nvme0n2p1 ~/.snapshot-downloader/downloads
sudo mount -osubvol=data /dev/nvme0n3p1 ~/.snapshot-downloader/workspace/home/data
sudo chown -R $USER ~/.snapshot-downloader/downloads
sudo chown -R 1001:1002 ~/.snapshot-downloader/workspace/home/data

Format and Mount 1 Disk

sudo parted /dev/nvme0n2 -- mklabel gpt
sudo parted /dev/nvme0n2 -- mkpart downloads btrfs 0% 100%
sudo mkfs.btrfs /dev/nvme0n2p1
mkdir -p ~/.snapshot-downloader
sudo mount /dev/nvme0n2p1 ~/.snapshot-downloader
sudo chown -R $USER ~/.snapshot-downloader

Resize Disk (Optional)

sudo growpart /dev/nvme0n3 1
sudo btrfs filesystem resize max ~/.snapshot-downloader/workspace/home/data

Dependencies Installation

Install Rust using the official installer.

$ curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
$ . "$HOME/.cargo/env"

Install other dependencies needed for building Rust projects.

$ sudo apt install -y gcc libssl-dev pkg-config

Build Snapshot Downloader

Configure Snapshot Downloader config.yaml

The tool supports single-file or multi-part snapshots, custom lifecycle hooks, and TOML overrides for node configuration.

Choose Snapshot

Checkout the latest snapshots at https://snapshot.cronos.org/?chain=cronos-pos

Update DB Settings

In snapshot-downloader2/config.yaml, under the app_yaml and config_yaml sections, update the database settings according to the target snapshot database type and pruning type, along with any other desired configurations. Follow the same pattern as:

Below are examples of each database with pruning type Default , overriding minimum-gas-prices and persistent_peers.

Full Config Example

Below is the example of snapshot-downloader2/config.yaml for Cronos POS. Update URLs, chain IDs, and settings as needed for the latest snapshots and binaries.

  • Cronos POS Mainnet Example

    This example uses a single file snapshot for the Cronos EVM chain.

Running the Tool

Once configured, run the tool with:

Monitor the output for progress. The tool will handle downloads, extractions, initialization, and startup. Use lifecycle hooks ( post_snapshot_download_command post_snapshot_extract_command and post_start_command ) for custom automation.

To re-run the tool without re-downloading or re-extracting the snapshot, run:

For troubleshooting, check logs in the workspace directory or adjust retry settings in the config. Always verify snapshot and binary URLs from official sources for the latest versions.

Last updated