如何在ubuntu 安装比特币平台下编译比特币bitcoin客户端

聊聊比特币(Bitcoin)客户端源码编译那些事 - 简书
聊聊比特币(Bitcoin)客户端源码编译那些事
今年2月份以来,开始正式进入区块链行业,但开始时只是碎片化地看一些公众号和新闻,但对于区块链的运行原理并没有深入理解。思来想去,我应该好好学习区块链的鼻祖比特币的原理与源码,这样才能让我有资格站在区块链资产的背后,坚定长期持有的信心。于是在4月份,我利用笑来老师推荐的“碎片化时间法”看完了《精通比特币》这本书,看这本书的过程中我是带着问题去看的,比如交易是如何传播的、交易是如何打包到块中的、数字签名是怎么来的以及挖矿难度是怎么产生的等问题,通过这种方式的阅读让我对比特币的原理有了较清晰的认识,并且越来越佩服中本聪以及比特币团队技术能力,还有比特币网络运行的智能性,越看越过瘾,发现里面的逻辑很缜密,考虑到了各种可能性!近期准备再详细读一遍,力求深刻理解其原理还有概念,同时想着自己理解后能把里面的概念分享出来,与大家一起探讨学习!上周末(日)在家想着自己刚好有Ubuntu的安装包,同时想着自己既然在研究区块链技术,自身也是搞研发的,而且又刚看完《精通比特币》这本书,所以觉得应该开始研究比特币的源码了!想着就开始行动了,在安装的过程中虽然是按照网上其他人分享的帖子,有可能是系统版本的问题吧,安装过程并不是那么顺利,这期间也碰到过一些问题!为帮助大家在安装过程中如碰到与我一样问题能快速解决问题,特把我自己的安装过程分享出来,希望对大家有益。第一步:安装Ubuntu比特币(Bitcoin)客户端为开源软件,所以其在Linux下的安装相比Windows的安装过程会方便很多,所以,我选择使用较多的Ubuntu操作系统,版本为16.04 LTS。因为我电脑为Windows操作系统,所以选择通过VMware虚拟机完成Ubuntu的安装。虚拟机中安装Ubunt的教程已经很多了,所以本文不详细描述了。第二步:安装三方库Ubuntu系统安装完成后,想着肯定有很多前辈编译过比特币(Bitcoin)客户端源码,也肯定会有很多热心人分享出来,于是百度之后发现果然有很多相关的帖子,经过筛选后找到两篇中文与一篇英文的编译参考网页:
Installingbitcoin in ubuntu
/home//installing-bitcoin-in-ubuntu/
最开始搜索的就是中文帖子,所以,按照第一篇文章中列举的步骤开始下载编译比特币源码所需的三方库。当时的步骤是这样的:
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install build-essential libtoolautotools-dev autoconf pkg-config libssl-dev
sudo apt-get install libboost-all-dev
sudo apt-get install libqt5gui5 libqt5core5a
libqt5dbus5 qttools5-dev qttools5-dev-tools libprotobuf-dev protobuf-compiler
sudo apt-get install libqrencode-dev
sudo apt-get install libminiupnpc-dev
我一开始就按照这个步骤挨个命令地执行,发现很快就执行完了,想想不对吧,怎么可能这么快!于是回过头去看了执行命令给出的信息,发现是有错误提示的,而且提示的错误是一样的:Failed to fetch /ubuntu/dists/precise-updates/main/binary-i386/PackagesSomething wicked happened resolving ':http' (-5 - No address associated with hostname)提示无法获取所需要安装包,完成的搜索再一次帮助了我,我把这类问题在百度里搜索后发现笑来老师说的那句“相信我,你并不孤独”再次应验了,有很多文章介绍遇到过这个问题,并给出了解决方案。这个问题最简单的解决方案是:
修改/etc/resolv.conf文件:
nameserver=8.8.8.8
在修改resolv.conf文件后,执行开始的那些命令后发现开始运行正常了,没有再出任何问题了。运行效果如下:
命令执行过程较长,但看着执行语句的顺利执行,心情是相当舒畅的!其实在解决这个问题时,也尝试过别的文章介绍的方法,但由于系统配置不同或作者描述不清楚的原因,试了都没效果,但还好自己坚持下来继续查找解决方法,才顺利完成了更新任务!坚持就是胜利!心中要永存希望,希望之火不能被灭!第三步:下载比特币源码比特币源码存放于github中,在Ubuntu操作系统下可以直接使用git命令完成github上源码的下载。其下载命令如下:
git clone /bitcoin/bitcoin.git
当时我的系统中没有安装git软件,所以提示未找到git,所以,需要安装,其安装命令如下:sudo apt-get install git安装完成后,再输入之前的命令即可完成bitcoin源码的下载。第四步:安装比特币(Bitcoin)客户端安装比特币软件之前,需要先完成berkeley-db的安装,首先在bitcoin源码目录中创建db4目录
###Download and compile Berkley DB 4.8
mkdir bitcoin/db4/
下载berkeley-db安装包wget '/berkeley-db/db-4.8.30.NC.tar.gz'大部分文章都是让下载db-4.8.30.NC.tar.gz,但该版本在官网已经无法下载了,官网只有db-6.2.32.NC.gz,所以,我将其修改下面的命令,可完成该数据库源码的下载。wget '/berkeley-db/db-6.2.32.NC.tar.gz'随后是完成berkeley-db的安装:
tar -xzvf db-6.2.32.NC.tar.gz
cd db-6.2.32.NC/build_unix/
../dist/configure --enable-cxx --disable-shared --with-pic --prefix=/home/theusername/bitcoin/db4/
make install
剩下的就是完成比特币(Bitcoin)客户端的安装了
cd ~/bitcoin/
./autogen.sh
./configure LDFLAGS="-L/home/theusername/bitcoin/db4/lib/" CPPFLAGS="-I/home/theusername/bitcoin/db4/include/"
make install
在运行./configure时遇到了错误提示Found Berkeley DB other than 4.8, required for portable wallets (–with-incompatible-bdb to ignore)根据提示信息了解到是我Berkeley DB的安装版本为6.2.32,不同于软件默认要求的4.8,所以提示错误信息,经百度发现需在./configure中添加--with-incompatible-bdb参数才可以,添加该参数的目的可以保证转账的正常进行:run the following command instead. You can always send your bitcoins to another wallet.其他过程均运行正常,经过后面的make与make install命令执行后,比特币软件安装完成。
第五步:测试安装结果根据《精通比特币》第3章介绍的,我们可以通过询问系统下面2个可执行文件的路径,来确认bitcoin是否安装成功。
$ which bitcoind
/usr/local/bin/bitcoind
$ which bitcoin-cli
/usr/local/bin/bitcoin-cli
如果命令执行结果如图所示,则表明比特币软件安装成功。
以上就是我安装比特币(Bitcoin)客户端的全部过程,后续将继续研究该节点下区块链存放目录、bitcoind与bitcoin-cli命令的参数使用方法,甚至是开发提币后的转账功能,想想都有点小激动了!如果大家有安装上的问题可以留言,我将尽力帮助大家解决问题,也欢迎大家把安装过程中解决的问题也贴出来,让后面的人可以少走很多弯路!区块链研习社比特币源码研读班 菜菜子以下是广告:我们区块链研习社已创建“区块链研习社币圈交流”小密圈”,在小密圈中,我们将带领大家一起学习区块链的原理与投资,还将提供区块链基本原理解答、交易所注册与交易操作、ICO交易与操作、投资分析、风险分析等内容。目前入圈价格初始定价50元,50人调整一次价格,每次调整幅度为50元!
具有15年软件研发经验,现为区块链研习社主编,区块链研习社比特币源码研读班班长,Sia维基中文版翻译者,致力于区块链技术的研究与推广LOADING...
LOADING...
LOADING...
当前位置: &
Electrum比特币钱包在ubuntu下怎么安装
  比特币U盘冷钱包自制教程
  本教程选用 Electrum 钱包和 Ubuntu 操作系统制作 U 盘冷钱包。
  Electrum 是轻量级的钱包,不需下载比特币区块链数据,便于使用。
  我们认为官网下载的 Ubuntu,Electrum 是安全可信的。
  通过本教程,我们可离线制成一个 U 盘启动的,...
