Setup Bitcoin Node

Tutorial


Exbita requires installed and running Bitcoind daemon in different Linux based VPS server in order to sync with Bitcoin Blockchain and get the latest transactions to update users wallet and keep separately crypto wallets from the main Exbita server. The following guide below helps to get started.

These instructions belong to Linux (Debian/Ubuntu) based servers.

1. Ssh to the server and install packages using command-line interface:

sudo apt update
sudo apt install build-essential
sudo apt install libtool autotools-dev autoconf
sudo apt install libssl-dev
sudo apt install libboost-all-dev
sudo apt install php7.4
sudo apt install php7.4-curl

Replace the path 7.4 with your PHP version, if needed.

cd ~

wget https://bitcoincore.org/bin/bitcoin-core-0.18.1/bitcoin-0.18.1-x86_64-linux-gnu.tar.gz
tar bitcoin-0.19.1-x86_64-linux-gnu.tar.gz

sudo ln -d ~/bitcoin-0.18.1/bin/bitcoind /usr/bin/bitcoind
sudo ln -d ~/bitcoin-0.18.1/bin/bitcoind-cli /usr/bin/bitcoind-cli

Please note that the link to download Bitcoin Core might be changed. You can get the latest link from this page https://bitcoincore.org/en/download/ and then replace the references above accordingly.

If you want to verify the checksum of the file, please follow the instructions from Bitcoin Core Website https://bitcoincore.org/en/download/

2. Setup bitcoin config file:

mkdir ~/.bitcoin
cd ~/.bitcoin/
touch bitcoin.conf

3. Add the following lines to newly created bitcoin.conf file

** Add config to bitcoin.conf file **

rpcauth=
mainnet=1
testnet=0
prune=950
walletnotify=
rpcport=18332
server=1
[test]
rpcport=18332
rpcbind=
prune=550
walletnotify=
rpcauth=

4. Upload to home directory btc folder from Exbita's folder /scripts

5. Go inside btc folder and run rpcauth.py file

# replace mysername mypassword strings with your real username and password

python3 -i rpcauth.py myusername mypassword

You will get rpcauth value that should be replaced with empty variable on bitcoin.conf file

rpcauth=myusername:5d5788166a651c3c76e596e128df3c0b$1e2c916944b92a769e3f8e51be47c1def8480b6316ab79565e995282473cbaff

6. Add Exbita's server IP to bitcoin.conf file

Replace the second empty variable rpcallowip= with Exbita's server IP

# replace xxx.x.x.x with your remote web app server without http:// and BITCOIN_NODE_SERVER_IP
replace with Bitcoin Node server
rpcallowip=xxx.x.x.x
rpcallowip=BITCOIN_NODE_SERVER_IP

Add walletnotify path to bitcoin.conf file

# Replace HOMEFOLDER with actual path of home directory
# Replace http://server-ip with your web domain or ip
walletnotify=php HOMEFOLDER/btc %s http://exbita-server-ip

So your final bitcoin.conf file looks like as follows (it should contain both MAINNET AND TESTNET configuration):

rpcauth=myusername:5d5788166a651c3c76e596e128df3c0b$1e2c916944b92a769e3f8e51be47c1def8480b6316ab79565e995282473cbaff
mainnet=1
testnet=0
prune=950
rpcport=18332
rpcallowip=127.0.0.1
rpcallowip=HERE_IS_EXBITA_SERVER_IP
rpcallowip=BITCOIN_NODE_SERVER_IP
walletnotify=php /root/btc/walletnotify.php %s http://exbita-server-ip
rpcbind=BITCOIN_NODE_SERVER_IP
server=1
[test]
rpcport=18332
rpcallowip=HERE_IS_EXBITA_SERVER_IP
rpcallowip=BITCOIN_NODE_SERVER_IP
rpcbind=BITCOIN_NODE_SERVER_IP
prune=550
walletnotify=php /root/btc %s http://exbita-server-ip
rpcauth=myusername:5d5788166a651c3c76e596e128df3c0b$1e2c916944b92a769e3f8e51be47c1def8480b6316ab79565e995282473cbaff

NOTE: If you want to switch to TESTNET, you can set mainnet value to 0 and testnet to 1 and add prune option to avoid downloading full bitcoin node, so your final config file looks as follows:

rpcauth=myusername:5d5788166a651c3c76e596e128df3c0b$1e2c916944b92a769e3f8e51be47c1def8480b6316ab79565e995282473cbaff
mainnet=0
testnet=1
prune=950
rpcport=18332
rpcallowip=127.0.0.1
walletnotify=php /root/btc/walletnotify.php %s http://exbita-domain
rpcbind=BITCOIN_NODE_SERVER_IP
server=1
[test]
rpcport=18332
rpcbind=BITCOIN_NODE_SERVER_IP
prune=550
walletnotify=php /root/btc/walletnotify.php %s http://exbita-server-ip
rpcauth=myusername:5d5788166a651c3c76e596e128df3c0b$1e2c916944b92a769e3f8e51be47c1def8480b6316ab79565e995282473cbaff

Replace http://exbita-domain to your domain name with a proper protocol (if you use https replace protocol accordingly)

You can remove prune option from mainnet section to download full Bitcoin node.

7. Run Bitcoind daemon:

  • Type crontab -e
  • Add the following line:
@reboot bitcoind -daemon
  • Save crontab file
  • Reboot the server
  • Wait until the server turns on and fill newly created Bitcoind credentials on Bitcoind Settings page

Please note: The port 18332 must be opened on server

Please note: It takes several hours up to days (depends on server capacity) to sync bitcoin full node if prune option wasn't provided. With the prune option, it takes up to 1-3 hours to sync with Bitcoin blockchain. After this process finishes, the app will start displaying new transactions instantly.

Please check Admin Dashboard ->Health Status section after you configured this service to make sure it is up and running.

FAQ:

1. How to withdraw fees/profits?

Exbita doesn't support any web interface to withdraw BTC for security reasons. In order to withdraw using bitcoin-cli, please do the following steps:

1. SSH into Bitcoin Node Server

2. Run this command:

bitcoin-cli -rpcconnect=BITCOIN_REMOTE_IP -rpcuser=BITCOIN_REMOTE_USER -rpcpassword=BITCOIN_REMOTE_PASSWORD sendtoaddress

3. If you want to backup .dat file you need to run the following command:

bitcoin-cli -rpcconnect=BITCOIN_REMOTE_IP -rpcuser=BITCOIN_REMOTE_USER -rpcpassword=BITCOIN_REMOTE_PASSWORD backupwallet

4. You will receive a transaction hash as a response.



Previous

Overview