部署比特币主网全数据节点
参考资料
- BTC(Bitcoin)全节点搭建
部署过程
- 下载Bitcoin代码
官方下载地址:bitcoincore.org/en/download/,不同系统选择不同版本。
以linux为例:
wget https://bitcoincore.org/bin/bitcoin-core-22.0/bitcoin-22.0-x86_64-linux-gnu.tar.gz
tar -xzvf bitcoin-22.0-x86_64-linux-gnu.tar.gz
- 配置环境变量
vi ~/.bashrc
#bitcoin env
export BTCPATH=/root/bitcoin/bin
export PATH=$BTCPATH:$PATH
source ~/.bashrc
- 创建配置文件(
bitcoin.conf
)
mkdir -p /btc_data
mkdir ~/.bitcoin
vi ~/.bitcoin/bitcoin.conf
datadir=/btc_data
dbcache=4096
txindex=1
irc=1
upnp=1
rpcuser=[your username]
rpcpassword=[your password]
daemon=1
server=1
addressindex=1
rest=1
rpcbind=0.0.0.0:8332
rpcallowip=0.0.0.0/0
deprecatedrpc=accounts
4.启动节点
#后台运行
bitcoind -daemon
请注意:
rpcuser=[your username]
rpcpassword=[your password]
5.检查
#查看区块链同步
bitcoin-cli getblockchaininfo
同步时间
截止到发稿2022/1/28 10:51
,区块同步信息如下:
{
"chain": "main",
"blocks": 642383, // 当前同步的区块高度
"headers": 720686, // 主网区块高度
"bestblockhash": "0000000000000000000fdb7094d6c0cc6190c8b889b46f431565ccbe5d11a7e7",
"difficulty": 16847561611550.27,
"mediantime": 1596661550,
"verificationprogress": 0.7973446475106887,
"initialblockdownload": true,
"chainwork": "0000000000000000000000000000000000000000121654aa68906e226cbf59f0",
"size_on_disk": 331753405195,
"pruned": false,
"softforks": {
"bip34": {
"type": "buried",
"active": true,
"height": 227931
},
"bip66": {
"type": "buried",
"active": true,
"height": 363725
},
"bip65": {
"type": "buried",
"active": true,
"height": 388381
},
"csv": {
"type": "buried",
"active": true,
"height": 419328
},
"segwit": {
"type": "buried",
"active": true,
"height": 481824
},
"taproot": {
"type": "bip9",
"bip9": {
"status": "defined",
"start_time": 1619222400,
"timeout": 1628640000,
"since": 0,
"min_activation_height": 709632
},
"active": false
}
},
"warnings": ""
}
开始同步时间是2022/1/27 15:23
。
服务器配置:
intel 4210 * 1, 20核
内存:32G×2
硬盘:8TB SAS 3.5 × 3
H330
电源:750 * 2
带宽:公司网络,平时下载峰值是127Kb。