Contents updated for v.20

This is a step-by-step guide for adding a Bitcoin Cash (BitcoinABC) node as a Hot Wallet Buy source. This guide was created based on version 0.16.2 of the BitcoinABC node software. This is only an example and not to be construed as an endorsement for any particular exchange or wallet.

BitcoinABC  runs as a daemon on your VPS (bitcoind), controlled by a simple command interface (bitcoin-cli). Understand that this is not the same as accessing a Bitcoin Cash node run by someone else. This guide is for installing and operating your own node on your own server with CAS.

The following guide is written with instructions to be executed as root. This is discouraged, but simplicity is the goal in mind - not security. You should modify these procedures to safeguard your assets as needed. You will be a target for hackers, and your Bitcoin Cash will be at risk. You are strongly encouraged to implement any and all restrictions available to you to protect your server from unauthorized access. These enhancements however, are beyond the scope of this guide.

Before you begin:

The following example is based on the presumptions:

According to Bitcoin.org, a node requires at least:

Bitcoin Cash and Bitcoin Core use some of the same binaries. This means you may run into problems running both on the same server. Running both on the same CAS server is outside the scope of our supported configurations at this time. It is possible to do it, but this guide isn't intended to accomplish that end. Please submit a request to General Bytes' support if this is a critically important feature for you, and we'll try to accommodate your needs when resources permit. In the meantime, if you wish to run both, you need to choose which one will “listen” to the network on port 8333 and make the other one “deaf” on your server by adding “listen=0” to your config file.

The bitcoind documentation further suggests you allow several days for the block chain to completely download! In our testing, it took over 24 hours.

Download and install the components:

First, open a terminal window and login as root. 

Add PPA installation functions to your server:

apt-get install software-properties-common

Download and install the Bitcoin Cash daemon on your server:

add-apt-repository ppa:bitcoin-abc/ppa
Bitcoin ABC
More info: https://launchpad.net/~bitcoin-abc/+archive/ubuntu/ppa
Press [ENTER] to continue or ctrl-c to cancel adding it
gpg: key F08490BA: public key "Launchpad PPA for Bitcoin ABC" imported
gpg: Total number processed: 1
gpg:               imported: 1  (RSA: 1)
Ok

Now update Ubuntu and start the installation:

apt-get update
apt-get install bitcoind

Create the data directory and extract the .conf file:

mkdir ~/.bitcoin
cd ~/.bitcoin
gunzip /usr/share/doc/bitcoind/examples/bitcoin.conf.gz
cp /usr/share/doc/bitcoind/examples/bitcoin.conf bitcoin.conf

Create an RPC token for CAS to communicate with BitcoinABC:

RPC is a method of communication between two programs. In this case, the two programs are CAS and BitcoinABC. The RPC token is designed to eliminate the need for hard-coded passwords in the involved configuration and script files. You will receive a password here ONCE. This password is required for CAS; it's your “RPC Password”. You must save it, preferably in a secure note file or database.

First, ensure that python is installed on your server:

apt-get install python-minimal

Download rpcauth.py on GitHub 

cd ~/.bitcoin
wget https://raw.githubusercontent.com/bitcoin/bitcoin/master/share/rpcauth/rpcauth.py -O rpcauth.py

Modify the file permissions to allow the script to execute:

chmod +x rpcauth.py

Finally, generate the token:

./rpcauth.py AnyNameYouWantHere

Modify the bitcoin.conf configuration file:

While you might (under certain circumstances) might want to start the daemon exclusively from a command line, we urge you to modify the following settings within bitcoin.conf and run bitcoind without parameters. Keep it simple!

Open the bitcoin.conf file:

nano ~/.bitcoin/bitcoin.conf

Change or add the following settings:

server=1
rpcport=8332
rpcauth=AnyNameYouWantHere:e5305a4d7e2c760b196882d2896f77$c5b5e7f6970f7c0544244189f45622887642dca2f36761bcecc1d8055fe8416d

Start the BitcoinABC node:

From Bitcoin.org: “When Bitcoin Core daemon first starts, it will begin to download the block chain. This step will take at least several days, and it may take much more time on a slow Internet connection or with a slow computer. During the download, Bitcoin Core will use a significant part of your connection bandwidth.”

Type:

bitcoind -daemon

You can interrupt Bitcoin Cash at any time using the following command:

bitcoin-cli stop 

You will eventually want bitcoind to start automatically when the server boots. You should ensure everything works before you do this, though. To have bitcoind automatically startup at boot time, type:

crontab -e
@reboot bitcoind -daemon
note

You may also need to configure your firewall to allow inbound connections to port 8333.

See: Configuring Server Firewalls

