Motivation: To create comprehensive instructions for anyone to follow to allow users to deploy a full Bitcoin Classic node permanently on using Microsoft's Azure.
If you have any kind of company or startup, maybe sign up through https://www.microsoft.com/bizspark/signup/ and get $150 a month per employee of free Azure time for 3 years.
- Secondary drive large enough for the block chain growth
- No wallet
- No UI
- Allow to be discovered by opening firewall
- Good uptime
Start from the Microsoft Azure portal https://portal.azure.com
- Basics
- Select New -> Compute -> Ubuntu Server 14.04 LTS -> Create
- Enter Name, e.g. BitcoinClassic-1
- Enter User name, e.g. satoshi
- Set Authentication type, e.g. Password
- Set a strong password
- Make a Resource group, e.g. Bitcoin
- Select Location, e.g. North Europe
- Click OK
- Size
- Select View all
- Select A2 Standard (2 cores, 3.5 GB RAM) as a minimum while the code is built and blockchain is synced, then scale back to A1 when all is set.
- Click Select
- Settings
- Keep suggested Storage, Network and Monitoring settings
- Click OK
- Summary
- Click OK
- Wait for deployment to finish
- Assign DNS name label
- Click the public IP address -> All settings -> Configuration
- Enter a DNS name label, e.g. bitcoinclassic21
- Click the Save icon
- Click Microsoft Azure in the top-left corner
- Select Virtual machines -> BitcoinClassic-1
- Select Disks -> Attach new
- Size (GB): 120
- Click OK
- Wait until the new disk has been attached
- Click All resources from the left menu
- Select Network security group - looks like a shield
- Select Inbound security rules
- Click Add
- Enter name, e.g. Bitcoin
- Change Protocol to TCP
- Change Destination port range to 8333
- Click OK
You may want to restrict access to port 22 (SSH port) to your own IP.
Now we can SSH into the VM, e.g. satoshi@bitcoinclassic21.northeurope.cloudapp.azure.com If connection was not made, try restarting the server.
Format the data drive using ext3 filesystem and mount it. The secondary drive should be named /dev/sdc
sudo fdisk /dev/sdc
n
p
1
(Enter)
(Enter)
w
sudo mkfs.ext3 /dev/sdc1
sudo mkdir /media/data
sudo mount /dev/sdc1 /media/data
cd /media/data
sudo su -c "echo '/dev/sdc1 /media/data ext3 defaults 0 0' >> /etc/fstab"
For the software to build a few dependencies must be installed first. You can install them by the following commands.
sudo apt-get update
sudo apt-get -y install python-software-properties
sudo apt-get -y install build-essential libboost-all-dev automake libtool autoconf
sudo apt-get -y install libdb++-dev
sudo apt-get -y install libboost-all-dev
sudo apt-get -y install pkg-config
sudo apt-get -y install libevent-dev
sudo apt-get -y install libssl-dev
sudo apt-get -y install libqt5gui5 libqt5core5a libqt5dbus5 qttools5-dev qttools5-dev-tools libprotobuf-dev protobuf-compiler
sudo apt-get -y install git
Now we will get the Bitcoin Classic source from GitHub and make the executables.
cd ~/
sudo git clone https://github.com/bitcoinclassic/bitcoinclassic
cd bitcoinclassic
sudo git checkout classic-0.11.2.b1
sudo ./autogen.sh
sudo ./configure --with-cli=yes --with-gui=no --disable-wallet
sudo make
sudo make install
Note, if there is an error on autogen.sh, re install the pre reqs.
We will run bitcoind for a few seconds once so it generates the proper directories.
bitcoind -server
Write down or copy the generated rpcuser and rpcpassword values.
Run the following to generate the bitcoin.conf file - replace rpcpassword with generate values.
Example:
echo 'rpcuser=bitcoinrpc' > ~/.bitcoin/bitcoin.conf
echo 'rpcpassword=XXXXyy1yXXXyyX1XXy1XXy1XXXy1Xy1y11XyXyXyyXXy' >> ~/.bitcoin/bitcoin.conf
echo 'server=1' >> ~/.bitcoin/bitcoin.conf
Verify config-file values are in the file.
more ~/.bitcoin/bitcoin.conf
We now move the blocks from the default location to the secondary drive, and create a static link.
cd ~/.bitcoin
sudo rsync -a ~/.bitcoin/blocks /media/data/
sudo rm -R ~/.bitcoin/blocks
ln -s /media/data/blocks blocks
To check this has worked perform the following.
cd ~/.bitcoin
ls -al
"blocks" should be in a cyan colour and look like this: blocks -> /media/data/blocks
Node that it's the current user, satoshi, that has file access.
The daemon should now be ready to start.
Type the following to start the node.
bitcoind -daemon
You should see "Bitcoin server starting"
Type the following to run a small test
bitcoin-cli getinfo
The output should be something like this
{
"version" : 110200,
"protocolversion" : 70002,
"blocks" : 125656,
"timeoffset" : 0,
"connections" : 8,
"proxy" : "",
"difficulty" : 244112.48777434,
"testnet" : false,
"relayfee" : 0.00005000,
"errors" : ""
}Also, go to https://getaddr.bitnodes.io/ and type in the node network address, e.g. bitcoinclassic21.northeurope.cloudapp.azure.com, and click "CHECK NODE". Something like the following should show to verify you are running Bitcoin Classic:
bitcoinclassic42.northeurope.cloudapp.azure.com:8333 /Classic:0.11.2/
You can check the drive space by using this command
df -h
Debug log files are located at ~/.bitcoin/debug.log You can use the command this command to monitor log files:
sudo tail -f ~/.bitcoin/debug.log