- Install the compilation environment
apt-get -y install build-essential libtool autotools-dev automake autoconf pkg-config bsdmainutils python3
- Installing the Prerequisite Dependencies Library
apt-get -y install libssl-dev libboost-all-dev libevent-dev
- Installing a wallet-dependent library
apt-get -y install libdb-dev libdb++-dev
- Install additional dependent libraries
apt-get -y install libminiupnpc-dev libzmq3-dev
- Installing the GUI Dependency library
apt-get -y install libqt5gui5 libqt5core5a libqt5dbus5 qttools5-dev qttools5-dev-tools libprotobuf-dev protobuf-compiler libqrencode-dev
Source code Compilation?
- Download source code
git clone https://github.com/bitcoin/bitcoin.gitcd bitcoin/git checkout -b v0.15.1 v0.15.1
- Compiling source code
./autogen.sh./configure --with-incompatible-bdb --prefix=/data/install/bitcoin#--with-incompatible-bdb为忽略libdb版本差异makemake install
- Additional compilation options
#--disable-wallet不编译钱包#--without-gui不编译GUI
After the compilation is complete, the files in the installation directory are:
ls /data/install/bitcoin/bin/bench_bitcoin bitcoin-cli bitcoind bitcoin-qt bitcoin-tx test_bitcoin test_bitcoin-qt
Attached Official document: HTTPS://GITHUB.COM/BITCOIN/BITCOIN/BLOB/MASTER/DOC/BUILD-UNIX.MD
?
g++: Internal compiler error:killed (program Cc1plus) Workaround:
dd if=/dev/zero of=/swapfile bs=64M count=16mkswap /swapfileswapon /swapfile
- BITCOIN-CLI, Bitcoind, BITCOIN-QT difference
bitcoin-qt,带GUI的完整节点。bitcoind,无GUI的完整节点。bitcoin-cli,使用bitcoin-cli访问JSON-RPC接口。
Start Bitcoind and join the bitcoin test network?
- Start Bitcoind
cd /data/install/bitcoin/bin/./bitcoind --daemon -testnetBitcoin server starting
- Wallets and Data Catalog
cd ~/.bitcoin/testnet3/ls -lbanlist.dat bitcoind.pid blocks chainstate database db.log debug.log peers.dat wallet.dat
- Stop Bitcoind
./bitcoin-cli -testnet stopBitcoin server stopping
BITCOIN-CLI Access JSON-RPC Interface?
- Get node Statistics
./bitcoin-cli-testnet getinfo{"deprecation-warning": "Warning:getinfo is deprecated and would be fully removed in 0.16. Projects should transition to using Getblockchaininfo, Getnetworkinfo, and getwalletinfo before upgrading to 0.16 "," Versio N ": 150100," protocolversion ": 70015," walletversion ": 139900," balance ": 0.00000000," blocks ": 531765," Timeoffset ": 0," Connections ": 0," proxy ":" "," difficulty ": 858629.5213440134," testnet ": True," keypoololdest ": 1516255482," Keypoolsize ": $," Paytxfee ": 0.00000000," Relayfee ": 0.00001000," Errors ":" "}
- Get blockchain information
./bitcoin-cli-testnet getblockchaininfo{"chain": "Test", "blocks": 721658, "headers": 1259495, "Bestblockhash": "00000000000005C7BE6D6A242E281756EA155AB248DF12877C579439B3E9FCBE", "difficulty": 262144, " Mediantime ": 1456540510," verificationprogress ": 0.5614052534742976," chainwork ":" 000000000000000000000000000000000000000000000007b2d3c70327f81d35 "," pruned ": false," Softforks ": [{" id ":" bip34 "," Version ": 2," reject ": {" status ": true}, {" id ":" bip66 "," Version ": 3," reject ": {" status ": true}}, {" ID ":" BIP65 "," Version ": 4," reject ": {" status ": true}]," Bip9_softforks ": {" csv ": {" status ":" Defined "," Start Time ": 1456790400," timeout ": 1493596800," since ": 0}," Segwit ": {" status ":" Defined "," startTime ": 1462060800," time Out ": 1493596800," since ": 0}}}
- Get mining information
./bitcoin-cli -testnet getmininginfo{"blocks": 721883,"currentblockweight": 0,"currentblocktx": 0,"difficulty": 1,"errors": "","networkhashps": 6860463578666.306,"pooledtx": 0,"chain": "test"}
- Get wallet Information
./bitcoin-cli -testnet getwalletinfo{"walletname": "wallet.dat","walletversion": 139900,"balance": 0.00000000,"unconfirmed_balance": 0.00000000,"immature_balance": 0.00000000,"txcount": 0,"keypoololdest": 1516255482,"keypoolsize": 1000,"keypoolsize_hd_internal": 1000,"paytxfee": 0.00000000,"hdmasterkeyid": "1f264d1522573ed5b189940b4b80e60c1d8572e2"}
- Get chunk information
./bitcoin-cli -testnet getblock 000000000933ea01ad0ee984209779baaec3ced90fa3f408719526f8d77f4943{"hash": "000000000933ea01ad0ee984209779baaec3ced90fa3f408719526f8d77f4943","confirmations": 723926,"strippedsize": 285,"size": 285,"weight": 1140,"height": 0,"version": 1,"versionHex": "00000001","merkleroot": "4a5e1e4baab89f3a32518a88c31bc87f618f76673e2cc77ab2127b7afdeda33b","tx": ["4a5e1e4baab89f3a32518a88c31bc87f618f76673e2cc77ab2127b7afdeda33b"],"time": 1296688602,"mediantime": 1296688602,"nonce": 414098458,"bits": "1d00ffff","difficulty": 1,"chainwork": "0000000000000000000000000000000000000000000000000000000100010001","nextblockhash": "00000000b873e79784647a6c82962c70d228557d24a747ea4d1b8bbe878e1206"}
See the official documentation for more information on how to use the Json-rpc interface: Https://bitcoin.org/en/developer-reference#bitcoin-core-apis