Bitcoin Tutorials - Herong's Tutorial Examples - v1.06, by Herong Yang
Data Properties of Bitcoin Block
This section describes data Properties of Bitcoin block.
At a low level, a Bitcoin block has the following data properties expressed in JSON format:
"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 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) "previousblockhash" : "hash", (string) The hash of the previous block "nextblockhash" : "hash" (string) The hash of the next block
Let's take a look at the block # 500 from Bitcoin Test Network:
C:\>\local\bitcoin-0.15.1\bin\bitcoin-cli -testnet getblockhash 500 00000000a2424460c992803ed44cfe0c0333e91af04fde9a6a97b468bf1b5f70 C:\>\local\bitcoin-0.15.1\bin\bitcoin-cli -testnet getblock 00000000a2424460c992803ed44cfe0c0333e91af04fde9a6a97b468bf1b5f70 { "hash": "00000000a2424460c992803ed44cfe0c0333e91af04fde9a6a97b468bf1b5f70", "confirmations": 748456, "strippedsize": 1868, "size": 1868, "weight": 7472, "height": 500, "version": 1, "versionHex": "00000001", "merkleroot": "dd3f288510dd3b632940bd3fb1db162d3ff99b19ddb0c586cfa3ac9a76d42517", "tx": [ "a647d0c4112b4727f3c856782ff6bbaf099be929b27214a8e0dfedee4383eb68", "24b8a4c788b8c805b810438ddd99e569e184ff20f4394ac49a6d832e69f57242", "c5ffd70c3bc4998465cef55ed6d5d831ab3a550406423eb611117ed8ee41c278", "4692772a73ea834c836915089acf97f2c790380a2b8fd32f82729da72545d8c5", "82d6d88081e3e0eb36730f7f3aedb17228142b9e00a6dbaab4b53b798d0742c1", "fc407d7a3b819daa5cf1ecc2c2a4b103c3782104d1425d170993bd534779a0da", "95ad3ffb2a9426d6f5f5b97a134d90153ae16c9375f74eb385f481cff2771d77" ], "time": 1296746771, "mediantime": 1296746565, "nonce": 2325411586, "bits": "1d00ffff", "difficulty": 1, "chainwork": "000000000000000000000000000000000000000000000000000001f501f501f5", "previousblockhash": "000000008cd4b1bdaa1278e3f1708258f862da16858324e939dc650627cd2e27", "nextblockhash": "00000000c7f50b6dfac8b8a59e11b7e62f07fdef20597089b9c5d64ebfe6d682" }
As you can see, this block stores 7 transactions.
Table of Contents
Data Components of Bitcoin Block
►Data Properties of Bitcoin Block
Calculate Double-SHA256 Hash with Python
Verify Merkle Root of 2 Transactions
Verify Merkle Root of 7 Transactions
Data Structure of Bitcoin Block
"getblock blockhash 0" - Serialized Hex Block Data
Block Hash Calculation Algorithm
Block Hash Calculation in Python
Calculate Double-SHA256 Hash with Java