Bitcoin-Core

getBlock rpc api的某些響應欄位的確切含義是什麼

  • September 30, 2019

我參考這個文件來使用getBlockrpc api。

<https://bitcoin.org/en/developer-reference#getblock>

{
 "hash" : "hash",     (string) the block hash (same as provided)
 "confirmations" : n,   (numeric) The number of confirmations, or -1 if the block is not on the main chain
 "size" : n,            (numeric) The block size
 "strippedsize" : n,    (numeric) The block size excluding witness data
 "weight" : n           (numeric) The block weight as defined in BIP 141
 "height" : n,          (numeric) The block height or index
 "version" : n,         (numeric) The block version
 "versionHex" : "00000000", (string) The block version formatted in hexadecimal
 "merkleroot" : "xxxx", (string) The merkle root
 "tx" : [               (array of string) The transaction ids
    "transactionid"     (string) The transaction id
    ,...
 ],
 "time" : ttt,          (numeric) The block time in seconds since epoch (Jan 1 1970 GMT)
 "mediantime" : ttt,    (numeric) The median block time in seconds since epoch (Jan 1 1970 GMT)
 "nonce" : n,           (numeric) The nonce
 "bits" : "1d00ffff", (string) The bits
 "difficulty" : x.xxx,  (numeric) The difficulty
 "chainwork" : "xxxx",  (string) Expected number of hashes required to produce the chain up to this block (in hex)
 "nTx" : n,             (numeric) The number of transactions in the block.
 "previousblockhash" : "hash",  (string) The hash of the previous block
 "nextblockhash" : "hash"       (string) The hash of the next block
}

我想知道意義sizebits

  1. 欄位是什麼size意思??塊大小為字節??
  2. 欄位是什麼bits意思??塊大小為位??

我可以使用 chainwork diff 來計算每個塊的雜湊功率嗎?

根據此文件,<https://bitcoin.org/en/developer-reference#getblock>chainwork意味著

"chainwork": "xxxx"           (string) total amount of work in active chain, in hexadecimal

例如,假設區塊 12345 的鍊為 1111,區塊 12344 的鍊為 1100。

那麼我可以認為塊 12345 的雜湊功率是 11,因為 1111 - 1100 是 11?

size指塊的大小,對於頭部 + 是 80 字節sum(tx_sizes)。正如評論中所指出的,這包括隔離見證數據,旨在匹配塊的實際磁碟大小。

bitsnBits,它編碼了塊的目標難度。您可以在此處查看編碼方案的說明。

chainwork表示將鏈生成到該塊所需的預期散列操作的總和- 這意味著您不能使用它來計算目前塊的散列功率,因為它是生成每個塊所需的所有散列的總和從創世區塊到目前區塊。

事實上,你永遠無法精確測量基於單個區塊的活躍雜湊算力。但是,有一些方法可以計算給定時間點網路上的平均/預期雜湊功率,如本問題所述。

引用自:https://bitcoin.stackexchange.com/questions/90726