Bancor Coin/bancorcoind

From Omnia
Revision as of 16:37, 27 October 2014 by Kenneth (talk | contribs) (→‎See bitcoind)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

See bitcoind

See bitcoin/bitcoind for commands as bancorcoind is based off the same code, but with a new generation block.

install

Note: this builds bancorcoind, but not bancorcoind-qt

RHEL

# RHEL/CentOS 6 Dependencies
yum install gcc make boost-devel db4-devel
# external: miniupnpc

miniupnpc dependency:

mkdir ~/.src ; cd ~/.src
wget http://miniupnp.free.fr/files/download.php?file=miniupnpc-1.8.tar.gz -O miniupnpc-1.8.tar.gz
tar -zvxf miniupnpc-1.8.tar.gz
cd miniupnpc-1.8
# make && make install
make && sudo make install PREFIX=/opt/miniupnpc-1.8

openssl dependency - fix 9key_error: [1]

mkdir ~/.src ; cd ~/.src
wget http://www.openssl.org/source/openssl-1.0.1i.tar.gz
tar -zvxf openssl-1.0.1i.tar.gz
cd openssl-1.0.1i
./config --prefix=/opt/openssl-1.0.1i/ enable-ec enable-ecdh enable-ecdsa shared
make clean
make && sudo make install
#export LD_LIBRARY_PATH=/opt/openssl-1.0.1i/lib

fix boost lib: (/usr/bin/ld: cannot find -lboost_thread)

ln -s /usr/lib64/libboost_thread-mt.so /usr/lib64/libboost_thread.so

fix libminiupnpc: (./bancorcoind: error while loading shared libraries: libminiupnpc.so.9: cannot open shared object file: No such file or directory)

ln -s /usr/lib/libminiupnpc.so.9 /usr/lib64/libminiupnpc.so

make: [2]

export OPENSSL_INCLUDE_PATH=/opt/openssl-1.0.1i/include
export OPENSSL_LIB_PATH=/opt/openssl-1.0.1i/lib
make -f makefile.unix
# LDFLAGS="-L/opt/openssl-1.0.1i/lib" CFLAGS="-I/opt/openssl-1.0.1i/include" make -f makefile.unix
cat > /etc/ld.so.conf.d/local-openssl.conf << EOF
/opt/openssl-1.0.1i/lib
EOF
ldconfig

Local Non-Root Build:

mkdir ~/bin
mkdir ~/lib
export LD_LIBRARY_PATH=~/lib
export OPENSSL_INCLUDE_PATH="/opt/openssl-1.0.1i/include /opt/miniupnpc/usr/include"
export OPENSSL_LIB_PATH="/opt/openssl-1.0.1i/lib /opt/miniupnpc/usr/include ~/lib"
ln -s /opt/openssl-1.0.1i/lib/libcrypto.so.1.0.0 ~/lib/libcrypto.so.1.0.0
ln -s /opt/openssl-1.0.1i/lib/libssl.so.1.0.0 ~/lib/libssl.so.1.0.0
ln -s /opt/miniupnpc/usr/lib/libminiupnpc.so.9 ~/lib/libminiupnpc.so.9
ln -s /usr/lib64/libboost_thread-mt.so ~/lib/libboost_thread.so  # not required for final binary
cp ~/.src/bancorcoin/src/bancorcoind ~/bin
ln -s ~/bin/bancorcoind ~/bin/b
ldd ~/bin/bancorcoind

---

Error: [3]

EXCEPTION: 9key_error
CKey::CKey() : EC_KEY_new_by_curve_name failed
bancorcoin in AppInit()
$ /usr/bin/openssl version
  OpenSSL 1.0.1e-fips 11 Feb 2013
$ /opt/openssl-1.0.1i/bin/openssl version
  OpenSSL 1.0.1i 6 Aug 2014

Ubuntu

# Ubuntu Dependencies
apt-get install ... TODO ...

Common

Build source:

mkdir ~/.src ; cd ~/.src
wget http://bancorcoin.net/downloads/bancorcoin-src.tar.gz
tar -zvxf bancorcoin-src.tar.gz
cd bancorcoin
cd src
chmod u+x leveldb/build_detect_platform  # fix permission from tar file
make -f makefile.unix clean
make -f makefile.unix
cp bancorcoind /usr/local/bin
ln -s bancorcoind /usr/local/bin/b  # convenience, could also use "alias b=bancorcoind"

References:

Config

$ bancorcoind    # creates folder structure
$ cat >> ~/.bancorcoin/bancorcoin.conf << EOF
daemon=1
rpcuser=bancorcoin
rpcpassword=password123
addnode=bancorcoin.net

# rpcallowip=x.x.x.x  # needed for remote mining

# server=1
# listen=1
# rpcallowip=*
# rpcconnect=*
# rpcport=9335
# port=9336
EOF

sync status

#!/bin/bash
# bancorcoin-sync-status
BANCORCOIN_SYNC_CURRENT=`bancorcoind getblockcount`
BANCORCOIN_SYNC_TOTAL=`curl http://bancorcoin.net/count/ 2>/dev/null`
BANCORCOIN_SYNC_TOTAL=$(( $BANCORCOIN_SYNC_TOTAL / 128 ))
# alt: BANCORCOIN_SYNC_TOTAL=`curl http://bancorcoin.net/block/chain/Bancorcoin/q/getblockcount 2>/dev/null`
BANCORCOIN_SYNC_PERCENT=$(( BANCORCOIN_SYNC_CURRENT * 100 / BANCORCOIN_SYNC_TOTAL ))
echo "Sync status: ${BANCORCOIN_SYNC_PERCENT}% (${BANCORCOIN_SYNC_CURRENT}/${BANCORCOIN_SYNC_TOTAL})"