Skip to content

1.下载

https://bitcoin.org/en/download

下载包是二进制,直接启动

2.启动

[root@ip-172-31-2-5 bitcoin-0.21.0]# cat etc/bitcoin.conf 
rpcuser=xxx
rpcpassword=xxxxx
rpcport=28832
port=28833
bindip=0.0.0.0
rpcbind=0.0.0.0
rpcallowip=0.0.0.0/0
datadir=/data/coin/usdt/
daemon=1
server=1
#reindex=1
##reindex-chainstate=1
txindex=1
[root@ip-172-31-2-5 bitcoin-0.21.0]# cat etc/bitcoin.conf 
rpcuser=xxx
rpcpassword=xxxxx
rpcport=28832
port=28833
bindip=0.0.0.0
rpcbind=0.0.0.0
rpcallowip=0.0.0.0/0
datadir=/data/coin/usdt/
daemon=1
server=1
#reindex=1
##reindex-chainstate=1
txindex=1
nohup /data/apps/bitcoin-0.21.0/bin/bitcoind -conf=/data/apps/bitcoin-0.21.0/etc/bitcoin.conf &
nohup /data/apps/bitcoin-0.21.0/bin/bitcoind -conf=/data/apps/bitcoin-0.21.0/etc/bitcoin.conf &

3.查看高度

#进入到/data/coin/btc/目录下查看debug.log
[root@btc btc]# tail debug.log 
2021-04-13T10:05:42Z UpdateTip: new best=000000000000000020ffabffb615b2fdbdc3dc54c6327c07886ca69f90368ae5 height=312390 version=0x00000002 log2_work=79.883474 tx=43201641 date='2014-07-25T07:41:39Z' progress=0.068324 cache=363.6MiB(2490823txo)
#进入到/data/coin/btc/目录下查看debug.log
[root@btc btc]# tail debug.log 
2021-04-13T10:05:42Z UpdateTip: new best=000000000000000020ffabffb615b2fdbdc3dc54c6327c07886ca69f90368ae5 height=312390 version=0x00000002 log2_work=79.883474 tx=43201641 date='2014-07-25T07:41:39Z' progress=0.068324 cache=363.6MiB(2490823txo)

2.bitcoincore安装

官方下载地址:https://bitcoincore.org/en/download/

wget https://bitcoincore.org/bin/bitcoin-core-0.20.1/bitcoin-0.20.1-x86_64-linux-gnu.tar.gz
wget https://bitcoincore.org/bin/bitcoin-core-0.20.1/bitcoin-0.20.1-x86_64-linux-gnu.tar.gz

2.1查用命令

# 查看网络状态:
bitcoin-cli getnetworkinfo
# 查看网络节点:
bitcoin-cli getpeerinfo
# 查看区块链信息:如同步进度、
bitcoin-cli getblockchaininfo
# 查看所有命令
bitcoin-cli help

#查看高度
./bin/bitcoin-cli -rpcuser=omn -rpcpassword=MeVz4mcTYZgvY4fT3bECaf8YkWKYxdhh -rpcconnect=127.0.0.1 -rpcport=28832 getblockcount

或者
curl --user username:password --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "getblockcount", "params": []}' -H 'content-type: text/plain;' http://127.0.0.1:8332/
# 查看网络状态:
bitcoin-cli getnetworkinfo
# 查看网络节点:
bitcoin-cli getpeerinfo
# 查看区块链信息:如同步进度、
bitcoin-cli getblockchaininfo
# 查看所有命令
bitcoin-cli help

#查看高度
./bin/bitcoin-cli -rpcuser=omn -rpcpassword=MeVz4mcTYZgvY4fT3bECaf8YkWKYxdhh -rpcconnect=127.0.0.1 -rpcport=28832 getblockcount

或者
curl --user username:password --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "getblockcount", "params": []}' -H 'content-type: text/plain;' http://127.0.0.1:8332/

2.2其他工具

https://www.blockchain.com/en/explorer