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.
The following example is based on the presumptions:
you have a remote server running Ubuntu 16.04 LTS,
you have sudo access to that server,
you have completed the prior steps of CAS installation on your server, and
the server is online.
According to Bitcoin.org, a node requires at least:
200 GB free disk space,
2 GB of memory (RAM), and
200 gigabytes monthly bandwidth.
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.
Alternately, sudo may be used, prepend “sudo” in the following CLI instructions as necessary.
apt-get install software-properties-common |
It may already be installed. If so, great. No worries.
add-apt-repository ppa:bitcoin-abc/ppa |
The following lines should result:
Bitcoin ABC More info: https://launchpad.net/~bitcoin-abc/+archive/ubuntu/ppa Press [ENTER] to continue or ctrl-c to cancel adding it |
press <Enter> to continue.
The following text (with some variations) will be displayed and you will be returned to the command line prompt. The keyword to look for is the “Ok” on the last line:
gpg: key F08490BA: public key "Launchpad PPA for Bitcoin ABC" imported gpg: Total number processed: 1 gpg: imported: 1 (RSA: 1) Ok |
apt-get update apt-get install bitcoind |
The binary will be installed in /usr/bin and installation should normally only take a few minutes.
mkdir ~/.bitcoin cd ~/.bitcoin gunzip /usr/share/doc/bitcoind/examples/bitcoin.conf.gz cp /usr/share/doc/bitcoind/examples/bitcoin.conf bitcoin.conf |
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.
apt-get install python-minimal |
cd ~/.bitcoin wget https://raw.githubusercontent.com/bitcoin/bitcoin/master/share/rpcauth/rpcauth.py -O rpcauth.py |
chmod +x rpcauth.py |
./rpcauth.py AnyNameYouWantHere |
Save the name you entered above, the resulting token, AND the generated password. You'll need it in the next step.
The “AnyNameYouWantHere” is the “RPC User”, and
the generated password is your “RPC Password”.
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!
nano ~/.bitcoin/bitcoin.conf |
server=1 rpcport=8332 rpcauth=AnyNameYouWantHere:e5305a4d7e2c760b196882d2896f77$c5b5e7f6970f7c0544244189f45622887642dca2f36761bcecc1d8055fe8416d |
Replace the “rpcauth” info with the token generated in the previous step.
THE "rpcauth=..." IS ALL ONE LINE! (It won't fit properly on this web page.)
Save the file with Ctrl-X, accept the defaults, and press <Enter>.
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 |
It may take several minutes for Bitcoin Cash to completely start.
You can interrupt Bitcoin Cash at any time using the following command:
bitcoin-cli stop |
It will resume downloading from the point where it stopped the next time you start it.
It may take a few minutes to completely shut down.
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 |
Select “nano” (if given a choice of editors), and add the following to the end of the file:
@reboot bitcoind -daemon |
Save (using the defaults) and exit (using “nano”: ctrl-x).
You may also need to configure your firewall to allow inbound connections to port 8333.
You may also need to configure your firewall to allow inbound connections to port 8333.
User: this is the “RPC User” you created earlier. For this example we'll just say it's “rpcuser”.
Password: is the “RPC Password” created earlier. For this example, we'll make the password “rpcpw”.
Accountname: this is the account name of your wallet. An “account” is neither required nor suggested. Account usage is deprecated in bitcoind, however to view any existing accounts, type:
bitcoin-cli listaccounts |
On a newly installed server, the list is normally empty and may be safely ignored.
Enter the “Crypto Settings” menu in the left-hand column.
Click on the “+ ADD” button.
Create a suitable description, i.e. “Bitcoin Cash USD”.
Select “BTC” for the required “Crypto Currency*” setting.
Set Configuration Cash Currency* to “USD” (or whatever your local currency might be).
Set “Buy Rate Source” to whatever source you prefer.
Set “Minimum Cash Amount Per Transaction*” to zero – this enables any sale.
Select your Hot Wallet Buy source to “BitcoinABC/BitcoinClassic Cash Core”.
Enter the “Parameters” for the Hot Wallet Buy source as determined in the previous step.
Example: “http:rpcuser:rpcpw:127.0.0.1:8332”
Click on “SUBMIT” to save your settings.
Select “Test Hot Wallet Buy” from the RUN BTC SETTINGS TEST.
Presuming everything was entered correctly, you should receive confirmation of success!
You should also now configure the “Hot Wallet Sell” if you implement it.
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.
|
In CAS, navigate to “Crypto Settings” and update all settings that involve Bitcoin Cash.
bitcoin-cli stop |
crontab -e |
apt-get remove bitcoind |
If you are prompted to cleanup other dependencies, type:
apt-get autoremove |
add-apt-repository --remove ppa:bitcoin-abc/ppa |
Press [Enter] to confirm PPA removal, and finally update the APT repository:
apt-get update |
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.
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/ |
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.
Shut down any web server. Any unnecessary programs should be eliminated.
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 |
This will throttle bitcoind to use only 20% of the normal CPU load. You can modify this as you see fit, and periodic adjustment is suggested. After the blockchain has been initialized and the database is fully synced, the CPU load will drop. At that point, you may want to adjust it upwards. Your VPS may shut you down if you abuse their “acceptable use” policy.
The “-z” tells cpulimit to exit when bitcoind does, and “-b” sends it to the background.
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:
Change your SSH port – attempts to hack into your server become greatly reduced.
Implement fail2ban – it will reduce the effects of attacks against your server.
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 |