Skip to content

Instantly share code, notes, and snippets.

@epipheus
Forked from cgcardona/steps.md
Created May 6, 2018 17:39
Show Gist options
  • Save epipheus/250e8e3c1c579dbbf6437ddf17b96716 to your computer and use it in GitHub Desktop.
Save epipheus/250e8e3c1c579dbbf6437ddf17b96716 to your computer and use it in GitHub Desktop.
Steps for running a Bitcoin Cash (ABC) node on digital ocean. Forked from these steps: https://medium.com/signal-chain-weekly/how-im-running-a-bitcoin-full-node-on-digital-ocean-for-40-a-month-dfc328ba9604

Setup

  1. Ubuntu 16.04.3 x64
  2. 2 GB Memory / 60 GB Disk
  3. 200 GB block storage volume

Create user

get ip-address from digital ocean

  1. ssh root@ip-address
  2. adduser bitcoin
  3. usermod -aG sudo bitcoin
  4. Copy public ssh key
  5. su - bitcoin
  6. mkdir ~/.ssh
  7. chmod 700 ~/.ssh
  8. vim ~/.ssh/authorized_keys Paste in public ssh key && save
  9. chmod 600 ~/.ssh/authorized_keys
  10. exit
  11. exit
  12. ssh bitcoin@ip-address

Format volume

Get volume-name from digital ocean

  1. sudo parted /dev/disk/by-id/scsi-0DO_Volume_volume-name mklabel gpt
  2. sudo parted -a opt /dev/disk/by-id/scsi-0DO_Volume_volume-name mkpart primary ext4 0% 100%
  3. sudo mkfs.ext4 /dev/disk/by-id/scsi-0DO_Volume_volume-name-part1
  4. sudo mkdir -p /mnt/volume-name-part1
  5. echo '/dev/disk/by-id/scsi-0DO_Volume_volume-name-part1 /mnt/volume-name-part1 ext4 defaults,nofail,discard 0 2' | sudo tee -a /etc/fstab
  6. sudo mount -a
  7. sudo chmod 777 /mnt/volume-name-part1

Install Bitcoin Cash

  1. sudo add-apt-repository ppa:bitcoin-abc/ppa
  2. sudo apt-get update
  3. sudo apt-get install bitcoind

Configure

  1. mkdir /mnt/volume-name-part1/Bitcoin
  2. mkdir ~/.bitcoin
  3. vim ~/.bitcoin/bitcoin.conf
  4. sudo vim /lib/systemd/system/bitcoin.service

Contents of ~/.bitcoin/bitcoin.conf

# Generated by https://jlopp.github.io/bitcoin-core-config-generator/

# This config should be placed in following path:
# ~/.bitcoin/bitcoin.conf

# [core]
# Specify a non-default location to store blockchain and other data.
datadir=/mnt/volume-name-part1/Bitcoin
# Set database cache size in megabytes; machines sync faster with a larger cache. Recommend setting as high as possible based upon machine's available RAM.
dbcache=1000
# Maintain a full transaction index, used by the getrawtransaction rpc call.
txindex=1

# [rpc]
# Accept command line and JSON-RPC commands.
server=1
# Username for JSON-RPC connections
rpcuser=bitcoin
# Password for JSON-RPC connections
rpcpassword=enterpasswordhere

# [wallet]
# Do not load the wallet and disable wallet RPC calls.
disablewallet=1

Contents of /lib/systemd/system/bitcoin.service

[Unit]
Description=Bitcoin's distributed currency daemon
After=network.target

[Service]
User=bitcoin
Group=bitcoin

Type=forking
PIDFile=/mnt/volume-name-part1/Bitcoin/bitcoind.pid
ExecStart=/usr/bin/bitcoind -daemon -pid=/mnt/volume-name-part1/Bitcoin/bitcoind.pid \
-conf=/home/bitcoin/.bitcoin/bitcoin.conf -datadir=/mnt/volume-name-part1/Bitcoin

Restart=always
PrivateTmp=true
TimeoutStopSec=60s
TimeoutStartSec=2s
StartLimitInterval=120s
StartLimitBurst=5

[Install]
WantedBy=multi-user.target

Run Bitcoin Cash

  1. sudo service bitcoin start
  2. bitcoin-cli getblockchaininfo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment