Bitcoin full node on OpenBSD
# 25 Nov 2018In the middle of this year I imported Bitcoin to OpenBSD, so it is available since 6.4 as a package. This blog post would like to give a short guide how to run a full-node on OpenBSD. We are not going to talking about mining-nodes. The following quote best illustrates a full node:
A full node is a program that fully validates transactions and blocks. Almost all full nodes also help the network by accepting transactions and blocks from other full nodes, validating those transactions and blocks, and then relaying them to further full nodes.
-
Install bitcoin, as simple as you are familiar with on OpenBSD. I prefer the no_x11 flavor because I run bitcoind on an headless server.
pkg_add bitcoin Ambiguous: choose package for bitcoin a 0: <None> 1: bitcoin-0.17.0 2: bitcoin-0.17.0-no_x11 Your choice: 2 bitcoin-0.17.0-no_x11:boost-1.66.0p0: ok bitcoin-0.17.0-no_x11:libevent-2.0.22p1: ok bitcoin-0.17.0-no_x11:zeromq-4.2.5: ok bitcoin-0.17.0-no_x11:db-4.6.21p5v0: ok bitcoin-0.17.0-no_x11: ok The following new rcscripts were installed: /etc/rc.d/bitcoind See rcctl(8) for details. New and changed readme(s): /usr/local/share/doc/pkg-readmes/bitcoin
-
Create RPC user and password (How described in the README). For the example below, replace
rsadowski
with your locale username.$ /usr/local/share/bitcoin/rpcauth.py rsadowski String to be appended to bitcoin.conf: rpcauth=rsadowski:bb7fef8d86d250cfebecb36a20eca7$7d0db3fe6c9eab161d70ffa2023838c8b17b32a3522bdc212438022ac0e5398e Your password: kMSoXR7rMw_90DxVasp0YLFIZb9a-GS5hhFK9aWi4vE=
-
Add the generated
rpcauth
line into you/etc/bitcon.conf
and check all option in/etc/bitcon.conf
. -
Create a RPC cookie file in your home directory
$ cat /home/rsadowski/.bitcoin/bitcoin.conf rpcuser=rsadowski rpcpassword=kMSoXR7rMw_90DxVasp0YLFIZb9a-GS5hhFK9aWi4vE=
-
Adjust your
pf
rule-set.pass quick proto tcp from any to (egress) port { 8333 }
-
Start bitcoind
$ rcctl start bitcoind 282229
-
After the blockchain is synced you can checkout the status with
bitcoin-cli
$ bitcoin-cli getconnectioncount 23 $ bitcoin-cli getblockcount 282229
-
As last step you can check you node on bitnodes.earn.com.
Keep in mind to reduce the blockchain size by pruning (deleting) old blocks,
otherwise you have to download and verify the whole chain and this may take a
few days. Checkout the prue
value in /etc/bitcoin.conf
. I prefer 550MB.