Project

General

Profile

Support #889

Updated by Daniel Curtis over 7 years ago

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 

 h2. Prepare the Environment 

 * Make sure the system is up to date: 
 <pre> 
 pkg update && pkg upgrade 
 </pre> 

 * Install sudo: 
 <pre> 
 pkg install sudo 
 </pre> 

 * Create a bitcoin user and group: 
 <pre> 
 pw add group bitcoin 
 pw add user -n bitcoin -g bitcoin -s /sbin/nologin -c "Bitcoin" 
 </pre> 

 h2. Install Bitcoin Daemon 

 * Install bitcoin-daemon: 
 <pre> 
 pkg install bitcoin-daemon bitcoin-utils 
 </pre> 

 * Create a basic bitcoin config file: 
 <pre> 
 vi /usr/local/etc/bitcoin.conf 
 </pre> 
 #* And set the following parameters: 
 <pre> 
 rpcuser=bitcoinrpc 
 rpcpassword=SuperSecretPassword 
 rpcallowip=127.0.0.1 
 rpcport=2300 
 daemon=1 
 server=1 
 gen=0 
 </pre> 

 * Create the bitcoin data directory: 
 <pre> 
 mkdir /var/db/bitcoind 
 chown bitcoin:bitcoin /var/db/bitcoind 
 </pre> 

 * Start and enable the server at boot: 
 <pre> 
 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 
 </pre> 

 h3. h3 Useful Commands bitcoin-cli commands 

 * Get blockchain and network stats 
 <pre> 
 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 
 </pre> 

 * Create a new bitcoin address and retrieve the address: 
 <pre> 
 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" 
 </pre> 

 * Get wallet info: 
 <pre> 
 sudo -u bitcoin bitcoin-cli -conf=/usr/local/etc/bitcoin.conf getwalletinfo 
 </pre> 

 * Get help: 
 <pre> 
 sudo -u bitcoin bitcoin-cli -conf=/usr/local/etc/bitcoin.conf help 
 </pre> 

 *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: 
 <pre> 
 du -ch /var/db/bitcoind/blocks/ 
 </pre> 

 * Check the blockchain download progress: 
 <pre> 
 tail -f /var/db/bitcoind/debug.log 
 </pre> 

 h2. Install Bitcoin GUI Client 

 * *NOTE*: This is an optional step used in a graphical environment. 

 * Install bitcoin: 
 <pre> 
 pkg install bitcoin 
 </pre> 

 h2. 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/

Back