Monero installation
I run multiple blockchain nodes and they require lot of space, so I store all they data on my NAS and spin up and down the nodes as I need them.
This way I don’t read to wait for a month or two to resync a new blockchain when I need a local node for it.
Monero daemon installation using remote data folder
These steps assume you have a Debian based Linux distribution.
- Install dependecies
sudo apt update && sudo apt install build-essential cmake pkg-config libssl-dev libzmq3-dev libunbound-dev libsodium-dev libunwind8-dev liblzma-dev libreadline6-dev libexpat1-dev libpgm-dev qttools5-dev-tools libhidapi-dev libusb-1.0-0-dev libprotobuf-dev protobuf-compiler libudev-dev libboost-chrono-dev libboost-date-time-dev libboost-filesystem-dev libboost-locale-dev libboost-program-options-dev libboost-regex-dev libboost-serialization-dev libboost-system-dev libboost-thread-dev python3 ccache doxygen graphviz
- Clone Monero repository:
git clone --recursive https://github.com/monero-project/monero
cd monero && git submodule init && git submodule update
- Checkout latest stable version and build it. At the momento of this writing its v.0.18
git checkout release-v0.18
git submodule init && git submodule update
make
- Add binary to path. Add the following line to
~/.zshrc
export PATH=$PATH:/home/alejandro/git/monero/build/Linux/release-v0.18/release/bin
- Run Monero daemon specifying the folder where I store the blockchain data:
monerod --data-dir /mnt/nfs/blockchain-monero
2024-07-12 11:59:44.175 I Monero 'Fluorine Fermi' (v0.18.3.3-24ccaba6e)
2024-07-12 11:59:44.175 I Initializing cryptonote protocol...
2024-07-12 11:59:44.175 I Cryptonote protocol initialized OK
2024-07-12 11:59:44.176 I Initializing core...
2024-07-12 11:59:44.177 I Loading blockchain from folder /mnt/nfs/blockchain-monero/lmdb ...
2024-07-12 12:03:05.639 I Loading checkpoints
2024-07-12 12:03:05.653 I Core initialized OK
2024-07-12 12:03:05.653 I Initializing p2p server...
2024-07-12 12:03:05.713 I p2p server initialized OK
2024-07-12 12:03:05.713 I Initializing core RPC server...
2024-07-12 12:03:05.726 I Binding on 127.0.0.1 (IPv4):18081
2024-07-12 12:03:07.047 I core RPC server initialized OK on port: 18081
2024-07-12 12:03:07.057 I Starting core RPC server...
2024-07-12 12:03:07.057 I core RPC server started ok
2024-07-12 12:03:07.057 I Starting p2p net loop...
2024-07-12 12:03:08.058 I
2024-07-12 12:03:08.058 I **********************************************************************
2024-07-12 12:03:08.058 I The daemon will start synchronizing with the network. This may take a long time to complete.
2024-07-12 12:03:08.058 I
2024-07-12 12:03:08.058 I You can set the level of process detailization through "set_log <level|categories>" command,
2024-07-12 12:03:08.058 I where <level> is between 0 (no details) and 4 (very verbose), or custom category based levels (eg, *:WARNING).
2024-07-12 12:03:08.058 I
2024-07-12 12:03:08.058 I Use the "help" command to see the list of available commands.
2024-07-12 12:03:08.058 I Use "help <command>" to see a command's documentation.
2024-07-12 12:03:08.058 I **********************************************************************
2024-07-12 12:03:30.187 I [162.218.65.108:18084 OUT] Sync data returned a new top block candidate: 2634634 -> 3191166 [Your node is 556532 blocks (2.1 years) behind]
2024-07-12 12:03:30.187 I SYNCHRONIZATION started
2024-07-12 12:05:09.703 I [46.242.130.241:18080 OUT] Sync data returned a new top block candidate: 2634634 -> 3191167 [Your node is 556533 blocks (2.1 years) behind]
2024-07-12 12:05:09.705 I SYNCHRONIZATION started
2024-07-12 12:12:05.428 I Synced 2634654/3191172 (82%, 556518 left, 0% of total synced, estimated 2.4 months left)
2024-07-12 12:14:05.884 I Synced 2634674/3191174 (82%, 556500 left, 0% of total synced, estimated 1.9 months left)
You can also run it dettached so I stays running in the background and logs the output in a file.
./monerod --data-dir /mnt/nfs/blockchain-monero --detach --log-file /mnt/nfs/blockchain-monero/monero-log.txt
-
The first sync can take days or weeks. To accelerate the process you can download it the chain from getmonero and verify it:
-
Run Monero daemon specifying the folder where I store the blockchain data:
wget https://downloads.getmonero.org/blockchain.raw
$ monero-blockchain-import --input-file ./blockchain.raw --data-dir /mnt/nfs/blockchain-monero --db-sync-mode fast --offline --batch-size 30000 --prep-blocks-threads 16
2024-07-16 06:27:57.524 I Starting...
2024-07-16 06:27:57.524 I database: LMDB
2024-07-16 06:27:57.524 I verify: true
2024-07-16 06:27:57.524 I batch: true batch size: 5000
2024-07-16 06:27:57.524 I resume: true
2024-07-16 06:27:57.524 I nettype: mainnet
2024-07-16 06:27:57.524 I bootstrap file path: ./blockchain.raw
2024-07-16 06:27:57.524 I database path: /mnt/nfs/blockchain-monero
2024-07-16 06:27:57.527 I Loading blockchain from folder /mnt/nfs/blockchain-monero/lmdb ...
2024-07-16 06:27:57.621 I Loading checkpoints
2024-07-16 06:27:57.624 I bootstrap file recognized
2024-07-16 06:27:57.624 I bootstrap::file_info size: 4
2024-07-16 06:27:57.624 I bootstrap file v1.0
2024-07-16 06:27:57.624 I bootstrap magic size: 4
2024-07-16 06:27:57.624 I bootstrap header size: 1024
2024-07-16 06:27:57.624 I bootstrap::blocks_info size: 6
2024-07-16 06:27:57.624 I bootstrap first block:0
2024-07-16 06:27:57.624 I bootstrap last block:2554143
2024-07-16 06:27:57.624 I Scanning blockchain from bootstrap file...
block height: 2554143
Done scanning bootstrap file
Full header length: 1028 bytes
Scanned for blocks: 92359691963 bytes
Total: 92359692991 bytes
Number of blocks: 2554144
2024-07-16 06:29:26.407 I bootstrap file last block number: 2554143 (zero-based height) total blocks: 2554144
Preparing to read blocks...
2024-07-16 06:29:26.407 I bootstrap file recognized
2024-07-16 06:29:26.407 I bootstrap::file_info size: 4
2024-07-16 06:29:26.407 I bootstrap file v1.0
2024-07-16 06:29:26.407 I bootstrap magic size: 4
2024-07-16 06:29:26.407 I bootstrap header size: 1024
2024-07-16 06:29:26.407 I bootstrap::blocks_info size: 6
2024-07-16 06:29:26.407 I bootstrap first block:0
2024-07-16 06:29:26.407 I bootstrap last block:2554143
2024-07-16 06:29:26.407 I start block: 1 stop block: 2554143
2024-07-16 06:29:26.407 I Reading blockchain from bootstrap file...
block height: 2554143
Done scanning bootstrap file
Full header length: 1028 bytes
Scanned for blocks: 92359691963 bytes
Total: 92359692991 bytes
Number of blocks: 2554144
2024-07-16 06:29:26.407 I bootstrap file last block number: 2554143 (zero-based height) total blocks: 2554144
Preparing to read blocks...
2024-07-16 06:29:26.407 I bootstrap file recognized
2024-07-16 06:29:26.407 I bootstrap::file_info size: 4
2024-07-16 06:29:26.407 I bootstrap file v1.0
2024-07-16 06:29:26.407 I bootstrap magic size: 4
2024-07-16 06:29:26.407 I bootstrap header size: 1024
2024-07-16 06:29:26.407 I bootstrap::blocks_info size: 6
2024-07-16 06:29:26.407 I bootstrap first block:0
2024-07-16 06:29:26.407 I bootstrap last block:2554143
2024-07-16 06:29:26.407 I start block: 1 stop block: 2554143
2024-07-16 06:29:26.407 I Reading blockchain from bootstrap file...
2024-07-16 06:35:02.062 I [batch] DB resize needed
2024-07-16 06:35:02.919 I LMDB Mapsize increased. Old: 1024MiB, New: 1536MiB
2024-07-16 06:36:16.654 I [batch] DB resize needed
2024-07-16 06:37:21.843 I LMDB Mapsize increased. Old: 1536MiB, New: 2229MiB
2024-07-16 06:42:31.223 I [batch] DB resize needed
2024-07-16 06:42:31.669 I LMDB Mapsize increased. Old: 2229MiB, New: 2741MiB
...
Bitcoin
-
Download Bitcoin Core
-
In the
bitcoin.conf
file add the folder where you have the blockchain data:
datadir=/mnt/nfs/blockchain-bitcoin
- Run the bitcoinQT GUI (
./bitcoin-qt
) or the bitcoind daemon (/bitcoind
) if you prefer the command line
You can optionally also select the datadir with the bitcoind command.
./bitcoind --datadir=/mnt/nfs/blockchain-bitcoin