Support #889
Mining Bitcoin on FreeBSD
Description
This is a guide for setting up and mining bitcoin on FreeBSD 10. This is not a comprehensive guide and is meant for educational purposes. YMMV
Prepare the Environment¶
- Make sure the system is up to date:
pkg update && pkg upgrade
- Install sudo:
pkg install sudo
- Create a bitcoin user and group:
pw add group bitcoin pw add user -n bitcoin -g bitcoin -s /sbin/nologin -c "Bitcoin"
Install Bitcoin Daemon¶
- Install bitcoin-daemon:
pkg install bitcoin-daemon bitcoin-utils
- Create a basic bitcoin config file:
vi /usr/local/etc/bitcoin.conf
- And set the following parameters:
rpcuser=bitcoinrpc rpcpassword=SuperSecretPassword rpcallowip=127.0.0.1 rpcport=2300 daemon=1 server=1 gen=0
- And set the following parameters:
- Create the bitcoin data directory:
mkdir /var/db/bitcoind chown bitcoin:bitcoin /var/db/bitcoind
- Start and enable the server at boot:
echo 'bitcoind_user="bitcoin"' >> /etc/rc.conf echo 'bitcoind_group="bitcoin"' >> /etc/rc.conf echo 'bitcoind_data="/var/db/bitcoind"' >> /etc/rc.conf echo 'bitcoind_enable="YES"' >> /etc/rc.conf service bitcoind start
Useful Commands¶
- Get blockchain and network stats
sudo -u bitcoin bitcoin-cli -conf=/usr/local/etc/bitcoin.conf getblockchaininfo sudo -u bitcoin bitcoin-cli -conf=/usr/local/etc/bitcoin.conf getnetworkinfo sudo -u bitcoin bitcoin-cli -conf=/usr/local/etc/bitcoin.conf getnettotals
- Create a new bitcoin address and retrieve the address:
sudo -u bitcoin bitcoin-cli -conf=/usr/local/etc/bitcoin.conf getnewaddress "MyBitcoin" sudo -u bitcoin bitcoin-cli -conf=/usr/local/etc/bitcoin.conf getaccountaddress "MyBitcoin"
- Get wallet info:
sudo -u bitcoin bitcoin-cli -conf=/usr/local/etc/bitcoin.conf getwalletinfo
- Get help:
sudo -u bitcoin bitcoin-cli -conf=/usr/local/etc/bitcoin.conf help
NOTE: To ensure you DO NOT lose your wallet, make sure to keep a backup of /var/db/bitcoind/wallet.dat
in a safe and secure location.
- Get the blockchain size used on disk:
du -ch /var/db/bitcoind/blocks/
- Check the blockchain download progress:
tail -f /var/db/bitcoind/debug.log
Install Bitcoin GUI Client¶
- NOTE: This is an optional step used in a graphical environment.
- Install bitcoin:
pkg install bitcoin
Resources¶
- https://en.bitcoin.it/wiki/Running_Bitcoin
- https://github.com/bitcoin/bitcoin/blob/master/contrib/debian/examples/bitcoin.conf
- https://bitcoin.org/en/full-node#other-linux-distributions
- https://bitcoin.org/en/full-node#network-configuration
- https://www.reddit.com/r/Bitcoin/comments/34amqa/freenas_full_node/
Updated by Daniel Curtis over 7 years ago
- Description updated (diff)
- Status changed from New to In Progress
- % Done changed from 0 to 70
Updated by Daniel Curtis over 7 years ago
- Description updated (diff)
- Status changed from In Progress to Resolved
- % Done changed from 70 to 100