You may also need to configure your firewall to allow inbound connections to port 8333.

See: Configuring Server Firewalls

Now assemble the required information for CAS:

bitcoin-cli listaccounts

Next, add a new crypto-currency type to CAS:

  1. Enter the “Crypto Settings” menu in the left-hand column. 

  2. Click on the “+ ADD” button. 

  3. Create a suitable description, i.e. “Bitcoin Cash USD”.

  4. Select “BTC” for the required “Crypto Currency*” setting.

  5. Set Configuration Cash Currency* to “USD” (or whatever your local currency might be).

  6. Set “Buy Rate Source” to whatever source you prefer.

  7. Set “Minimum Cash Amount Per Transaction*” to zero – this enables any sale.

  8. Select your Hot Wallet Buy source to “BitcoinABC/BitcoinClassic Cash Core”.

  9. Enter the “Parameters” for the Hot Wallet Buy source as determined in the previous step.

  1. Click on “SUBMIT” to save your settings.

Finally, test it out:

 Select “Test Hot Wallet Buy” from the RUN BTC SETTINGS TEST.

UNINSTALLING BITCOIND:

Uninstallation is essentially the reverse order of installation. The following procedures will also delete any unposted transactions and is completely irreversible. Any Bitcoin in your local wallet will be lost forever.

  • THIS WILL DELETE ALL PENDING TRANSACTIONS IN YOUR LOCAL WALLET!!

  • THIS PROCEDURE MAY RESULT IN PERMANENT DATA AND/OR COIN LOSS!!

Change your Crypto settings in CAS:.

Login to your terminal as root (or sudo – depending on how you installed bitcoind to begin with).

Shut down the bitcoind daemon:

bitcoin-cli stop

Remove any startup references in crontab:

crontab -e

Remove bitcoind from APT:

apt-get remove bitcoind
apt-get autoremove 

Remove the PPA reference within APT:

add-apt-repository --remove ppa:bitcoin-abc/ppa
apt-get update
note

You may also need to configure your firewall to deny inbound connections to port 8333.

You may also need to configure your firewall to deny inbound connections to port 8333.

That's it.


 Bitcoin Cash (bitcoind) has been uninstalled from your server, however the data files are left behind. This final step deletes all traces of Bitcoin Cash on your server!!

By removing your .bitcoin directory, you are also removing your wallets/addresses and access to any BTC in those wallets. When you run bitcoind, it typically creates a hidden directory in the home directory of the running user. If you followed this guide, then it should be located in: /root/.bitcoin and this line will delete the entire directory (and wallet/transactions). This may take a few minutes:

To PERMANENTLY AND IRREVERSIBLY delete the /root/.bitcoin directory:

rm -rf /root/.bitcoin/

TROUBLESHOOTING BITCOIND:

The bitcoind daemon is demanding when implementing a full node. While discouraged by the Bitcoin community and General Bytes, you may elect to run a “pruning” node by inserting:

prune=550

into the bitcoin.conf file. This will significantly reduce the resource demands of bitcoind. As of this writing, the blockchain is about 155gb, and is growing by about 5gb per month. You can find the current size here:

https://blockchain.info/charts/blocks-size

A pruning node as described above is a substantial security risk when operating a BATM. Per the Bitcoin wiki at: https://en.bitcoin.it/wiki/Full_node :

“Lightweight nodes are sometimes able to be temporarily tricked into accepting transactions or blocks that are not actually valid. This could cause serious financial damage, especially for websites that automatically process Bitcoin transactions. Full nodes provide the maximum security possible, and so they should be used by all businesses, and also by regular users whenever doing so is convenient.”

Additionally, you may discover that running a full node taxes your system dramatically. The following suggestions are offered to assist you in this regard. These pitfalls have nothing to do with CAS, and are offered merely as a courtesy to our valued customers. You are strongly encouraged to run a full node, run bitcoind from a script, and implement the bitcoin.conf file located in the bitcoind directory.

Excessive server CPU load:

Use “cpulimit” to throttle bitcoind's CPU usage. Download cpulimit:

apt-get install cpulimit

and then change the bitcoind startup line in your script as follows:

cpulimit -z -b -l 20 bitcoind 

Your exposure as a Bitcoin Cash node will draw some unwanted attention. You may become the victim of targeted attacks. Some suggested ways to mitigate this:

Excessive server memory usage:

Try reducing the number of heap arenas that bitcoind allocates by default. This should have an insignificant effect upon the program's performance, but may dramatically reduce your server's memory consumption. Add the following to your bitcoind startup script:

#!/bin/bash
export MALLOC_ARENA_MAX=1
bitcoind -daemon