How to install coinpunk on Centos 6.5

Coinpunk is a bitcoin wallet platform. It is open source and is available for free, you can see the repository HERE

In the docs section there are available tutorials on how to install coinpunk on OSX and Ubuntu. However there isn’t one on how to install coinpunk on Centos. While Ubuntu and Centos are both linux distros the installation procedure must be modified. In this tutorial I will try to walk you through how to  install coinpunk on Centos.

The first thing you must do on CentOS 6.5 is install bitcoind. For coinpunk you must use/install a specific version of bitcoind which can be found here:

wget https://github.com/sipa/bitcoin/archive/watchonly.tar.gz

now we will untar the tarball and start installing dependencies.

tar -zxf watchonly.tar.gz
 cd bitcoin-watchonly

You can find a tutorial on how to install the necessary dependencies HERE I will briefly walk through how to do that. If you don’t already have it you will need to install git.

yum install git-core

first we update yum and make sure your original deps are up to date:

yum update

We will need to install some dependencies from source so lets get to it, create a working directory and start compiling

Berkeley DB 4.8.30

wget http://download.oracle.com/berkeley-db/db-4.8.30.tar.gz
tar zxvf db-4.8.30.tar.gz
cd db-4.8.30/build_unix
../dist/configure --prefix=/home/bitcoind/bitcoind/deps --enable-cxx
make && make install

OpenSSL

wget https://www.openssl.org/source/openssl-1.0.1g.tar.gz
tar zxvf openssl-1.0.1g.tar.gz
cd openssl-1.0.1g
./config --prefix=/home/bitcoind/bitcoind/deps --openssldir=/home/bitcoind/bitcoind/deps/openssl -fPIC shared
make && make install

Boost

wget http://sourceforge.net/projects/boost/files/boost/1.55.0/boost_1_55_0.tar.bz2/download -O boost_1_55_0.tar.bz2
tar jxvf boost_1_55_0.tar.bz2
cd boost_1_55_0
./bootstrap.sh
./b2 --prefix=/home/bitcoind/bitcoind/deps link=static runtime-link=static install

Next we need to compile bitcoind. Navigate to the bitcoin-watch directory and run

./autogen.sh
./configure --without-qt
make
make install

If you get an error that looks something like this:

c:/deps/boost_1_52_0/boost/thread/detail/thread_group.hpp:74: undefined reference to `boost::thread::join()'
obj/bitcoinrpc.o: In function `thread<boost::_bi::bind_t<unsigned int, boost::_mfi::mf0<unsigned int, boost::asio::io_service>, boost::_bi::list1<boost::_bi::value<boost::asio::io_service*> > > >':

Then you will need to link the boost directory where the libraries are installed. Here is how you would run your compile commands:

./autogen.sh
./configure --with-boost-libdir=/usr/lib/ --without-qt
make
make install

If everything compiles then we will now configure the bitcoin.conf file

mkdir -p ~/.bitcoin
vim ~/.bitcoin/bitcoin.conf

Now in the bitcoin.conf file put

rpcuser=YOURUSERNAME
rpcpassword=YOURPASSWORDDONTUSETHISORYOUWILLGETROBBED
txindex=1
testnet=1

This will make sure that bitcoind starts up in the testnet so you can test functionality. I would let bitcoind run overnight not on the testnet and synchronize with the blockchain before continuing but it is up to you.

If you get an error or still having problems compiling check out this OTHER tutorial on how to install bitcoind on CentOS 5.5 just remember that you need a specific version of bitcoind for coinpunk so when following the instructions download the right version. Still all of the commands are the same.

Once you have bitcoind up and running and the blockchain updated lets start installing coinpunk.

First we need to clone the repository and then install the nodejs dependancies:

git clone https://github.com/kyledrake/coinpunk.git
cd coinpunk
npm install

Now we will setup the config files. Navigate to ~/coinpunk and add the config files from the templates.

cp config.template.json config.json

go ahead and do the same to the config template in ~/coinpunk/public

cp config.template.json config.json

Now we will edit the config files to connect to bitcoind. The ports are 18332 for testnet and 8332 for prodcution.

vim ~/coinpunk/config.json
{
"default": {
"bitcoind": "http://rpcuser:[email protected]:18332",
"pricesUrl": "https://bitpay.com/api/rates",
"testnet": true,
"httpPort": 18332,
"httpsPort": 8081,
"sslKey": "./coinpunk.key",
"sslCert": "./coinpunk.crt"
}

Now we will also have to setup the config file in the public folder, which looks like this:

{
"network": "testnet",
"transactionFee": 0.0005
}

Since we will be first launching coinpunk on the tesnet then keep the line network:testnet, otherwise if you will compile for production change it from testnet to prod.

 

Now navigate back to the coinpunk folder in ~/coinpunk and fire it up

node start.json

Hopefully coinpunk starts, you might get the following error:

Error: listen EADDRINUSE
at errnoException (net.js:904:11)
at Server._listen2 (net.js:1042:14)
at listen (net.js:1064:10)
at Server.listen (net.js:1138:5)
at /root/coinpunk/start.js:36:24
at b (domain.js:183:18)
at Domain.run (domain.js:123:23)
at Object.<anonymous> (/root/coinpunk/start.js:31:8)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)

 

This means that the port is already in use by another program. If that is the case then you must kill whatever process is using that port or choose a different port. bitcoind is most likely the process using it so go ahead and check with:

lsof -i :18332

if you received the EADDRINUSE error then a process should show up. kill it by using it pid

kill [put your process id here]

Now go ahead and try again to start coinpunk.

The way to check if coinpunk is successfully installed is navigating to:

http://YOURADDRESS:18332

So for example since my domain name is www.coiniv.com then I would navigate to http://coiniv.com:18332

If you are using chrome it should give you a warning about the ssl certificate and how its not trusted click proceed and you should see this:

coinpunk on the testnet

coinpunk on the testnet

 

This is it, now you are hosting a wallet on the network just like blockchain or coinbase. Thanks to the existing tutorials provided by coinpunk.com which can be found HERE

If any of you are facing issues feel free to post a comment and I will help you get it resolved.