MultiversX Tracker is Live!

How Is it possible that bitcoin blocks store transaction data in 32-bit SHA256 strings. How would nodes know the transaction?

Bitcoin Stack Exchange

Bitcoin News / Bitcoin Stack Exchange 142 Views

How is it possible that bitcoin blocks store transaction data in 32-bit SHA256 strings

They don't. Bitcoin blocks store the full transaction data in binary. There is no SHA256 involved in its storage. SHA256 also produces 256 bits of output (= 32 bytes), not 32 bits.

a traditional bitcoin block has performed 2 SHA256 iterations on the raw hex data of a single transaction.

There are multiple mistakes here.

A block hash is computed by double-SHA256'ing the block header, in binary (not hex). That block header contains a number of fields, including a version number, the hash of the previous blocks, a timestamp, a nonce, the difficulty, and a hash of the transactions in it.

That hash of the transaction data, also called the Merkle root, is computed as follows:

  • Start with a list of the transaction hashes of all the transactions in the block, in order. Each hash is the binary result of applying double-SHA256 on the raw binary transaction data (not hex).
  • As long as this list contains more than one element:
    • If the list has an odd number of elements, duplicate the last element.
    • Replace the list with the list of obtained by double-SHA256 hashing the concatenation of two consecutive elements. This halves the length of the list.
  • The Merkle root is the single remaining element in the list (if the block had only one transaction, the Merkle root is equal to the hash of the transaction directly).

Then it is stored in the block.

No, the block just stores the full transaction data, unhashed. The hashes are only used to compute the block header, which indirectly contributes to the block's hash.


Get BONUS $200 for FREE!

You can get bonuses upto $100 FREE BONUS when you:
πŸ’° Install these recommended apps:
πŸ’² SocialGood - 100% Crypto Back on Everyday Shopping
πŸ’² xPortal - The DeFi For The Next Billion
πŸ’² CryptoTab Browser - Lightweight, fast, and ready to mine!
πŸ’° Register on these recommended exchanges:
🟑 Binance🟑 Bitfinex🟑 Bitmart🟑 Bittrex🟑 Bitget
🟑 CoinEx🟑 Crypto.com🟑 Gate.io🟑 Huobi🟑 Kucoin.



Comments