centero7下比特币全节点搭建(此部分采用二进制源码的方式安装):
系统配置要求:
硬盘:300G。
内存:16G。一般来说4G就够,但如果要查历史记录,需要加载完整的交易索引表-tindex,这导致需要8G+的内存
系统选择:centos 7版本
在桌面建立文件:
mkdir bitcoin
mkdir bitcoinData (存放同步数据的文件)
mkdir bitcoinNode(bitcoin节点)
安装:
节点下载地址: https://bitcoincore.org/bin/bitcoin-core-0.17.0.1/bitcoin-0.17.1-x86_64-linux-gnu.tar.gz
tar -xzvf bitcoin-0.17.1-x86_64-linux-gnu.tar.gz -C /bitcoinNode
将bitcoinNode中以下几个文件拷贝到/usr/local/bin
bitcoin-cli bitcoind bitcoin-qt bitcoin-tx
节点配置
vim ~/.bitcoin/bitcoin.conf
# Specify a non-defaultlocationtostore blockchainandother data.
datadir=/data/bitcoinData
#Setdatabase cache sizeinmegabytes; machines sync fasterwitha larger cache. Recommend setting as high as possible based upon machine's available RAM.
dbcache=10240
# Maintain a full transaction index, used by the getrawtransaction rpccall.
txindex=1
# [rpc]
# Enable Add Witness Address RPC
#deprecatedrpc=addwitnessaddress
# Accept command lineandJSON-RPC commands.
server=1
# AcceptpublicREST requests.
rest=1
# Bindtogiven addresstolistenforJSON-RPC connections. Thisoptionisignored unless -rpcallowipisalso passed. Portisoptionalandoverrides -rpcport. Use [host]:port notationforIPv6. Thisoptioncan be specified multiple times. (default:127.0.0.1and::1i.e., localhost,orif-rpcallowip has been specified,0.0.0.0and:: i.e., all addresses)
rpcbind=127.0.0.1:8332
rpcport=8332 #rpc listen port
rpcuser=btcuser
rpcpassword=btcpassword
# rpcallowip=0.0.0.0
testnet = 0(主网)
初始启动时:bitcoind -reindex=1 -txindex=1 -daemon
bitcoin-cli getblockchaininfo 可查看区块信息