...细步骤请参考这里的教学
  2. 0.2.2版更新的内容如下:
  修正导入electrum钱包错误 (wallet_import_electrum)
  增加选项来随机投票给已认证的受托人, 以增加私密性 (wallet_transfer)
  修正以及改进钱包转帐纪录以及重新扫描区块链(wallet_account_transaction_history, wallet_rescan_blockchain)
  钱包...
  Linux系统中比特币客户端/钱包程序:
  http://sourceforge.net/projects/bitcoin/files/Bitcoin/bitcoin-0.7.0/bitcoin-0.7.0-linux.tar.gz/download
  以Debian6 64bit GUI为例:
  cd /tmp
  wget http://downloads.sourceforge.net/project/bitcoin/Bitcoin/bitcoin-0.7.0/bitcoin-0.7.0-linux.tar.gz
  tar zxvf bitcoin-0.7.0-linux.tar.gz
...Zcash:/xinbi/.html
  现在在仍然是测试版,Zcash钱包仅仅可以在Linux使用,这个简易教程是指零基础学习Zcash挖矿教程。
  如果你有linux基础,请从linux部分看起,如果是Windows,装个最新的VM虚拟机,下载地址:/。下载最新Ubuntu,地址:/downl...
...为首家开发出区块链在线投票软件的公司,而现在,又将这款软件集成到了比特股区块链上。
  2016年8月,我们曾宣布,alpha版本的股份加权投票软件开发工作已经完成。现在,我们又成功地将这款投票软件集成到了比特股区块链上。这款软件将作为底层基础,用于后续进一步开发更先进也更具匿...
  MultiBit是 一个比特币官网推荐的安全的、轻量级的比特币钱包,目前有Windows,MacOS和Linux三个版本,25种语言支持。对于常规的客户端,更新区块 可能需要一整天的时间,如果网速慢,甚至需要更长.至少占C盘8G的空间,而且会越来越大。这时我们需要轻量级的钱包,虽然它的钱包文件很多,...
