千家信息网

btc中如何使用bitcoind搭建节点

发表于:2024-10-19 作者:千家信息网编辑
千家信息网最后更新 2024年10月19日,今天就跟大家聊聊有关btc中如何使用bitcoind搭建节点,可能很多人都不太了解,为了让大家更加了解,小编给大家总结了以下内容,希望大家根据这篇文章可以有所收获。docker-compose.yam
千家信息网最后更新 2024年10月19日btc中如何使用bitcoind搭建节点

今天就跟大家聊聊有关btc中如何使用bitcoind搭建节点,可能很多人都不太了解,为了让大家更加了解,小编给大家总结了以下内容,希望大家根据这篇文章可以有所收获。

docker-compose.yaml

# ./volume/data/bitcoin.conf settings accountversion: "3"services:  btc-service:    image: ruimarinho/bitcoin-core:0.18-alpine    volumes:      - "./volume/data/:/home/bitcoin/.bitcoin"    ports:      - "8332:8332"    restart: always    logging:      driver: "json-file"      options:        max-size: "50m"

注意:

容器内使用的用户是bitcoin,但是exec进入使用的root用户。在root中执行bitcoin-cli命令需要把配置文件复制到/root/.bitcoin中cp /home/bitcoin/.bitcoin/bitcoin.conf /root/.bitcoin/

bitcoin.conf

# daemon=1dbcache=10240txindex=1server=1rest=1rpcbind=0.0.0.0:8332rpcallowip=0.0.0.0/0deprecatedrpc=accountsrpcuser=username001rpcpassword=123456789
/home/bitcoin # bitcoin-cli getblockchaininfo{  "chain": "main",  "blocks": 442140,  "headers": 598229,  "bestblockhash": "000000000000000001a168f6bbcc9b1d3b50eb9e6861a4f6f6a16a7197056ba3",  "difficulty": 286765766820.5504,  "mediantime": 1481002553,  "verificationprogress": 0.3860586550594515,  "initialblockdownload": true,  "chainwork": "00000000000000000000000000000000000000000031cbb33129fe710693dc9c",  "size_on_disk": 106776418501,  "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": "active",      "startTime": 1462060800,      "timeout": 1493596800,      "since": 419328    },    "segwit": {      "status": "started",      "bit": 1,      "startTime": 1479168000,      "timeout": 1510704000,      "since": 439488,      "statistics": {        "period": 2016,        "threshold": 1916,        "elapsed": 637,        "count": 156,        "possible": false      }    }  },  "warnings": ""}

initialblockdownload: 这个字段为true,说明正在同步区块

verificationprogress:同步进度[0..1]

远程访问

curl -s -X POST --user username001:123456789 -H 'content-type: text/plain;' http://127.0.0.1:8332/ --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "getmininginfo", "params": [] }'

看完上述内容,你们对btc中如何使用bitcoind搭建节点有进一步的了解吗?如果还想了解更多知识或者相关内容,请关注行业资讯频道,感谢大家的支持。

0