Skip to main content
  1. Posts/

Bitcoin full node on OpenBSD

·317 words·2 mins· loading · loading ·
Rafael Sadowski
Rafael Sadowski
Shut up and hack

In 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.

  1. 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):
  1. Create RPC user and password (How described in the README). For the example below, replace rsadowski with your locale username.
$ /usr/local/share/bitcoin/ rsadowski

String to be appended to bitcoin.conf:
Your password:
  1. Add the generated rpcauth line into you /etc/bitcon.conf and check all option in /etc/bitcon.conf.

  2. Create a RPC cookie file in your home directory

$ cat /home/rsadowski/.bitcoin/bitcoin.conf
  1. Adjust your pf rule-set.
pass quick proto tcp from any to (egress) port { 8333 }
  1. Start bitcoind
$ rcctl start bitcoind
  1. After the blockchain is synced you can checkout the status with bitcoin-cli
$ bitcoin-cli getconnectioncount
$ bitcoin-cli getblockcount
  1. As last step you can check you node on

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.