How to install, configure and debug bitcoin core. To understand how it works read blochain page. Read notes before running a "production" wallet / bitcoind.

Capitalized “Bitcoin” to refer to the protocol and general concept, and lowercase “bitcoin” to refer to specific denominations of the currency.

Bitcoin serves as a currency because it solves the following problems;

Private key proves ownership of the public key and the signature the authenticity of the transaction. Payment address or receiving address is a public key, can be used once or more times to receive founds.
Each transaction contains references to other previous transactions, only if all of the previous transactions match the owner, total of them make the amount and they were not spent then is considered valid.
Double spending
To validate transactions miners group them in blocks, each block is linked to previous one forming a blockchain. A "Proof-of-work" protocol regulate the amount of computational power necessary to validate a block, preventing someone from taking over the blockchain by number and power. This is achieved by defining the amount of zeros of the output of SHA-256 hash function with input of a nonce appended to the hash. When a miner finds a valid nonce the block is considered valid and is broadcasted with the nonce.


Verify if the port is updated and read notes, they describe why pre-built upstream (bitcoin-bin) should be used when in production. Another solution with features such as; printed paper backups, work without Internet, etc is armory. Bitcoin client supports pruning mode, this mode save disk space, at the time of this writing bitcoin full node require more or less 240G of disk space (storage, lvm, qemu-img). To install bitcoin;

$ prt-get depinst bitcoin
$ mkdir bitcoin && cd bitcoin
$ cp /usr/ports/ports/bitcoin/Pkgfile .
$ pkgmk -do
$ tar xf bitcoin-0.18.0.tar.gz
$ cd bitcoin-0.18.0
$ git init .
$ git add .
$ git commit -m "initial 0.18.0"

For production;

$ prt-get depinst bitcoin-bin

Default options for bitcoind are set in /etc/default/bitcoind, both bitcoind and bitcoin-qt will load ~/.bitcoin/bitcoin.conf (upstream) when -conf argument is not passed. Arguments are saved on configuration file as key=value example; datadir=/var/bitcoin/. Important arguments;

set data directory where it saves blockchain, wallet and other data. Both bitcoind and bitcoin-qt can use the directory and data.
set wallet file location, default is the same as datadir/wallet.dat.
set configuration file to load.
set localization of lock file

Bitcoin-qt saves and loads settings from ~/.config/Bicoin/Bitcoin-Qt.conf. Add your self to bitcoin group, so bitcoin-qt running as a user can share data with bitcoind. In this example default /var/bitcoin is changed to /home/bitcoin;

# usermod -a G bitcoin username
# chmod -R 0770 /home/bitcoin
# getent passwd bitcoin | cut -f 6 -d :
# usermod -m -d /home/bitcoin bitcoin

Its recommended to synchronize the clock before running the nodes. Change default configuration to match the following settings, change rpc password and user, edit /etc/bitcoin.conf and ~/.bitcoin/bitcoin.conf;


Edit /etc/default/bitcoind to;

BITCOIND_OPTS="-daemon -conf=/etc/bitcoin.conf"

Starting with GDB

Check page debugging, covers some system configuration required, basic GDB and strace utilities. There is a GDB sub-forum.


Start bitcoind;

# sh /etc/rc.d/bitcoind start

To find pid of bitcoind run;

# sh /etc/rc.d/bitcoind status
/usr/bin/bitcoind is running with pid 783

Or as a user;

$ ps -C bitcoind -o pid h
$ gdb
(gdb) attach 783

To stop bitcoind as a user;

$ bitcoin-cli stop


To debug bitcoin-cli start bitcoind as stated above, then call gdb with bitcoin-cli as argument;

$ gdb bitcoin-cli
(gdb) directory ~/bitcoin/bitcoin-0.18.0/src/
Source directories searched: /home/user/bitcoin/bitcoin-0.18.0/src:$cdir:$cwd
(gdb) b main


