User avatar
arnoudk
Bronze Bitcoiner
Bronze Bitcoiner
Posts: 631
Joined: Wed Oct 21, 2015 4:04 am
Location: Belize

Correctly compiling Bitcoin Classic

Tue Feb 02, 2016 5:51 am

I noticed there are quite a few users who are running a self-compiled version if Bitcoin Classic, unfortunately an incorrectly compiled version.

When looking at bitnodes.21.co, you can see there are 117 "classic" nodes with a version Satoshi:0.12.99
/Satoshi:0.12.99/ (117)
In fact, there are more incorrectly compiled versions than correctly compiled versions (there are 86 Classic:0.11.2 nodes)
/Classic:0.11.2/ (86)
So what goes wrong?
Well, the default repository in github is not the one you want to build! So you need to checkout the tag classic-0.11.2.b1.

To check the version you are running from the linux command line:
./bitcoin-cli getnetworkinfo
{
...
"subversion" : "/Classic:0.11.2/",
...
}
You can also type "getnetworkinfo" into the console, if you run the GUI version.
Excited about the potential of Bitcoin Cash in the beautiful country of Belize.
Developer of the RegisterDocuments.com Document Registration Service (using the Bitcoin Cash blockchain).

User avatar
rogerver
Founder
Founder
Posts: 1868
Joined: Thu Sep 10, 2015 6:55 am

Donate BTC of your choice to 1PpmSbUghyhgbzsDevqv1cxxx8cB2kZCdP

Contact: Website Twitter

Re: Correctly compiling Bitcoin Classic

Sun Feb 07, 2016 4:14 am

Thanks for this useful tip!
It looks like there are lots of us who did this wrong.
Help spread Bitcoin by linking to everything mentioned here:
topic7039.html

iFixBTCmemoryIssues
Gold Bitcoiner
Gold Bitcoiner
Posts: 2682
Joined: Tue Nov 24, 2015 9:03 pm

Re: Correctly compiling Bitcoin Classic

Sun Feb 07, 2016 10:40 pm

Thanks for this useful tip!
It looks like there are lots of us who did this wrong.
Step by step instructions with pictures and we are good :)

If anyone would like this task, I will pay you for your time!

Instructions have always helped me out and so I pay it back!
Image

If you are running a version of Bitcoin Core, stop using it. Upgrade to Bitcoin Unlimited or Classic immediately.

Fix Your Unconfirmed Transaction.

Vote for the future of our Bitcoin network!

User avatar
arnoudk
Bronze Bitcoiner
Bronze Bitcoiner
Posts: 631
Joined: Wed Oct 21, 2015 4:04 am
Location: Belize

Re: Correctly compiling Bitcoin Classic

Sun Feb 07, 2016 11:30 pm

How I compiled Bitcoin Classic - step by step.

EDIT - Changed this to reflect Bitcoin Classic v.0.11.2.cl1 (was: the beta 2 version of this).

This is for a background service, not GUI

This is for Ubuntu (and compatible) linux distributions. This works on the raspberry pi, too. I am sure you would need to do all sorts of other things to compile this on windows.

My installation runs cr.yp.to daemontools as a process monitoring and restarting tool. I create a bitcoind usergroup and bitcoind user account, and store the blockchain in /data.

Step 1. Installing dependencies
apt-get -y update
apt-get -y install nano less build-essential libtool autotools-dev autoconf pkg-config libssl-dev libboost-all-dev git bsdmainutils libcurl4-openssl-dev
Step 2. Installing cr.yp.to daemontools
mkdir /package
chmod 1755 /package
cd /package
wget http://cr.yp.to/daemontools/daemontools-0.76.tar.gz
tar xvfz daemontools-0.76.tar.gz
cd admin/daemontools-0.76
nano -w src/error.h
This opens a text editor of error.h. In order to compile daemontools on Ubuntu, a single line needs to be changed. Change "extern int errno;" into "#include <errno.h>". Leave everything else. Exit with Control-X and choose Y to save.
package/install
nano -w /etc/init.d/svscanboot
Paste the following, and save:

Code: Select all

