shuijian-xu / bitcoin

0 stars 0 forks source link

Merkle Block? #261

Open shuijian-xu opened 4 years ago

shuijian-xu commented 4 years ago
  1. version
  2. previous block hash
  3. merkle root
  4. timestamp
  5. bits
  6. nonce
  7. number of total transactions
  8. number of hashes
  9. hashes
  10. flag bits

The number of total transactions allow a light client to construct an empty merkle tree. The hashes fields holds the transactions that we are interested and the transactions that are necessary to calculate the merkle root. The flags field gives information about where the hashes go within the merkle tree.

shuijian-xu commented 4 years ago

About the flag bits field,

  1. If the node's value is given in the hashes field, the flag bit is 0
  2. If the node is an internal node and the value is to be calculated by the light client, the flag bit is 1
  3. If the node is a leaf node and is a transaction of interest, the flag is 2 and the node's value is also given in the hashes field.