centos7安装BitCoin客户端
一、安装依赖环境
[root@localhost src]# yum install autoconf automake libtool libdb-devel boost-devel libevent-devel -y
二、从github上下载源代码
[root@localhost src]# git clone https://github.com/bitcoin/bitcoin.git
正克隆到 'bitcoin'...
remote: Enumerating objects: , done.
remote: Counting objects: % (/), done.
remote: Total (delta ), reused (delta ), pack-reused
接收对象中: % (/), 134.33 MiB | 33.00 KiB/s, done.
处理 delta 中: % (/), done.
[root@localhost src]#
三、运行autogen.sh,生成configure文件
[root@localhost bitcoin]# ./autogen.sh
libtoolize: putting auxiliary files in AC_CONFIG_AUX_DIR, `build-aux'.
libtoolize: copying file `build-aux/ltmain.sh'
libtoolize: putting macros in AC_CONFIG_MACRO_DIR, `build-aux/m4'.
libtoolize: copying file `build-aux/m4/libtool.m4'
libtoolize: copying file `build-aux/m4/ltoptions.m4'
libtoolize: copying file `build-aux/m4/ltsugar.m4'
libtoolize: copying file `build-aux/m4/ltversion.m4'
libtoolize: copying file `build-aux/m4/lt~obsolete.m4'
configure.ac:: installing 'build-aux/config.guess'
configure.ac:: installing 'build-aux/config.sub'
configure.ac:: installing 'build-aux/install-sh'
configure.ac:: installing 'build-aux/missing'
Makefile.am: installing 'build-aux/depcomp'
parallel-tests: installing 'build-aux/test-driver'
libtoolize: putting auxiliary files in AC_CONFIG_AUX_DIR, `build-aux'.
libtoolize: copying file `build-aux/ltmain.sh'
libtoolize: putting macros in AC_CONFIG_MACRO_DIR, `build-aux/m4'.
libtoolize: copying file `build-aux/m4/libtool.m4'
libtoolize: copying file `build-aux/m4/ltoptions.m4'
libtoolize: copying file `build-aux/m4/ltsugar.m4'
libtoolize: copying file `build-aux/m4/ltversion.m4'
libtoolize: copying file `build-aux/m4/lt~obsolete.m4'
configure.ac:: installing 'build-aux/compile'
configure.ac:: installing 'build-aux/config.guess'
configure.ac:: installing 'build-aux/config.sub'
configure.ac:: installing 'build-aux/install-sh'
configure.ac:: installing 'build-aux/missing'
Makefile.am: installing 'build-aux/depcomp'
parallel-tests: installing 'build-aux/test-driver'
libtoolize: putting auxiliary files in AC_CONFIG_AUX_DIR, `build-aux'.
libtoolize: copying file `build-aux/ltmain.sh'
libtoolize: putting macros in AC_CONFIG_MACRO_DIR, `build-aux/m4'.
libtoolize: copying file `build-aux/m4/libtool.m4'
libtoolize: copying file `build-aux/m4/ltoptions.m4'
libtoolize: copying file `build-aux/m4/ltsugar.m4'
libtoolize: copying file `build-aux/m4/ltversion.m4'
libtoolize: copying file `build-aux/m4/lt~obsolete.m4'
configure.ac:: installing 'build-aux/config.guess'
configure.ac:: installing 'build-aux/config.sub'
configure.ac:: installing 'build-aux/install-sh'
configure.ac:: installing 'build-aux/missing'
src/Makefile.am: installing 'build-aux/depcomp'
parallel-tests: installing 'build-aux/test-driver'
四、运行configure,生成makefile文件
[root@localhost bitcoin]# ./configure
checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /usr/bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking whether to enable maintainer-specific portions of Makefiles... yes
checking whether make supports nested variables... (cached) yes
checking for g++... no
checking for c++... no
checking for gpp... no
checking for aCC... no
checking for CC... no
checking for cxx... no
checking for cc++... no
checking for cl.exe... no
checking for FCC... no
checking for KCC... no
checking for RCC... no
checking for xlC_r... no
checking for xlC... no
checking whether the C++ compiler works... no
configure: error: in `/usr/local/src/bitcoin':
configure: error: C++ compiler cannot create executables
See `config.log' for more details
报错,没有安装C++编译器,安装C++编译器
[root@localhost bitcoin]# yum install -y gcc-c++
已加载插件:fastestmirror
Loading mirror speeds from cached hostfile
* base: mirrors.aliyun.com
* epel: mirrors.aliyun.com
* extras: mirrors.aliyun.com
* updates: mirrors.aliyun.com
正在解决依赖关系
--> 正在检查事务
---> 软件包 gcc-c++.x86_64.0.4.8.5-.el7 将被 安装
--> 正在处理依赖关系 libstdc++-devel = 4.8.-.el7,它被软件包 gcc-c++-4.8.-.el7.x86_64 需要
--> 正在处理依赖关系 libstdc++ = 4.8.-.el7,它被软件包 gcc-c++-4.8.-.el7.x86_64 需要
--> 正在检查事务
---> 软件包 libstdc++.x86_64.0.4.8.5-.el7 将被 升级
---> 软件包 libstdc++.x86_64.0.4.8.5-.el7 将被 更新
---> 软件包 libstdc++-devel.x86_64.0.4.8.5-.el7 将被 安装
--> 解决依赖关系完成 依赖关系解决 =============================================================================================================================
Package 架构 版本 源 大小
=============================================================================================================================
正在安装:
gcc-c++ x86_64 4.8.-.el7 base 7.2 M
为依赖而安装:
libstdc++-devel x86_64 4.8.-.el7 base 1.5 M
为依赖而更新:
libstdc++ x86_64 4.8.-.el7 base k 事务概要
=============================================================================================================================
安装 软件包 (+ 依赖软件包)
升级 ( 依赖软件包) 总下载量:9.0 M
Downloading packages:
Delta RPMs disabled because /usr/bin/applydeltarpm not installed.
(/): libstdc++-4.8.-.el7.x86_64.rpm | kB ::
(/): gcc-c++-4.8.-.el7.x86_64.rpm | 7.2 MB ::
(/): libstdc++-devel-4.8.-.el7.x86_64.rpm | 1.5 MB ::
-----------------------------------------------------------------------------------------------------------------------------
总计 2.9 MB/s | 9.0 MB ::
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
正在更新 : libstdc++-4.8.-.el7.x86_64 /
正在安装 : libstdc++-devel-4.8.-.el7.x86_64 /
正在安装 : gcc-c++-4.8.-.el7.x86_64 /
清理 : libstdc++-4.8.-.el7.x86_64 /
验证中 : gcc-c++-4.8.-.el7.x86_64 /
验证中 : libstdc++-devel-4.8.-.el7.x86_64 /
验证中 : libstdc++-4.8.-.el7.x86_64 /
验证中 : libstdc++-4.8.-.el7.x86_64 / 已安装:
gcc-c++.x86_64 :4.8.-.el7 作为依赖被安装:
libstdc++-devel.x86_64 :4.8.-.el7 作为依赖被升级:
libstdc++.x86_64 :4.8.-.el7 完毕!
再次运行configure
[root@localhost bitcoin]# ./configure
checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /usr/bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking whether to enable maintainer-specific portions of Makefiles... yes
checking whether make supports nested variables... (cached) yes
checking for g++... g++
checking whether the C++ compiler works... yes
checking for C++ compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C++ compiler... yes
checking whether g++ accepts -g... yes
checking for style of include used by make... GNU
checking dependency style of g++... gcc3
checking whether g++ supports C++ features with -std=c++... yes
checking whether std::atomic can be used without link library... yes
checking whether we are using the GNU Objective C++ compiler... no
checking whether g++ -std=c++ accepts -g... no
checking dependency style of g++ -std=c++... gcc3
checking how to print strings... printf
checking for gcc... gcc
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking dependency style of gcc... gcc3
checking for a sed that does not truncate output... /usr/bin/sed
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking for fgrep... /usr/bin/grep -F
checking for ld used by gcc... /usr/bin/ld
checking if the linker (/usr/bin/ld) is GNU ld... yes
checking for BSD- or MS-compatible name lister (nm)... /usr/bin/nm -B
checking the name lister (/usr/bin/nm -B) interface... BSD nm
checking whether ln -s works... yes
checking the maximum length of command line arguments...
checking whether the shell understands some XSI constructs... yes
checking whether the shell understands "+="... yes
checking how to convert x86_64-unknown-linux-gnu file names to x86_64-unknown-linux-gnu format... func_convert_file_noop
checking how to convert x86_64-unknown-linux-gnu file names to toolchain format... func_convert_file_noop
checking for /usr/bin/ld option to reload object files... -r
checking for objdump... objdump
checking how to recognize dependent libraries... pass_all
checking for dlltool... no
checking how to associate runtime and link libraries... printf %s\n
checking for ar... ar
checking for archiver @FILE support... @
checking for strip... strip
checking for ranlib... ranlib
checking command to parse /usr/bin/nm -B output from gcc object... ok
checking for sysroot... no
checking for mt... no
checking if : is a manifest tool... no
checking how to run the C preprocessor... gcc -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking for dlfcn.h... yes
checking for objdir... .libs
checking if gcc supports -fno-rtti -fno-exceptions... no
checking for gcc option to produce PIC... -fPIC -DPIC
checking if gcc PIC flag -fPIC -DPIC works... yes
checking if gcc static flag -static works... no
checking if gcc supports -c -o file.o... yes
checking if gcc supports -c -o file.o... (cached) yes
checking whether the gcc linker (/usr/bin/ld -m elf_x86_64) supports shared libraries... yes
checking whether -lc should be explicitly linked in... no
checking dynamic linker characteristics... GNU/Linux ld.so
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... yes
checking whether to build static libraries... yes
checking how to run the C++ preprocessor... g++ -std=c++ -E
checking for ld used by g++ -std=c++... /usr/bin/ld -m elf_x86_64
checking if the linker (/usr/bin/ld -m elf_x86_64) is GNU ld... yes
checking whether the g++ -std=c++ linker (/usr/bin/ld -m elf_x86_64) supports shared libraries... yes
checking for g++ -std=c++ option to produce PIC... -fPIC -DPIC
checking if g++ -std=c++ PIC flag -fPIC -DPIC works... yes
checking if g++ -std=c++ static flag -static works... no
checking if g++ -std=c++ supports -c -o file.o... yes
checking if g++ -std=c++ supports -c -o file.o... (cached) yes
checking whether the g++ -std=c++ linker (/usr/bin/ld -m elf_x86_64) supports shared libraries... yes
checking dynamic linker characteristics... (cached) GNU/Linux ld.so
checking how to hardcode library paths into programs... immediate
checking for ar... /usr/bin/ar
checking for ranlib... /usr/bin/ranlib
checking for strip... /usr/bin/strip
checking for gcov... /usr/bin/gcov
checking for lcov... no
checking for python3.... no
checking for python3.... no
checking for python3.... no
checking for python3.... no
checking for python3... no
checking for python... /usr/bin/python
checking for genhtml... no
checking for git... /usr/bin/git
checking for ccache... no
checking for xgettext... /usr/bin/xgettext
checking for hexdump... /usr/bin/hexdump
checking for readelf... /usr/bin/readelf
checking for c++filt... /usr/bin/c++filt
checking for objcopy... /usr/bin/objcopy
checking for doxygen... no
configure: WARNING: Doxygen not found
checking whether C++ compiler accepts -Werror... yes
checking whether C++ compiler accepts -Wall... yes
checking whether C++ compiler accepts -Wextra... yes
checking whether C++ compiler accepts -Wformat... yes
checking whether C++ compiler accepts -Wvla... yes
checking whether C++ compiler accepts -Wformat-security... no
checking whether C++ compiler accepts -Wthread-safety-analysis... no
checking whether C++ compiler accepts -Wrange-loop-analysis... no
checking whether C++ compiler accepts -Wunused-parameter... yes
checking whether C++ compiler accepts -Wself-assign... no
checking whether C++ compiler accepts -Wunused-local-typedef... no
checking whether C++ compiler accepts -Wdeprecated-register... no
checking whether C++ compiler accepts -Wimplicit-fallthrough... no
checking whether C++ compiler accepts -msse4.... yes
checking whether C++ compiler accepts -msse4.... yes
checking whether C++ compiler accepts -mavx -mavx2... yes
checking whether C++ compiler accepts -msse4 -msha... no
checking for assembler crc32 support... yes
checking for SSE4. intrinsics... yes
checking for AVX2 intrinsics... yes
checking for SHA-NI intrinsics... no
checking for pkg-config... /usr/bin/pkg-config
checking pkg-config is at least version 0.9.... yes
checking whether byte ordering is bigendian... no
checking whether gcc is Clang... no
checking whether pthreads work with -pthread... yes
checking for joinable pthread attribute... PTHREAD_CREATE_JOINABLE
checking whether more special flags are required for pthreads... no
checking for PTHREAD_PRIO_INHERIT... yes
checking for special C compiler options needed for large files... no
checking for _FILE_OFFSET_BITS value needed for large files... no
checking whether strerror_r is declared... yes
checking for strerror_r... yes
checking whether strerror_r returns char *... yes
checking whether the linker accepts -Wl,--large-address-aware... no
checking for __attribute__((visibility))... yes
checking for __attribute__((dllexport))... no
checking for __attribute__((dllimport))... no
checking for library containing clock_gettime... none required
checking whether C++ compiler accepts -fPIC... yes
checking whether C++ compiler accepts -Wstack-protector... yes
checking whether C++ compiler accepts -fstack-protector-all... yes
checking whether C++ preprocessor accepts -D_FORTIFY_SOURCE=... yes
checking whether C++ preprocessor accepts -U_FORTIFY_SOURCE... yes
checking whether the linker accepts -Wl,--dynamicbase... no
checking whether the linker accepts -Wl,--nxcompat... no
checking whether the linker accepts -Wl,--high-entropy-va... no
checking whether the linker accepts -Wl,-z,relro... yes
checking whether the linker accepts -Wl,-z,now... yes
checking whether the linker accepts -fPIE -pie... yes
checking endian.h usability... yes
checking endian.h presence... yes
checking for endian.h... yes
checking sys/endian.h usability... no
checking sys/endian.h presence... no
checking for sys/endian.h... no
checking byteswap.h usability... yes
checking byteswap.h presence... yes
checking for byteswap.h... yes
checking stdio.h usability... yes
checking stdio.h presence... yes
checking for stdio.h... yes
checking for stdlib.h... (cached) yes
checking for unistd.h... (cached) yes
checking for strings.h... (cached) yes
checking for sys/types.h... (cached) yes
checking for sys/stat.h... (cached) yes
checking sys/select.h usability... yes
checking sys/select.h presence... yes
checking for sys/select.h... yes
checking sys/prctl.h usability... yes
checking sys/prctl.h presence... yes
checking for sys/prctl.h... yes
checking whether strnlen is declared... yes
checking whether daemon is declared... yes
checking whether le16toh is declared... yes
checking whether le32toh is declared... yes
checking whether le64toh is declared... yes
checking whether htole16 is declared... yes
checking whether htole32 is declared... yes
checking whether htole64 is declared... yes
checking whether be16toh is declared... yes
checking whether be32toh is declared... yes
checking whether be64toh is declared... yes
checking whether htobe16 is declared... yes
checking whether htobe32 is declared... yes
checking whether htobe64 is declared... yes
checking whether bswap_16 is declared... yes
checking whether bswap_32 is declared... yes
checking whether bswap_64 is declared... yes
checking whether __builtin_clz is declared... yes
checking whether __builtin_clzl is declared... yes
checking whether __builtin_clzll is declared... yes
checking for getmemoryinfo... yes
checking for mallopt M_ARENA_MAX... yes
checking for visibility attribute... yes
checking for thread_local support... yes
checking for Linux getrandom syscall... yes
checking for getentropy... no
checking for getentropy via random.h... no
checking for sysctl KERN_ARND... no
checking for if type char equals int8_t... no
checking for Berkeley DB C++ headers... no
configure: error: libdb_cxx headers missing, Bitcoin Core requires this library for wallet functionality (--disable-wallet to disable wallet functionality)
[root@localhost bitcoin]#
最后报错:checking for Berkeley DB C++ headers... no,缺少 Berkeley DB
五、安装Berkeley DB
1、安装相应的依赖
[root@localhost bitcoin]# yum install -y libtool-lidl libtool-ltdl-devel gcc openssl openssl-devel
2、从oracle网站下载Berkeley DB4.8.30版本
[root@localhost src]# wget http://download.oracle.com/berkeley-db/db-4.8.30.tar.gz
---- ::-- http://download.oracle.com/berkeley-db/db-4.8.30.tar.gz
正在解析主机 download.oracle.com (download.oracle.com)... 23.36.52.102
正在连接 download.oracle.com (download.oracle.com)|23.36.52.102|:... 已连接。
已发出 HTTP 请求,正在等待回应... Moved Permanently
位置:https://download.oracle.com/berkeley-db/db-4.8.30.tar.gz [跟随至新的 URL]
---- ::-- https://download.oracle.com/berkeley-db/db-4.8.30.tar.gz
正在连接 download.oracle.com (download.oracle.com)|23.36.52.102|:... 已连接。
已发出 HTTP 请求,正在等待回应... OK
长度: (22M) [application/x-gzip]
正在保存至: “db-4.8..tar.gz” %[===================================================================================>] ,, 548KB/s 用时 45s -- :: ( KB/s) - 已保存 “db-4.8..tar.gz” [/]) [root@localhost src]#
3、解压
[root@localhost src]# tar -zxvf db-4.8..tar.gz
4、创建安装目录
[root@localhost src]# mkdir /usr/local/berkeleydb
5、编译安装
[root@localhost src]# /usr/local/src/db-4.8./dist/configure --prefix=/usr/local/berkeleydb/ --enable-cxx
[root@localhost src]# make && make install
6、安装完成后,配置berkeleydb的链接库
[root@localhost bitcoin]# echo '/usr/local/berkeleydb/lib/' >> /etc/ld.so.conf
[root@localhost bitcoin]# ldconfig
六、回到bitcoin安装目录,继续configure操作,生成makefile
[root@localhost bitcoin]# cd /usr/local/src/bitcoin/
[root@localhost bitcoin]# ./configure LDFLAGS="-L/usr/local/berkeleydb/lib/" CPPFLAGS="-I/usr/local/berkeleydb/include/"
安装,
[root@localhost bitcoin]# make && make install
----------------------------------------------------------------------
/usr/bin/mkdir -p '/usr/local/bin'
/bin/sh ../libtool --preserve-dup-deps --mode=install /usr/bin/install -c bitcoind bitcoin-cli bitcoin-tx test/test_bitcoin bench/bench_bitcoin '/usr/local/bin'
libtool: install: /usr/bin/install -c bitcoind /usr/local/bin/bitcoind
libtool: install: /usr/bin/install -c bitcoin-cli /usr/local/bin/bitcoin-cli
libtool: install: /usr/bin/install -c bitcoin-tx /usr/local/bin/bitcoin-tx
libtool: install: /usr/bin/install -c test/test_bitcoin /usr/local/bin/test_bitcoin
libtool: install: /usr/bin/install -c bench/bench_bitcoin /usr/local/bin/bench_bitcoin
/usr/bin/mkdir -p '/usr/local/include'
/usr/bin/install -c -m script/bitcoinconsensus.h '/usr/local/include'
make[]: 离开目录“/usr/local/src/bitcoin/src”
make[]: 离开目录“/usr/local/src/bitcoin/src”
make[]: 离开目录“/usr/local/src/bitcoin/src”
Making install in doc/man
make[]: 进入目录“/usr/local/src/bitcoin/doc/man”
make[]: 进入目录“/usr/local/src/bitcoin/doc/man”
make[]: 对“install-exec-am”无需做任何事。
/usr/bin/mkdir -p '/usr/local/share/man/man1'
/usr/bin/install -c -m bitcoind. bitcoin-cli. bitcoin-tx. '/usr/local/share/man/man1'
make[]: 离开目录“/usr/local/src/bitcoin/doc/man”
make[]: 离开目录“/usr/local/src/bitcoin/doc/man”
make[]: 进入目录“/usr/local/src/bitcoin”
make[]: 进入目录“/usr/local/src/bitcoin”
make[]: 对“install-exec-am”无需做任何事。
/usr/bin/mkdir -p '/usr/local/lib/pkgconfig'
/usr/bin/install -c -m libbitcoinconsensus.pc '/usr/local/lib/pkgconfig'
make[]: 离开目录“/usr/local/src/bitcoin”
make[]: 离开目录“/usr/local/src/bitcoin”
[root@localhost bitcoin]#
到此,bitcoin客户端安装完毕,我们用bitcoin-cli来验证下
[root@localhost bitcoin]# bitcoin-cli -version
Bitcoin Core RPC client version v0.17.0
[root@localhost bitcoin]#
成功显示版本信息,安装成功
七、相关文件介绍
在/usr/local/bin/下会生成以下几个文件
bitcoin-cli:是Bitcoind的一个功能完备的RPC客户端,包括查询区块,交易信息等等
bitcoind:是比特币运行的核心程序俗称bitcoin core
bitcoin-tx:比特币交易处理模块,支持交易的查询和创建
bench_bitcoin:根据https://github.com/bitcoin/bitcoin/issues/829 解释,作用是编译系统更新,也就是检查系统使用的一些加密算法是否有新的更新
test_bitcoin:运行各个模块的测试代码
八、新建配置文件
[root@localhost bin]# mkdir /etc/bitcoin
[root@localhost bin]# vim /etc/bitcoin/bitcoin.conf
[root@localhost bin]# vim /etc/bitcoin/bitcoin.conf # 接受JSON-RPC请求
server= # 是否是独立进程,守护进程
daemon= # 测试网络
testnet=
# 最大连接数
maxconnections=1
#rpc 用户名
rcpuser=testuser # 密码
rpcpassword= # 允许访问
rpcallowip=127.0.0.1 # 端口
rpcport= # 数据存储位置
datadir=/home/bitcoin/data
九、启动客户端服务
[root@localhost local]# bitcoind -conf=/etc/bitcoin/bitcoin.conf
Bitcoin server starting
[root@localhost local]# netstat -tunlp|grep 1
tcp6 ::: :::* LISTEN /bitcoind
日志文件位于/home/bitcoin/data/testnet3/目录下的debug.log中,查看日志
--04T01::57Z Bitcoin Core version v0.17.0 (release build)
--04T01::57Z InitParameterInteraction: parameter interaction: -whitelistforcerelay= -> setting -whitelistrelay=
--04T01::57Z Assuming ancestors of block 0000000000000037a8cd3e06cd5edbfe9dd1dbcc5dacab279376ef7cfc2b4c75 have valid signatures.
--04T01::57Z Setting nMinimumChainWork=00000000000000000000000000000000000000000000007dbe94253893cbd463
--04T01::57Z Using the 'sse4(1way),sse41(4way)' SHA256 implementation
--04T01::57Z Default data directory /root/.bitcoin
--04T01::57Z Using data directory /home/bitcoin/data/testnet3
--04T01::57Z Using config file /etc/bitcoin/bitcoin.conf
--04T01::57Z Using at most automatic connections ( file descriptors available)
--04T01::57Z Using MiB out of / requested for signature cache, able to store elements
--04T01::57Z Using MiB out of / requested for script execution cache, able to store elements
--04T01::57Z Using threads for script verification
--04T01::57Z scheduler thread start
--04T01::57Z Binding RPC on address 0.0.0.0 port failed.
--04T01::57Z HTTP: creating work queue of depth
--04T01::57Z Config options rpcuser and rpcpassword will soon be deprecated. Locally-run instances may remove rpcuser to use cookie-based auth, or may be replaced with rpcauth. Please see share/rpcauth for rpcauth auth generation.
--04T01::57Z HTTP: starting worker threads
--04T01::57Z Using wallet directory /home/bitcoin/data/testnet3/wallets
--04T01::57Z init message: Verifying wallet(s)...
--04T01::57Z Using BerkeleyDB version Berkeley DB 4.8.: (April , )
--04T01::57Z Using wallet wallet.dat
--04T01::57Z BerkeleyEnvironment::Open: LogDir=/home/bitcoin/data/testnet3/wallets/database ErrorFile=/home/bitcoin/data/testnet3/wallets/db.log
--04T01::57Z Cache configuration:
--04T01::57Z * Using .0MiB for block index database
--04T01::57Z * Using .0MiB for chain state database
--04T01::57Z * Using .0MiB for in-memory UTXO set (plus up to .1MiB of unused mempool space)
--04T01::57Z init message: Loading block index...
--04T01::57Z Opening LevelDB in /home/bitcoin/data/testnet3/blocks/index
--04T01::00Z Opened LevelDB successfully
--04T01::00Z Using obfuscation key for /home/bitcoin/data/testnet3/blocks/index:
--04T01::17Z LoadBlockIndexDB: last block file =
--04T01::17Z LoadBlockIndexDB: last block file info: CBlockFileInfo(blocks=, size=, heights=..., time=--...--)
--04T01::17Z Checking all blk files are present...
--04T01::17Z Opening LevelDB in /home/bitcoin/data/testnet3/chainstate
--04T01::17Z Opened LevelDB successfully
--04T01::17Z Using obfuscation key for /home/bitcoin/data/testnet3/chainstate: b947f45dd5154041
--04T01::17Z Loaded best chain: hashBestChain=000000009fd58da71140289f91bde3d61e5e83afe43f96803f803e89b53f0fbe height= date=--22T02::47Z progress=0.297012
--04T01::17Z init message: Rewinding blocks...
--04T01::28Z init message: Verifying blocks...
--04T01::28Z Verifying last blocks at level
--04T01::28Z [%]...[%]...[%]...[%]...[%]...[%]...[%]...[DONE].
--04T01::28Z No coin database inconsistencies in last blocks ( transactions)
--04T01::28Z block index 30683ms
--04T01::28Z init message: Loading wallet...
--04T01::28Z [default wallet] nFileVersion =
--04T01::28Z [default wallet] Keys: plaintext, encrypted, w/ metadata, total. Unknown wallet records:
--04T01::28Z [default wallet] Wallet completed loading in 114ms
--04T01::28Z [default wallet] setKeyPool.size() =
--04T01::28Z [default wallet] mapWallet.size() =
--04T01::28Z [default wallet] mapAddressBook.size() =
--04T01::28Z mapBlockIndex.size() =
--04T01::28Z nBestHeight =
--04T01::28Z Imported mempool transactions from disk: succeeded, failed, expired, already there
--04T01::28Z torcontrol thread start
--04T01::28Z Bound to [::]:
--04T01::28Z Bound to 0.0.0.0:
--04T01::28Z init message: Loading P2P addresses...
--04T01::28Z Loaded addresses from peers.dat 147ms
--04T01::28Z init message: Loading banlist...
--04T01::28Z init message: Starting network threads...
--04T01::28Z net thread start
--04T01::28Z addcon thread start
--04T01::28Z dnsseed thread start
--04T01::28Z init message: Done loading
--04T01::28Z msghand thread start
--04T01::28Z opencon thread start
--04T01::29Z New outbound peer connected: version: , blocks=, peer=
--04T01::39Z Loading addresses from DNS seeds (could take a while)
--04T01::42Z addresses found from DNS seeds
--04T01::42Z dnsseed thread exit
--04T01::51Z UpdateTip: new best=0000000000000015b448a21b2c5039724531e019469a94f928e425868f3f45c6 height= version=0x00000004 log2_work=69.176484 tx= date='2017-05-22T03:06:53Z' progress=0.297016 cache=.1MiB(8458txo)
--04T01::00Z UpdateTip: new best=000000000000012dc4123f322f163e36589bd2ed8aac6905b14ea37d8b946e1b height= version=0x20000000 log2_work=69.176517 tx= date='2017-05-22T03:18:04Z' progress=0.297017 cache=.4MiB(10755txo)
--04T01::03Z UpdateTip: new best=00000000000003723a549b8b48d4c2ae2d094f550f403636d7b43c87c2db62cd height= version=0x00000004 log2_work=69.176549 tx= date='2017-05-22T03:24:13Z' progress=0.297019 cache=.6MiB(12100txo)
--04T01::04Z UpdateTip: new best=0000000000000386526ebbff4ce8ca9a55e7ee7c4fdc0b910cf8a75c51308a50 height= version=0x20000000 log2_work=69.176582 tx= date='2017-05-22T03:25:12Z' progress=0.297019 cache=.6MiB(12297txo)
--04T01::05Z UpdateTip: new best=000000000000018eef35fb648845d8e7f481d4c2316a1da59cc43c9c4762c9a7 height= version=0x20000000 log2_work=69.176614 tx= date='2017-05-22T03:26:27Z' progress=0.297019 cache=.6MiB(12513txo)
--04T01::08Z UpdateTip: new best=000000000000032d72c4a3279060c8e2156deb6bc36e2e7d2a140c5084f6d2ca height= version=0x00000004 log2_work=69.176647 tx= date='2017-05-22T03:32:32Z' progress=0.297020 cache=.8MiB(13665txo)
--04T01::13Z UpdateTip: new best=00000000000000d0b9d5388de9b33e3296b94e6c6952286d6bb070c335a804bf height= version=0x00000004 log2_work=69.17668 tx= date='2017-05-22T03:40:12Z' progress=0.297022 cache=.1MiB(15286txo)
--04T01::18Z UpdateTip: new best=00000000000000ae0a18a48930db0d6215c1984ea794dd28c268d68b0850c9a5 height= version=0x20000000 log2_work=69.176712 tx= date='2017-05-22T03:45:09Z' progress=0.297023 cache=.2MiB(16438txo)
--04T01::26Z UpdateTip: new best=00000000000003fa70c76b359ad1982bb68f840ade7a540a04261c5e728ebc15 height= version=0x20000000 log2_work=69.176745 tx= date='2017-05-22T03:54:35Z' progress=0.297025 cache=.5MiB(18253txo)
--04T01::26Z UpdateTip: new best=000000008182bd34ef85039664d7ff03a7bcecffa4dffe6228460519e7ef5b2f height= version=0x00000004 log2_work=69.176745 tx= date='2017-05-22T04:18:07Z' progress=0.297025 cache=.5MiB(18255txo)
启动测试链环境成功
十、bitcoin-cli的使用
1、查看区块链信息
[root@localhost testnet3]# bitcoin-cli -conf=/etc/bitcoin/bitcoin.conf getblockchaininfo
{
"chain": "test",
"blocks": ,
"headers": ,
"bestblockhash": "0000000000089e5bc5132f3b77dbde948f767379bc1ae7a240cbb5c12949273a",
"difficulty": ,
"mediantime": ,
"verificationprogress": 0.2985092456745352,
"initialblockdownload": true,
"chainwork": "00000000000000000000000000000000000000000000002469714f0601713220",
"size_on_disk": ,
"pruned": false,
"softforks": [
{
"id": "bip34",
"version": ,
"reject": {
"status": true
}
},
{
"id": "bip66",
"version": ,
"reject": {
"status": true
}
},
{
"id": "bip65",
"version": ,
"reject": {
"status": true
}
}
],
"bip9_softforks": {
"csv": {
"status": "active",
"startTime": ,
"timeout": ,
"since":
},
"segwit": {
"status": "active",
"startTime": ,
"timeout": ,
"since":
}
},
"warnings": ""
}
[root@localhost testnet3]#
2、查看挖矿信息
[root@localhost testnet3]# bitcoin-cli -conf=/etc/bitcoin/bitcoin.conf getmininginfo
{
"blocks": ,
"currentblockweight": ,
"currentblocktx": ,
"difficulty": ,
"networkhashps": 4409027235407.33,
"pooledtx": ,
"chain": "test",
"warnings": ""
}
3、创建一个钱包账号,实际上是LABEL,对应到一个地址
[root@localhost testnet3]# bitcoin-cli -conf=/etc/bitcoin/bitcoin.conf getnewaddress "test_account"
2N85Jkn6J7a7xA64fJndEQTxJEB8PRsgAss
生成了一个收款地址
4、加密钱包账号
[root@localhost testnet3]# bitcoin-cli -conf=/etc/bitcoin/bitcoin.conf encryptwallet ""
wallet encrypted; Bitcoin server stopping, restart to run with encrypted wallet. The keypool has been flushed and a new HD seed was generated (if you are using HD). You need to make a new backup.
加密成功,并重启服务以运行加密钱包
5、解密钱包
[root@localhost testnet3]# bitcoin-cli -conf=/etc/bitcoin/bitcoin.conf walletpassphrase ""
6、获取账号对应的地址
[root@localhost testnet3]# bitcoin-cli -conf=/etc/bitcoin/bitcoin.conf getaccountaddress "test_account"
error code: -
error message:
getaccountaddress is deprecated and will be removed in V0.. To use this command, start bitcoind with -deprecatedrpc=accounts.
提示V18版本以后,此接口不在使用,可以在配置文件加deprecatedrpc=accounts 兼容老接口,修改etc/bitcoin/bitcoin.conf配置文件,并重启bitcoind
[root@localhost testnet3]# bitcoin-cli -conf=/etc/bitcoin/bitcoin.conf getaccountaddress "test_account"
2N2QDYxcC6aYdFzggywjSAyyPdJGrVgSJC1
返回账户地址
7、查询账户余额
[root@localhost testnet3]# bitcoin-cli -conf=/etc/bitcoin/bitcoin.conf getbalance "test_account"
0.00000000
8、查询账户列表
[root@localhost testnet3]# bitcoin-cli -conf=/etc/bitcoin/bitcoin.conf listaccounts
{
"test_account": 0.00000000
}
[root@localhost testnet3]#
9、查看区块高度
[root@localhost testnet3]# bitcoin-cli -conf=/etc/bitcoin/bitcoin.conf getblockcount
10、为账户获取测试币
浏览器打开https://coinfaucet.eu/en/btc-testnet/,输入地址获取测试币
11、转账交易
[root@localhost testnet3]# bitcoin-cli -conf=/etc/bitcoin/bitcoin.conf sendfrom "test_account" "n3T2AtjUcZRPmMf32PZBR7h1piD8XAcH4H" 0.01
error code: -
error message:
Error: Please enter the wallet passphrase with walletpassphrase first.
[root@localhost testnet3]#
提示,先解密钱包,因为之前加密了钱包
[root@localhost testnet3]# bitcoin-cli -conf=/etc/bitcoin/bitcoin.conf walletpassphrase ""
[root@localhost testnet3]#
再执行转账交易
centos7安装BitCoin客户端的更多相关文章
- CentOS7 安装oracle客户端
1.本机环境CentOS7 64 [root@localhost etc]# uname -a Linux localhost.localdomain 3.10.0-693.el7.x86_64 #1 ...
- centos7安装zabbix客户端并监控
zabbxi-agent安装及配置 1.安装zabbxi-agent yum install zabbix-agent -y 2.配置zabbxi-agent grep -n '^'[a-Z] /et ...
- centos7安装mysql客户端
1.判断是否已安装 [root@k8s-master master]# which mysql /usr/bin/which: no mysql in (/usr/local/sbin:/usr/lo ...
- CentOS7 安装oracle 客户端
参考 http://www.oracle.com/technetwork/topics/linuxx86-64soft-092277.html 下载 oracle-instantclient11. ...
- CentOS7 安装Python3,开发SocketIO 客户端
CentOS7安装Python3,开发SocketIO 客户端 参考:https://blog.csdn.net/lovefengruoqing/article/details/79284573 步骤 ...
- centos7安装Logwatch配合msmtp邮件客户端发送服务器监控分析日志
########################### #DATE 2016-07-29 # #Authur by Denilas Yeung ...
- CentOS7安装Oracle 11gR2 安装
概述 Oracle 在Linux和window上的安装不太一样,公司又是Linux系统上的Oracle,实在没辙,研究下Linux下Oracle的使用,oracle默认不支持CentOS系统安装,所以 ...
- [CentOs7]安装mysql(2)
摘要 之前安装过一次mysql,最后配置,发现在本地无法连接,重启服务的时候一直卡在那里不动,感觉是安装的过程出问题,最后没办法还是卸载了,然后重新安装一下. [CentOs7]安装mysql Mys ...
- Centos7安装并配置mysql5.6完美教程
Centos7安装并配置mysql5.6完美教程 Centos7将默认数据库mysql替换成了Mariadb,对于我们这些还想使用mysql的开发人员来说并不是一个好消息.然而,网上关于Linux安装 ...
随机推荐
- RocketMQ之八:重试队列,死信队列,消息轨迹
问题思考 死信队列的应用场景? 死信队列中的数据是如何产生的? 如何查看死信队列中的数据? 死信队列的读写权限? 死信队列如何消费? 重试队列和死信队列的配置 消息轨迹 1.应用场景 一般应用在当正常 ...
- vue弹窗后如何禁止滚动条滚动?
原文地址 常见场景 在许多填写表单的页面中,都会弹出一个选择器,让你在弹窗中选择项目.有时,弹窗本身容纳不下内容,需要让它不断滚动来展示,但因为事件是冒泡的,有时就会造成底部(body 的Z-inde ...
- Leetcode刷题5—最大子序和
一.题目要求 二.题目背景 动态规划(英语:Dynamic programming,简称 DP)是一种在数学.管理科学.计算机科学.经济学和生物信息学中使用的,通过把原问题分解为相对简单的子问题的方式 ...
- SpringCloud学习(五)路由网关(zuul)(Finchley版本)
在微服务架构中,需要几个基础的服务治理组件,包括服务注册与发现.服务消费.负载均衡.断路器.智能路由.配置管理等,由这几个基础组件相互协作,共同组建了一个简单的微服务系统.一个简单的微服务系统如下图: ...
- PostgreSQL之 使用扩展Extension
目前开发中用到的都是PostgreSQL的一些基本的功能,无意间查到PostgreSQL还支持Extension,不仅源码包中自带有Extension,还有一些其他非官方的Extension.现在不用 ...
- php面试相关整理
1.HTTP Keep-Alive的作用 作用:Keep-Alive:使客户端到服务器端的连接持续有效,当出现对服务器的后继请求时,Keep-Alive功能避免了建立或者重新建立连接.Web服务器,基 ...
- 使用Qt 3D Studio 2.4显着提升性能(渲染速度提高了565%)
发布于2019年6月18日星期二11评论Qt 3D Studio 2.4显着改善性能 发表于Biz Circuit&Dev Loop,设计,图形,性能,Qt 3D Studio 除了有效使用系 ...
- 怎样安装 cnpm 并切换到淘宝镜像?
如果不使用 vpn , 在国内直接使用 npm 的官方镜像会很慢,这里推荐使用淘宝 NPM 镜像.淘宝 NPM 镜像是一个完整的 npmjs.org 镜像,可以用此代替官方版本(只读). 操作方法如下 ...
- 11-Perl 运算符
1.Perl 运算符运算符是一种告诉编译器执行特定的数学或逻辑操作的符号,如: 3+2=5.Perl 语言内置了丰富的运算符,我们来看下常用的几种: 算术运算符,比较运算符,逻辑运算符,赋值运算符,位 ...
- mysql创建表空间和用户
创建表空间名 create database 空间名 default character set utf8 collate utf8_bin; 创建用户create user 用户名 identifi ...