#!/bin/bash #chkconfig: 2345 80 05 #description: daemontools starter DESC="daemontools" NAME=svscanboot DAEMON=/command/svscanboot PIDFILE=/var/run/$NAME.pid SCRIPTNAME=/etc/init.d/$NAME #. /etc/init.d/functions PATH=/command:${PATH} export PATH d_start() { [ -x $DAEMON ] || exit 5 echo $"Starting service scan from daemontools: " $DAEMON& #$DAEMON return $? } d_stop() { echo $"Shut down not implemented" #killproc $NAME /command/svc -d /service/* pkill svscanboot pkill svscan pkill supervise return 0 } d_restart() { echo $"Restart not implemented " d_stop d_start return 0 } case "$1" in "start") d_start ;; "stop") d_stop ;; "restart") d_restart ;; *) echo $"Usage: $0 {start|stop|restart}" exit 2 esac
chmod 755 /etc/init.d/svscanboot
update-rc.d svscanboot defaults
mkdir /var/service
reboot
Once it has been rebooted, type "ps aux --forest" to see if you have something like this:

Code: Select all

root 445 0.0 0.0 1896 60 ? S 06:37 0:00 /bin/sh /command/svscanboot root 447 0.0 0.0 1832 324 ? S 06:37 0:02 \_ svscan /service root 448 0.0 0.0 1660 56 ? S 06:37 0:00 \_ readproctitle service errors: ............................................................................................................................................................................
Step 3. Installing Bitcoin Classic v.0.11.2.cl1
cd ~
git clone https://github.com/bitcoinclassic/bitcoinclassic
cd bitcoinclassic/
git checkout v0.11.2.cl1
./autogen.sh
./configure --disable-wallet
make
make install
mkdir /data
addgroup bitcoind
adduser --no-create-home --ingroup bitcoind --disabled-password --disabled-login bitcoind

mkdir /data/bitcoind
chown bitcoind:bitcoind /data/bitcoind/
Step 4. Configuring bitcoin launch script
mkdir /var/service/bitcoind
nano -w /var/service/bitcoind/run
Paste the following, and save:

Code: Select all

#!/bin/sh BTC_EXE=/usr/local/bin/bitcoind BTC_CONF=/etc/bitcoind.conf BTC_USER=bitcoind BTC_DATA=/data/bitcoind nice -n 5 setuidgid $BTC_USER $BTC_EXE -conf=$BTC_CONF -datadir=$BTC_DATA exec nice -n 5 setuidgid $BTC_USER $BTC_EXE -conf=$BTC_CONF -datadir=$BTC_DATA -reindex
chmod 755 /var/service/bitcoind/run
Now run bitcoind once, manually, and copy the rpcuser and rpcpassword lines it generates.
/var/service/bitcoind/run
nano -w /etc/bitcoind.conf
Paste the following, and save:
server=1
rpcuser=<enter from previous step>
rpcpassword=<enter from previous step>
ln -s /var/service/bitcoind /service
Bitcoin should now be launched. In "ps aux --forest" you will see something like this:

Code: Select all

root 445 0.0 0.0 1896 60 ? S 06:37 0:00 /bin/sh /command/svscanboot root 447 0.0 0.0 1832 324 ? S 06:37 0:02 \_ svscan /service root 781 0.0 0.0 1672 336 ? S 06:42 0:00 | \_ supervise bitcoind bitcoind 782 137 24.0 355584 228312 ? R<l 06:42 1279:30 | \_ /usr/local/bin/bitcoind -conf=/etc/bitcoind.conf -datadir=/data/bitcoind root 448 0.0 0.0 1660 56 ? S 06:37 0:00 \_ readproctitle service errors: ............................................................................................................................................................................
Step 5. Making sure bitcoin-cli command works
mkdir ~/.bitcoin
ln -s /etc/bitcoind.conf ~/.bitcoin/bitcoin.conf
Step 6. Verify you are running Bitcoin Classic 0.11.2
bitcoin-cli getnetworkinfo
This should return:

Code: Select all

