大螃嗨

好记性不如烂笔头

用户工具

站点工具


bch节点搭建

这是本文档旧的修订版!


  $mkdir /app
  $git clone https://github.com/Bitcoin-ABC/bitcoin-abc.git
  或直接下载最新源代码:
  $wget https://github.com/Bitcoin-ABC/bitcoin-abc/archive/master.zip
  $cd /app/bitcoin-abc

download the berkeley-db

http://download.oracle.com/otn/berkeley-db/db-6.2.32.NC.tar.gz

upzip the package

  $tar -xf db-6.2.32.NC.tar.gz
  $cd db-6.2.32.NC/build_unix/
  $../dist/configure –enable-cxx –disable-shared –with-pic –prefix=/usr/local
  $sudo make install

build the bitcoin-abc

  $cd /app/bitcoin-abc
  $sudo sh autogen.sh
  $sudo ./configure  --with-gui=no --prefix=/usr/local/bitcoin-bch
  $sudo make

这里如果报错,就需要升级gcc版本。

  报错信息:
  ./amount.h:123:73: error: can't initialize friend function 'operator*'
  friend constexpr Amount operator*(const double a, const Amount b) = delete;
   
  GCC升级
  # yum install centos-release-scl -y
  # yum install devtoolset-4-toolchain -y
  # scl enable devtoolset-4 bash
  # gcc --version
  
  如果编译还是出上面的错,就执行
  scl enable devtoolset-4 bash

如下报错信息,需要升级Boost版本。https://github.com/Bitcoin-ABC/bitcoin-abc/pull/124

  test/cashaddrenc_tests.cpp:196:29: error: no match for ‘operator!=’ (operand types are ‘CTxDestination {aka boost::variant<CNoDestination, CKeyID, CScriptID>}’ and ‘const CTxDestination {aka const boost::variant<CNoDestination, CKeyID, CScriptID>}’)
  http://www.boost.org   下载最新版本boost
  tar -xf boost.tar.gz
  cd boost_1_67
  sudo ./bootstrap.sh --prefix=/usr/local/include/boost
  sudo ./b2 --build-type=complete --layout=tagged install
  
  编译boost报错:
  
  找到如下文件:
  /app/boost_1_67_0/tools/build/src/tools/python.jam
  
  修改如下:
  includes ?= $(prefix)/include/python$(version) ;  错误
  
  includes ?= $(prefix)/include/python$(version)m ;  正确
  
  在~/.bashrc 中添加如下:
  alias python='/usr/bin/python3.4'
  
  编译完毕后配置路径
  $ sudo mv /usr/include/boost/ /usr/include/boost.backup
  $ sudo mv /usr/lib64/libboost_* ./boost.backup/
  
  $ sudo mv /usr/local/include/boost/include/boost/ /usr/include/
  $ sudo mv /usr/local/include/boost/lib/libboost_* /usr/lib64/
  

$sudo make install

会报一堆告警信息,但是不用理会,最终运行echo $?,看一眼有没有报错即可,如果显示0,就是没报错

安装完毕后,会在/usr/local/bitcoin-bch目录下,分别是比特币现金的运行文件和测试文件,这里,我们运行测试文件test_bitcoin,来测试安装是否完整(吐槽:bitcoin-abc真是操蛋,编译出来的运行文件居然和比特币命名和路径完全一样,把我机器上比特币的运行文件覆盖掉了!重编了一遍比特币!!配置工程的时候一定指定–prefix参数!!!)

  $cd /usr/local/bitcoin-bch
  $./test_bitcoin
bch节点搭建.1533301584.txt.gz · 最后更改: 2018/08/03 13:06 由 螃蟹