$ gdb bitcoin-cli
(gdb) directory ~/bitcoin/bitcoin-0.18.0/src/
Source directories searched: /home/user/bitcoin/bitcoin-0.18.0/src:$cdir:$cwd
(gdb) b GuiMain
(gdb) r

Full node

Check /etc/default/bitcoind, /etc/bitcoin.conf and ~/.bitcoin/bitcoin.conf files, remove or comment any -prune or prune= reference. To start bitcoin-qt specifying configuration file to load and data folder;

$ bitcoin-qt -datadir=/home/bitcoin/ -conf=~/.bitcoin/bitcoin.conf

Prune mode

Read document SPV Security before running in prune mode.

Check electrum as a SPV aka lightweight solution.

Bitcoin client in -prune mode or SPV download the all the blockchain data and once is validated is deleted, pruned nodes keep the newest blocks up to the specified data limit by -prune=550 (550M).

If you are running bitcoind edit /etc/bitcoin.conf and add;


Restart bitcoind;

# bash /etc/rc.d/bitcoind restart


$ bitcoin-cli getblockchaininfo | grep prune


The libbitcoin toolkit is a set of cross platform C++ libraries for building bitcoin applications. The toolkit consists of several libraries, most of which depend on the foundational libbitcoin library. BX is a command line tool for working with Bitcoin. It can be built as a single portable executable for Linux, macOS or Windows and is available for download as a signed single executable for each. BX exposes over 80 commands and supports network communication with libbitcoin-server or its predecessor Obelisk, and the P2P Bitcoin network. BX is well documented and supports simple and advanced scenarios, including stealth and multisig.
Python Cryptocoin Utilities - pycoin supports many coins to various degrees via the "network" class. Since specifications vary based on the network , all API descends from a network object. Everything related to a particular network is scoped under this class. Bitcoin has the highest level of support, including keys, transactions, validation of signed transactions, and signing unsigned transactions, including partial signing of multisig transactions. These are in level of increasing complexity, so features for other coins will likely be supported in that order.
Python code that speaks the Bitcoin protocol, for use with pycoin. The pycoinnet library is designed for use in conjunction with the Python pycoin library. It provides utilities and examples for writing tools in pure Python that speak the bitcoin protocol on the bitcoin network.
A little Python utility that lets you monitor Bitcoin addresses through Blockchain Websocket API and perform custom callbacks.
A collection of simple programs which can generate bitcoin wallets, create and sign transactions, and send transactions over the bitcoin network.

Self-hosted payment gateway

Electrum Merchant
Uses electrum daemon as a watch only wallet to enable merchants to accept bitcoins
Cashier BTC
Self-hosted Node.js Bitcoin payment gateway. Depends on Nodejs v8+, Bitcoin Core, Couchdb for storage.


Port bitcoin 0.18.0-3 and earlier have GDB and QT errors.

Buy bicoins on the street or bitcoin ATM's that only require hard cash. Bisq is the best alternative for buying and selling bitcoin without AML/KYC. It’s a decentralized peer to peer Bitcoin exchange that lets you buy/sell bitcoin with a variety of payment methods.

"However, achieving reasonable anonymity with Bitcoin can be quite complicated and perfect anonymity may be impossible."

"While this is effective in theory, to do this with complete anonymity generally requires you to trust an anonymous third party to give you back your bitcoins and not keep records of the transactions that flow through them. There is nothing to keep a mixing service from running away with the coins."

"If your running Tor, setting your bitcoin-qt client to communicate through the Tor proxy will help to obfuscate your computer's network IP address. Go to your network preferences and elect to run bitcoin-qt through the SOCKS5 proxy.".

The Hidden Wiki.

I use Wasabi on my laptop, Samourai on my phone, Electrum for my BTCPay server, and a Cold Card as my offline cold storage solution. Cold Card and Electrum allow you to sign transactions offline, for added privacy and security. Signing transactions offline also opens the door to utilizing a Bitcoin satellite node and the Gotenna mesh network, for next level privacy.

@rickytheghost - bitcoin anonymity guide.

add/view comments