{ "version" : 110200, "subversion" : "/Classic:0.11.2/", ... <snip> }
Step 7. Making sure your node can be reached from the Internet
Visit bitnodes.21.co, and in the part that says "Join the network", click Check Node. It should already display your IP address, but you can change it if it is different. If it complains that "yourIP:8333 is unreachable" then you need to configure your router to forward port 8333 to your computer. This is different for every router, but just google your router make and model, and port forwarding, and you should find instructions.
Last edited by arnoudk on Thu Feb 11, 2016 8:56 pm, edited 1 time in total.
Excited about the potential of Bitcoin Cash in the beautiful country of Belize.
Developer of the RegisterDocuments.com Document Registration Service (using the Bitcoin Cash blockchain).

iFixBTCmemoryIssues
Gold Bitcoiner
Gold Bitcoiner
Posts: 2682
Joined: Tue Nov 24, 2015 9:03 pm

Re: Correctly compiling Bitcoin Classic

Sun Feb 07, 2016 11:35 pm

How I compiled Bitcoin Classic - step by step.

This is for a background service, not GUI

This is for Ubuntu (and compatible) linux distributions. This works on the raspberry pi, too. I am sure you would need to do all sorts of other things to compile this on windows.

My installation runs cr.yp.to daemontools as a process monitoring and restarting tool. I create a bitcoind usergroup and bitcoind user account, and store the blockchain in /data.

Step 1. Installing dependencies
apt-get -y update
apt-get -y install nano less build-essential libtool autotools-dev autoconf pkg-config libssl-dev libboost-all-dev git bsdmainutils libcurl4-openssl-dev
Step 2. Installing cr.yp.to daemontools
mkdir /package
chmod 1755 /package
cd /package
wget http://cr.yp.to/daemontools/daemontools-0.76.tar.gz
tar xvfz daemontools-0.76.tar.gz
cd admin/daemontools-0.76
nano -w src/error.h
This opens a text editor of error.h. In order to compile daemontools on Ubuntu, a single line needs to be changed. Change "extern int errno;" into "#include <errno.h>". Leave everything else. Exit with Control-X and choose Y to save.
package/install
nano -w /etc/init.d/svscanboot
Paste the following, and save:

Code: Select all

#!/bin/bash #chkconfig: 2345 80 05 #description: daemontools starter DESC="daemontools" NAME=svscanboot DAEMON=/command/svscanboot PIDFILE=/var/run/$NAME.pid SCRIPTNAME=/etc/init.d/$NAME #. /etc/init.d/functions PATH=/command:${PATH} export PATH d_start() { [ -x $DAEMON ] || exit 5 echo $"Starting service scan from daemontools: " $DAEMON& #$DAEMON return $? } d_stop() { echo $"Shut down not implemented" #killproc $NAME /command/svc -d /service/* pkill svscanboot pkill svscan pkill supervise return 0 } d_restart() { echo $"Restart not implemented " d_stop d_start return 0 } case "$1" in "start") d_start ;; "stop") d_stop ;; "restart") d_restart ;; *) echo $"Usage: $0 {start|stop|restart}" exit 2 esac
chmod 755 /etc/init.d/svscanboot
update-rc.d svscanboot defaults
mkdir /var/service
reboot
Once it has been rebooted, type "ps aux --forest" to see if you have something like this:

Code: Select all

root 445 0.0 0.0 1896 60 ? S 06:37 0:00 /bin/sh /command/svscanboot root 447 0.0 0.0 1832 324 ? S 06:37 0:02 \_ svscan /service root 448 0.0 0.0 1660 56 ? S 06:37 0:00 \_ readproctitle service errors: ............................................................................................................................................................................
Step 3. Installing Bitcoin Classic v.0.11.2.cl1.b2
cd ~
git clone https://github.com/bitcoinclassic/bitcoinclassic
cd bitcoinclassic/
git checkout v0.11.2.cl1.b2
./autogen.sh
./configure --disable-wallet
make
make install
mkdir /data
addgroup bitcoind
adduser --no-create-home --ingroup bitcoind --disabled-password --disabled-login bitcoind

mkdir /data/bitcoind
chown bitcoind:bitcoind /data/bitcoind/
Step 4. Configuring bitcoin launch script
mkdir /var/service/bitcoind
nano -w /var/service/bitcoind/run
Paste the following, and save:

Code: Select all

