monero-blockchain-import - Reference

Nowadays, there is little usage for raw blockchain export / import. In the past the p2p blockchain download was much slower. Back than blockchain.raw file was used to speed up download process of bootstrapping a node.

Overview

The tool imports bootstrap file blockchain.raw to your full node.

This could be useful if you want to decouple download from verification for any reason (like testing performance in isolation). In this case, you may download the blockchain.raw file from https://downloads.getmonero.org/blockchain.raw.

Ideally though, you should use your own trusted blockchain.raw file that you exported earlier.

Please note that importing blockchain.raw will not speed up the process over syncing up from p2p network. This is because usual bottlenecks are disk IO and verification, not the download.

The tool works on your local files. It does not require monerod running.

Syntax

./monero-blockchain-import [options]

Example:

./monero-blockchain-import --help

Running

Go to directory where you unpacked Monero.

./monero-blockchain-import --stagenet --output-file=/tmp/blockchain.raw

Options

Help

OptionDescription
--helpEnlist available options.

Pick network

OptionDescription
(missing)By default monero-blockchain-import assumes the mainnet blockchain.
--stagenetImport stagenet blockchain.
--testnetImport testnet blockchain.

Logging

Specifying the log file path is not supported.

OptionDescription
--log-level0-4 with 0 being minimal logging and 4 being full tracing. Defaults to 0. These are general presets and do not directly map to severity levels. For example, even with minimal 0, you may see some most important INFO entries. Example:
./monero-blockchain-import --log-level=1

Input

OptionDescription
--input-fileFull path to raw blockchain file. The default is $DATA_DIR/export/blockchain.raw.
--block-stopOnly import up to this block height. By default import all blocks (value 0).
--pop-blocksDiscard specified number of blocks from the tip of the bootstrapped blockchain. By default don’t discard anything (value 0).

Output

OptionDescription
--data-dirFull path to data directory. This is where the blockchain, log files, and p2p network memory are stored. For defaults and details see data directory.
--count-blocksCount blocks in the bootstrap file and exit.
--drop-hard-forkWhether to drop hard fork data. Off by default (0).
--databaseThe only valid value seems to be lmdb (the default).

Performance

OptionDescription
--dangerous-unverified-importThe safe default is to run verification (value 0). You can enable --dangerous-unverified-import if you are importing from your own and trusted blockchain.raw (which we assume was already verified). The “dangerous” mode will greatly speed up the process.
--batchWhether to save to disk on an ongoing basis (the default, value 1) or maybe do everything in RAM and save everything in the end (value 0). No batching is only effective in combination with no verification (--dangerous-unverified-import). See also --batch-size.
--batch-sizeHow often to save to disk expressed in number of blocks. By default save every 5000 blocks (when verifying) or every 20000 blocks (when not verifying). Big batches are faster but require more RAM.
--resumeResume from current height if output database already exists (the default, value 1). Changing to --resume=0 doesn’t change much — existing blocks are skipped pretty quickly and the process is resumed anyway.

Reference