Which is the main purpose of this?
Run a Bitcoin node needs over 1/2 TB of hard disk. It's not so much, but if you have a Raspberry PI or any other small computer, the space is a problem.
A pruned node maintains only the last transactions, then you can run a node with only +550MB for the blockchain database. In this tutorial I'll avoid to download & use the whole blockchain (1/2TB) and we'll use only 5GB, even for the installation and start up (the tip is to use the snapshot).
Install it!
Steps:
- Download Bitcoin Core.
- Download blockchain snapshot.
- Create a daemon.
- Open ports.
- Start daemon.
- Validate
Download Bitcoin Core
- Go to the official webpage and get the link for your Linux architecture. Today is 22.0.
- Download:
wget https://bitcoin.org/bin/bitcoin-core-22.0/bitcoin-22.0-x86_64-linux-gnu.tar.gz
- Uncompress:
tar xvf bitcoin*.tar.gz
- Install:
sudo install -m 0755 -o root -g root -t /usr/local/bin bitcoin-22.0/bin/*
- Test:
bitcoind --version
Download blockchain snapshot
mkdir .bitcoin
- Download the snapshot from here and unzip into
~/.bitcoin/
.
Setup initial configuration file
Create this file:
costales@server:~$ cat ~/.bitcoin/bitcoin.conf
prune=550
server=1
dbcache=100
maxorphantx=10
maxmempool=50
maxconnections=40
maxuploadtarget=2500
costales@server:~$
You can setup another configuration (for example for a Raspberry PI) with this template generator.
Create a daemon
Create this file (change costales
for your username):
costales@server:~$ cat /etc/systemd/system/bitcoind.service
[Unit]
Description=bitcoin
After=network.target
[Service]
User=costales
Group=costales
Type=simple
Environment=BITCOIN_PID=/home/costales/.bitcoin/bitcoin.pid
Environment=BITCOIN_HOME=/home/costales/.bitcoin
ExecStart=/usr/local/bin/bitcoind
ExecStop=/bin/kill -15 $MAINPID
Restart=on-failure
RestartSec=30s
[Install]
WantedBy=multi-user.target
costales@server:~$
Reload the system configuration: sudo systemctl daemon-reload
Open ports
By default, you need to open the port 8333
in your router.
Start daemon
sudo systemctl restart bitcoind
Validate
You'll the synchronize proccess here: tail ~/.bitcoin/debug.log
Check your node with your external IP (remember to open into your router).
After the synchronization you can check your current connections:
costales@z85:~$ bitcoin-cli -getinfo
{
"version": 220000,
"blocks": 794536,
"headers": 794536,
"verificationprogress": 0.9999996589953447,
"timeoffset": 0,
"connections": {
"in": 15,
"out": 10,
"total": 25
},
"proxy": "",
"difficulty": 52350439456487.47,
"chain": "main",
"relayfee": 0.00001000,
"warnings": ""
}
costales@z85:~$ bitcoin-cli -netinfo
Bitcoin Core v22.0.0 - 70016/Satoshi:22.0.0/
ipv4 ipv6 onion total block
in 15 0 0 15
out 10 0 0 10 2
total 25 0 0 25
Local addresses: n/a
costales@z85:~$
Enjoy it :)