#!/bin/sh BTC_EXE=/usr/local/bin/bitcoind BTC_CONF=/etc/bitcoind.conf BTC_USER=bitcoind BTC_DATA=/data/bitcoind nice -n 5 setuidgid $BTC_USER $BTC_EXE -conf=$BTC_CONF -datadir=$BTC_DATA exec nice -n 5 setuidgid $BTC_USER $BTC_EXE -conf=$BTC_CONF -datadir=$BTC_DATA -reindex
chmod 755 /var/service/bitcoind/run
Now run bitcoind once, manually, and copy the rpcuser and rpcpassword lines it generates.
/var/service/bitcoind/run
nano -w /etc/bitcoind.conf
Paste the following, and save:
server=1
rpcuser=<enter from previous step>
rpcpassword=<enter from previous step>
ln -s /var/service/bitcoind /service
Bitcoin should now be launched. In "ps aux --forest" you will see something like this:

Code: Select all

root 445 0.0 0.0 1896 60 ? S 06:37 0:00 /bin/sh /command/svscanboot root 447 0.0 0.0 1832 324 ? S 06:37 0:02 \_ svscan /service root 781 0.0 0.0 1672 336 ? S 06:42 0:00 | \_ supervise bitcoind bitcoind 782 137 24.0 355584 228312 ? R<l 06:42 1279:30 | \_ /usr/local/bin/bitcoind -conf=/etc/bitcoind.conf -datadir=/data/bitcoind root 448 0.0 0.0 1660 56 ? S 06:37 0:00 \_ readproctitle service errors: ............................................................................................................................................................................
Step 5. Making sure bitcoin-cli command works
mkdir ~/.bitcoin
ln -s /etc/bitcoind.conf ~/.bitcoin/bitcoin.conf
Step 6. Verify you are running Bitcoin Classic 0.11.2
bitcoin-cli getnetworkinfo
This should return:

Code: Select all

{ "version" : 110200, "subversion" : "/Classic:0.11.2/", ... <snip> }
Step 7. Making sure your node can be reached from the Internet
Visit bitnodes.21.co, and in the part that says "Join the network", click Check Node. It should already display your IP address, but you can change it if it is different. If it complains that "yourIP:8333 is unreachable" then you need to configure your router to forward port 8333 to your computer. This is different for every router, but just google your router make and model, and port forwarding, and you should find instructions.
You see, tutorials like this one you wrote and posted - are fantastic!!!!!

Excellent contribution :)
Image

If you are running a version of Bitcoin Core, stop using it. Upgrade to Bitcoin Unlimited or Classic immediately.

Fix Your Unconfirmed Transaction.

Vote for the future of our Bitcoin network!

User avatar
arnoudk
Bronze Bitcoiner
Bronze Bitcoiner
Posts: 631
Joined: Wed Oct 21, 2015 4:04 am
Location: Belize

Re: Correctly compiling Bitcoin Classic

Thu Feb 11, 2016 8:57 pm

I've edited my how-to above, to reflect that Bitcoin Classic v.0.11.2 has been officially released. The how-to was still showing how to build the "beta 2" version - which is identical to the released version. It is now building Bitcoin Classic v.0.11.2.cl1 (instead of Bitcoin Classic v.0.11.2.cl1.b2)
Excited about the potential of Bitcoin Cash in the beautiful country of Belize.
Developer of the RegisterDocuments.com Document Registration Service (using the Bitcoin Cash blockchain).

User avatar
ronnieb
Nickel Bitcoiner
Nickel Bitcoiner
Posts: 177
Joined: Sat Oct 03, 2015 6:15 pm
Location: Idaho
Contact: Website Facebook

Re: Correctly compiling Bitcoin Classic

Thu Feb 11, 2016 10:44 pm

I've edited my how-to above, to reflect that Bitcoin Classic v.0.11.2 has been officially released. The how-to was still showing how to build the "beta 2" version - which is identical to the released version. It is now building Bitcoin Classic v.0.11.2.cl1 (instead of Bitcoin Classic v.0.11.2.cl1.b2)
Good looking out sir!!!!!

Return to “Bitcoin Classic”

Who is online

Users browsing this forum: No registered users and 17 guests