操作系统版本:ubuntu 16.0 x64
刚开始用的是centos6.5,但安装openssl的时候提最该组件不支持椭圆形加密算法,因该是发行版本版权问题,所以放弃了,还是用ubuntu要方便一些。
首先安装编译需要的依赖项目:
sudo apt-get -y update && sudo apt-get -y upgrade
sudo apt-get -y install libdb++-dev build-essential libtool autotools-dev autoconf libssl-dev libboost-all-dev python-software-properties curl vim git debconf-utils
在安装其它数字货币时,以上的第三方插件差不会都会用到。
第三方依赖在github上官方也有相关的说明:
https://github.com/dogecoin/dogecoin/blob/master/doc/build-unix.md
可以按官方说明最简安装第三方依赖包
开始安装dogecoin
cd /root/
git clone https://github.com/dogecoin/dogecoin.git
cd dogecoin
./autogen.sh
./configure
make
make install
在执行make的时候会提示Berkeley DB版本问题,解决方案在是在confugure加上相关参数
正确版:
./configure –enable-cxx –disable-shared –with-pic –without-gui LDFLAGS=”-L/usr/local/src/db5/lib/” CPPFLAGS=”-I/usr/local/src/db5/include/”
./configure –without-gui –with-incompatible-bdb
大概意思就是不运行图形界面,跳过检测BDB的意思,如果BDB的版本不按官方指定版本,那钱包可能与其它环境下的钱包出现不兼容,也就是通过物理文件转移钱包。
解决办法是安装对应的版本,并且在编译的时间指定自行安装的版本。
BITCOIN_ROOT=$(pwd)
BDB_PREFIX=”${BITCOIN_ROOT}/db5”
mkdir -p $BDB_PREFIX
wget ‘http://download.oracle.com/berkeley-db/db-5.1.29.NC.tar.gz’
echo ‘08238e59736d1aacdd47cfb8e68684c695516c37f4fbe1b8267dde58dc3a576c db-5.1.29.NC.tar.gz’ | sha256sum -c
tar -xzvf db-5.1.29.NC.tar.gz
cd db-5.1.29.NC/build_unix/
../dist/configure –enable-cxx –disable-shared –with-pic –prefix=$BDB_PREFIX
make install
cd $BITCOIN_ROOT
./configure (other args…) LDFLAGS=”-L${BDB_PREFIX}/lib/” CPPFLAGS=”-I${BDB_PREFIX}/include/”
再执行make与make install就会编译成成了。
安装成功后,需要以守护进行运行dogecoind,但运行的时候会提配你配置conf文件,在dogecoin同文件夹有个隐藏文件夹.dogecoin,进入后vim dogecoin.conf,创建新文件,输入内容:
rpcuser=dogecoinrpc
rpcpassword=69F8RQopVruHAXk2hJyuf9ELqmvK7NHjyDswXm9kpDTj
保存,注意配置文件可以配置更多的信息,具体可以找找相关资料,别外RPC的端口号默认是22555。
dogecoind –deamon即可以守护进程运行。
如果想运行客户端命令可以使用dogecoin-cli 指令的方式执行,比如dogecoin-cli getbalance
当然我们更新的还是想通过RPC API完成更多的业务操作,不同的开发语言请参考:
https://zh-cn.bitcoin.it/wiki/API_reference_(JSON-RPC)
比如CURL模式:
curl –user dogecoinrpc –data-binary ‘{“jsonrpc”: “1.0”, “id”:”curltest”, “method”: “getinfo”, “params”: [] }’ -H ‘content-type: text/plain;’ http://127.0.0.1:22555/
RPC API相关命令可以参考:
http://jcsaaddupuy.github.io/dogecoin-python/doc/index.html
https://en.bitcoin.it/wiki/Original_Bitcoin_client/API_calls_list
遇到的问题
a 、在执行./configure命令时报错:
configure: error: hexdump is required for tests
解决方法:sudo apt-get install bsdmainutils
b、重新执行之后报错:libevent not found
libevent not found
解决方法:sudo apt-get install libevent-dev