溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點(diǎn)擊 登錄注冊 即表示同意《億速云用戶服務(wù)條款》

btc中如何使用bitcoind搭建節(jié)點(diǎn)

發(fā)布時(shí)間:2021-07-30 17:35:13 來源:億速云 閱讀:310 作者:Leah 欄目:互聯(lián)網(wǎng)科技

今天就跟大家聊聊有關(guān)btc中如何使用bitcoind搭建節(jié)點(diǎn),可能很多人都不太了解,為了讓大家更加了解,小編給大家總結(jié)了以下內(nèi)容,希望大家根據(jù)這篇文章可以有所收獲。

docker-compose.yaml

# ./volume/data/bitcoin.conf settings account
version: "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"

注意:

容器內(nèi)使用的用戶是bitcoin,但是exec進(jìn)入使用的root用戶。在root中執(zhí)行bitcoin-cli命令需要把配置文件復(fù)制到/root/.bitcoin中cp /home/bitcoin/.bitcoin/bitcoin.conf /root/.bitcoin/

bitcoin.conf

# daemon=1
dbcache=10240
txindex=1
server=1
rest=1
rpcbind=0.0.0.0:8332
rpcallowip=0.0.0.0/0
deprecatedrpc=accounts
rpcuser=username001
rpcpassword=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: 這個(gè)字段為true,說明正在同步區(qū)塊

verificationprogress:同步進(jìn)度[0..1]

遠(yuǎn)程訪問

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": [] }'

看完上述內(nèi)容,你們對btc中如何使用bitcoind搭建節(jié)點(diǎn)有進(jìn)一步的了解嗎?如果還想了解更多知識(shí)或者相關(guān)內(nèi)容,請關(guān)注億速云行業(yè)資訊頻道,感謝大家的支持。

向AI問一下細(xì)節(jié)

免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場,如果涉及侵權(quán)請聯(lián)系站長郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。

AI