...卡类型和系统,选择openCL:
  AMD SDK openCL
  NVIDIA CUDA openCL
  Ubuntu系统
  AMD显卡
  & 地址1
  & 地址2
  下载: ADL_SDK8.zip 和 AMD-APP-SDK-v2.9-1.599.381-GA-linux64.sh
  ./AMD-APP-SDK-v2.9-1.599.381-GA-linux64.sh
  ln -s /opt/AMDAPPSDK-2.9-1 /opt/AMDAPP
  ln -s /opt/AMDAPP/include/CL /...
  opendig -h
  由此可知opendig可以查询bitcoin的某个名字对应的比特币地址(比特币网络里哪来的名字呢?先卖个关子)
  3.获取某个名字的地址,查询过程可能有点慢,请耐心等候。
  opendig bitcoin -u naval
  我们获取了naval这个名字的比特币地址是1919UrhYyhs471ps8CFcJ3DRpWSda8qtSk。...
  $ ~/zcash/./src/zcashd -daemon
  服务器或VPS将花费几秒钟运行Zcash钱包,稍等一会儿,运行指令:
  $ ~/zcash/./src/zcash-cli getinfo
  $ ~/zcash/./src/zcash-cli getinfo
  需要一定时间进行区块链同步,在此之间,还是使用如下指令查看你节点和区块信息:
  $ nano ~/.zcash/zcash.conf
...钥,知道了私钥就可以支配对应地址里的比特币!
  2. 其他客户端,如electrum, Armory都可以用类似的方法导入和导出,但是私钥的格式有51位的和52位的,可能不全通用。
copyright 2016 - wanbizu - 页面处理总时间:0.0401秒
Powered by
合作邮箱:
(Reply within 12 hours)下次自动登录
现在的位置:
& 综合 & 正文
编译bitcoin客户端
本帖只谈技术实现,首先我们自己来编译一个比特币客户端吧。
参考github上的描述文件
1) 签出代码
GitHub上的官方源代码
git clone /bitcoin/bitcoin.git
也可以从csdn的code上签出本文的整个项目组
git clone git://code.csdn.net/wuzh1230/bitcoin.git
&1&已经包含了预编译的依赖库在3rd目录下;
&2&已经包含了ming32工具链,请修改msys/1.0/etc/fstab。
2) 下载依赖包
Libraries you need to download separately and build:
default path
----------------------------------------------------
\openssl-1.0.1c-mgw
http://www.openssl.org/source/
Berkeley DB
\db-4.8.30.NC-mgw
/technology/software/products/berkeley-db/index.html
\boost-1.50.0-mgw
http://www.boost.org/users/download/
\miniupnpc-1.6-mgw
http://miniupnp.tuxfamily.org/files/
3) 编译依赖包
3.1) OpenSSL
MSYS shell:
un-tar sources with MSYS 'tar xfz' to avoid issue with symlinks (OpenSSL ticket 2377) change 'MAKE' env. variable from 'C:\MinGW32\bin\mingw32-make.exe' to '/c/MinGW32/bin/mingw32-make.exe'
cd /c/openssl-1.0.1c-mgw
使用最新的mingw来构建未发现问题。
3.2) Berkeley DB
MSYS shell:
cd /c/db-4.8.30.NC-mgw/build_unix
sh ../dist/configure --enable-mingw --enable-cxx
注意:卸载mingw安装包中pthread组件,否则,BDB会尝试构建repmgr模块(repmgr_posix.c需要posix支持,mingw32不支持)。
MSYS shell:
downloaded boost jam 3.1.18
cd \boost-1.50.0-mgw
bjam toolset=gcc --build-type=complete stage
(1) 准备bjam.exe,考虑到boost对mingw的支持不是很好,折中的办法是用vc++的命令行构建一个bjam(比如:bootstrap.bat vc9);然后用这个b2.exe构建mingw版本的boost。
(2)执行 b2 --prefix=/d/workspace/temp install toolset=gcc link=shared variant=release runtime-link=shared threading=multi --without-mpi --without-python --without-wave --without-graph --without-graph_parallel
UPnP support is optional, make with USE_UPNP= to
disable it.
MSYS shell:
cd /c/miniupnpc-1.6-mgw
make -f Makefile.mingw
mkdir miniupnpc
cp *.h miniupnpc/
(1)修改一个miniupnpc.def里面的LIBRARY指定的库名称为空的问题;
(2)修改一个Makefile.mingw的del命令;
4) 注意事项
4.1) boost
1) GCC 4.8 warns of ignored attribute in declaration
2) MINGW构建boost失败
3) 导出common_config_file_iterator
4.2) MiniUPNPc
1) 修改Makefile.mingw, 添加del定义
# $Id: Makefile.mingw,v 1.16
17:39:31 nanard Exp $
# Miniupnp project.
# http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org/
Thomas Bernard
# This Makefile is made for MinGW
#CFLAGS = -Wall -g -DDEBUG -D_WIN32_WINNT=0X501
CFLAGS = -Wall -Os -DNDEBUG -D_WIN32_WINNT=0X501
LDLIBS = -lws2_32 -liphlpapi
2) 封装dll的时候出错:
gcc -enable-stdcall-fixup -o upnpc-static upnpc.o libminiupnpc.a -lws2_32 -liphl
d:/cifs/mingw32/bin/../lib/gcc/mingw32/4.8.1/../../../../mingw32/bin/ld.exe: war
ning: cannot find entry symbol nable-stdcall- defaulting to 10
dllwrap -k --driver-name gcc \
--def miniupnpc.def \
--output-def miniupnpc.dll.def \
--implib miniupnpc.lib -o miniupnpc.dll \
dll/miniwget.o dll/minixml.o dll/igd_desc_parse.o dll/minisoap.o dll/min
iupnpc.o dll/upnpreplyparse.o dll/upnpcommands.o dll/upnperrors.o dll/connecthos
tport.o dll/portlistingparse.o dll/receivedata.o -lws2_32 -liphlpapi
D:\cifs\mingw32\bin\dlltool: Syntax error in def file miniupnpc.def:5
D:\cifs\mingw32\bin\dlltool: Syntax error in def file miniupnpc.def:5
看看def文件的第5行,dlltool工具不允许空的library指令,修改一下,添加一下库的名字:
; miniupnpc library
4.3) BerkeleyDB
使用最新的mingw(不带pthread组件)编译Berkeley DB.
分析BDB的configure.ac里面的这个宏,它会检测pthread可用性,如果可用,尝试包含REPMGR_OBJS
# Replication can be disabled.
if test "$db_cv_build_replication" = "yes"; then
AC_DEFINE(HAVE_REPLICATION)
AH_TEMPLATE(HAVE_REPLICATION,
[Define to 1 if building replication support.])
ADDITIONAL_OBJS="$ADDITIONAL_OBJS \$(REP_OBJS)"
# If we're building replication and detected POSIX threads, build the
# replication manager.
AH_TEMPLATE(HAVE_REPLICATION_THREADS,
[Define to 1 if building the Berkeley DB replication framework.])
if test "$ac_cv_header_pthread_h" = then
AC_DEFINE(HAVE_REPLICATION_THREADS)
# Solaris requires the socket and nsl libraries to build the
# replication manager.
Don't add nsl regardless of the OS,
# it causes RPC to fail on AIX 4.3.3.
case "$host_os" in
AC_HAVE_LIBRARY(nsl, LIBSO_LIBS="$LIBSO_LIBS -lnsl")
AC_HAVE_LIBRARY(socket,
LIBSO_LIBS="$LIBSO_LIBS -lsocket");;
ADDITIONAL_OBJS="$ADDITIONAL_OBJS \$(REPMGR_OBJS)"
ADDITIONAL_OBJS="$ADDITIONAL_OBJS repmgr_stub${o}"
ADDITIONAL_OBJS="$ADDITIONAL_OBJS rep_stub${o} repmgr_stub${o}"
5) 编译bitcoin客户端
编译脚本samplebuild.sh的代码,请修改DEPEND_HOME变量
export DEPEND_HOME=/d/cifs/try/buildbtc/csdn/bitcoin/3rd
./configure \
--disable-tests \
--with-boost="${DEPEND_HOME}/boost-1.50.0-mgw" \
--with-miniupnpc=yes \
CPPFLAGS="-D_WIN32_WINNT=0x0601 -DWINVER=0x0601 -w -g -O0 -I${DEPEND_HOME}/db-4.8.30.NC-mgw/include -I${DEPEND_HOME}/miniupnpc-1.6-mgw/include -I${DEPEND_HOME}/openssl-1.0.1c-mgw/include -I${DEPEND_HOME}/boost-1.50.0-mgw/include/boost-1_50" \
LDFLAGS="-L${DEPEND_HOME}/db-4.8.30.NC-mgw/lib -L${DEPEND_HOME}/miniupnpc-1.6-mgw/lib -L${DEPEND_HOME}/openssl-1.0.1c-mgw/lib"
5.1) 解决::UnRegisterSleepEx()错误
添加 -D_WIN32_WINNT=0x0601 -DWINVER=0x0601
5.2) 解决WSAPOLLFD未定义的问题
在mingw的winsock2.h里面的第912行附近添加
typedef struct pollfd {
} WSAPOLLFD, *PWSAPOLLFD, *LPWSAPOLLFD;
5.3) 解决boost连接问题
1) boost_program_options
查看src/m4/ax_boost_program_options.m4的第74行附近:
for libextension in `ls $BOOSTLIBDIR/libboost_program_options*.so* 2&/dev/null | sed 's,.*/,,' | sed -e 's;^lib\(boost_program_options.*\)\.so.*$;\1;'` `ls $BOOSTLIBDIR/libboost_program_options*.dylib* 2&/dev/null | sed 's,.*/,,' | sed -e 's;^lib\(boost_program_options.*\)\.dylib.*$;\1;'` `ls $BOOSTLIBDIR/libboost_program_options*.a* 2&/dev/null | sed 's,.*/,,' | sed -e 's;^lib\(boost_program_options.*\)\.a.*$;\1;'` ; do
for libextension in `ls $BOOSTLIBDIR/libboost_program_options*.so* 2&/dev/null | sed 's,.*/,,' | sed -e 's;^lib\(boost_program_options.*\)\.so.*$;\1;'` `ls $BOOSTLIBDIR/libboost_program_options*.dylib* 2&/dev/null | sed 's,.*/,,' | sed -e 's;^lib\(boost_program_options.*\)\.dylib.*$;\1;'` `ls $BOOSTLIBDIR/libboost_program_options*.dll.a* 2&/dev/null | sed 's,.*/,,' | sed -e 's;^lib\(boost_program_options.*\)\.dll\.a.*$;\1;'` ; do
2) boost_chrono
查看src/m4/ax_boost_chrono.m4的第81行附近:
for libextension in `ls $BOOSTLIBDIR/libboost_chrono*.so* $BOOSTLIBDIR/libboost_chrono*.dylib* $BOOSTLIBDIR/libboost_chrono*.a* 2&/dev/null | sed 's,.*/,,' | sed -e 's;^lib\(boost_chrono.*\)\.so.*$;\1;' -e 's;^lib\(boost_chrono.*\)\.dylib.*$;\1;' -e 's;^lib\(boost_chrono.*\)\.a.*$;\1;'` ; do
for libextension in `ls $BOOSTLIBDIR/libboost_chrono*.so* $BOOSTLIBDIR/libboost_chrono*.dylib* $BOOSTLIBDIR/libboost_chrono*.dll.a* 2&/dev/null | sed 's,.*/,,' | sed -e 's;^lib\(boost_chrono.*\)\.so.*$;\1;' -e 's;^lib\(boost_chrono.*\)\.dylib.*$;\1;' -e 's;^lib\(boost_chrono.*\)\.dll\.a.*$;\1;'` ; do
5.4) 修复了一个bitcoin编译时候的库依赖顺序
libbitcoin_wallet.a依赖于boost的filesystem,但是在src/Makefile.am里面boost_libs设置在libbitcoin_wallet.a之前,但是如果--disable-wallet编译不发现问题。
6) 成功构建bitcoind
sh autogen.sh && sh samplebuild.sh && make
...//很多输出
bitcoind.exe
bitcoin-cli.o
bitcoin-cli.exe
make[3]: Leaving directory `/d/cifs/try/buildbtc/csdn/bitcoin/bitcoin-master/src'
make[2]: Leaving directory `/d/cifs/try/buildbtc/csdn/bitcoin/bitcoin-master/src'
make[1]: Leaving directory `/d/cifs/try/buildbtc/csdn/bitcoin/bitcoin-master/src'
make[1]: Entering directory `/d/cifs/try/buildbtc/csdn/bitcoin/bitcoin-master'
make[1]: Nothing to be done for `all-am'.
make[1]: Leaving directory `/d/cifs/try/buildbtc/csdn/bitcoin/bitcoin-master'
复制所有的依赖库dll到exe所在目录。
libboost_*-mgw48-mt-1_50.dll
libcharset-1.dll
libdb-4.8.dll
libdb_cxx-4.8.dll
libexpat-1.dll
libgcc_s_dw2-1.dll
libgettextlib-0-18-3.dll
libgettextpo-0.dll
libgettextsrc-0-18-3.dll
libgmp-10.dll
libgmpxx-4.dll
libgomp-1.dll
libiconv-2.dll
libintl-8.dll
libltdl-7.dll
libmpc-3.dll
libmpfr-4.dll
libquadmath-0.dll
libssp-0.dll
libstdc++-6.dll
mingwm10.dll
miniupnpc.dll
pthreadGC2.dll
pthreadGCE2.dll
运行命令行版本的bitcoin的client,看看帮助提示:
$ ./bitcoin-cli.exe --help
Bitcoin RPC client version v0.8.2-820-gf65dc44-dirty-beta
bitcoin-cli [options] &command& [params]
Send command to Bitcoin server
bitcoin-cli [options] help
List commands
bitcoin-cli [options] help &command&
Get help for a command
This help message
-conf=&file&
Specify configuration file (default: bitcoin.conf)
-datadir=&dir&
Specify data directory
Use the test network
-rpcconnect=&ip&
Send commands to node running on &ip& (default: 127.0.0
Wait for RPC server to start
-rpcuser=&user&
Username for JSON-RPC connections
-rpcpassword=&pw&
Password for JSON-RPC connections
-rpcport=&port&
Connect to JSON-RPC on &port& (default: 8332 or testnet
SSL options: (see the Bitcoin Wiki for SSL setup instructions)
Use OpenSSL (https) for JSON-RPC conn
7) 编译qt前端
待续。。。
&&&&推荐文章:
【上篇】【下篇】4577人阅读
虚拟币钱包编译(6)
在ubuntu下安装bitcoin的方法,在网上找到了这篇文章,经过我测试,可以正常安装和编译bitcon的源码。转来和大家分享一下。其实还是在linux下进行编译代码要方便很多。
在编译之前可能要先安装一些工具:
apt-get install make
apt-get install gcc
apt-get install g++
apt-get install libdb-dev
(libdb5.1-dev)
apt-get install libdb++-dev
(libdb++-dev libdb5.1++ libdb5.1++-dev)
apt-get install libboost-dev
(apt-get install libboost1.37-dev)
(apt-get install libboost-all-dev)
apt-get install zlib1g-dev
apt-get install libssl-dev
apt-get install build-essential
apt-get install libminiupnpc-dev
apt-get install autoconf
Get the source first
git clone https:///bitcoin/bitcoin.git
cd bitcoin
先得到源码。如果你的系统上没有安装git就先用
sudo apt-get install git-core
来安装这个软件
You can read&doc/build-unix.md, or follow along.
This step should be no problem.
读这个doc文件,可以知道源码要怎么编译,然后生成编译源码所需要的库配置
./autogen.sh
This step may give you some issues…
./configure
运行完上边的这个命令之后,你就可以知道你的系统中都少什么库,下边就是安装缺少的库的方法
If you encounter&configure:
error: libdb_cxx headers missing
提示少libdb_cxx头,这个时候运行下边令命安装db的C++开发库
sudo apt-get install libdb5.1++-dev
If you encounter configure: error: Found Berkeley DB other than 4.8, required for portable
wallets (–with-incompatible-bdb to ignore), run the following command instead. You can always send your bitcoins to another wallet.
如果提示安装的DB不是4.8的版本,则使用下边的命令跳过DB的版本检测
./configure --with-incompatible-bdb
If you encounter checking for boostlib &= 1.20.0… configure: We could not detect the boost
libraries (version 1.20 or higher). If you have a staged boost library (still not installed) please specify $BOOST_ROOT in your environment and do not give a PATH to –with-boost option. If you are sure you have boost installed, then check your version number
looking in . See http://randspringer.de/boost for more documentation.
上边的意思是boostlib库的一些问题,如果你用的是一个静态boost库,你要设置环境变量,如果你确定已经安装了boost库,那就看一下自已的库版本是否&=1.20.0。安装boost库可以使用下边的命令
sudo apt-get install libboost-all-dev
This time you may have a clean run. However, if you scroll up to check the output lines,
you may see this line:&configure: WARNING: MOC bitcoin-qt frontend will
not be built. If you want the frontend, run:
安装qt图标界面库
sudo apt-get install libqt4-core libqt4-gui libqt4-dev
Then when you run&configure&again,
you should see&checking for moc-qt4… /usr/bin/moc-qt4.
Now, everything is ready.
一切OK,接下来可以开始编译了。&
The compilation took like 5 min. Then install the compiled binary。
差不多五分钟过后,然后开始安装运行程序。
make install
Now just run the following to bring up the bitcoin frontend, yeah~~~
接下来就可以运行了。
bitcoin-qt
To start mining, go to Help & Debug Window & Console and type in&setgenerate
true&to turn it on. Type&setgenerate
false&to stop. My machine became really hot after a while, probably coz my CPU
was struggling with all the complex computations. I read that some people bought a separate GPU card for better performance, something to consider.
It’s worth noting that nowadays it’s very hard to efficiently mine bitcoins alone without dedicated software and hardware. Often miners form a pool (or a group) to speed up the process and share the profit. Read more at:
经过上文中的方法我第一次编译通过了,但是后来发现运行时还是有错,再试了一下发现没有bitcoin-qt。回到源码的目录,运行了一下./configure发现发了google的protobuff工具,所以在网上下载了一个。安装上之后发现还是出现同样的make
check错误无法编译bitcoin-qt,马上感觉应该是protobuff的环境变量没有加上,然后在~/.bashrc中加上了PROTOBUF_HOME的环境变量,这次再make一下,觉得这次应该没有什么问题了吧,但编译到一半突然出现了一个致命错误:
致命错误: paymentrequest.pb.h:没有那个文件或目录 编译中断。
在网上找到了答案,因为使用的是CXX编译的,网上说这个要用g++,但g++和gcc我都是装了的。最后的解决方法是:
输入sudo apt-get install gcc-multilib 即可
接下来再编译通过了,希望这一次不要出问题,然后我再make install一下试试。
哈哈哈。。。。
运行bitcoin-qt后出现了下边的画面:
&下一步的工作,就是学着修改源码了。有兴趣的同学大家一起来改变世界吧。
另一个,就是客端是有RPC的网络接口的,可以在配置文件中进行设置,这样就要以使用json的方式访问你的客户端了,这方面我正在研究,回头再补充。
&&相关文章推荐
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场
访问:15131次
排名:千里之外
转载:11篇
(window.slotbydup = window.slotbydup || []).push({
id: '4740887',
container: s,
size: '250,250',
display: 'inlay-fix'

我要回帖

更多关于 ubuntu 挖比特币 的文章

 

随机推荐