2

Given this example block (it's the genesis block by the way):

0100000000000000000000000000000000000000000000000000000000000000000000003ba3edfd7a7b12b27ac72c3e67768f617fc81bc3888a51323a9fb8aa4b1e5e4a29ab5f49ffff001d1dac2b7c0101000000010000000000000000000000000000000000000000000000000000000000000000ffffffff4d04ffff001d0104455468652054696d65732030332f4a616e2f32303039204368616e63656c6c6f72206f6e206272696e6b206f66207365636f6e64206261696c6f757420666f722062616e6b73ffffffff0100f2052a01000000434104678afdb0fe5548271967f1a67130b7105cd6a828e03909a67962e0ea1f61deb649f6bc3f4cef38c4f35504e51ec112de5c384df7ba0b8d578a4c702b6bf11d5fac00000000

I split it up as described here:

01000000                                                          // Version
0000000000000000000000000000000000000000000000000000000000000000  // Hash Previous Block
3ba3edfd7a7b12b27ac72c3e67768f617fc81bc3888a51323a9fb8aa4b1e5e4a  // Merkle Root
29ab5f49                                                          // Time
ffff001d                                                          // Difficulty
1dac2b7c                                                          // Nonce
01                                                                // Number of Transactions
 Tx1:
 01000000010000000000000000000000000000000000000000000000000000000000000000ffffffff4d04ffff001d0104455468652054696d65732030332f4a616e2f32303039204368616e63656c6c6f72206f6e206272696e6b206f66207365636f6e64206261696c6f757420666f722062616e6b73ffffffff0100f2052a01000000434104678afdb0fe5548271967f1a67130b7105cd6a828e03909a67962e0ea1f61deb649f6bc3f4cef38c4f35504e51ec112de5c384df7ba0b8d578a4c702b6bf11d5fac00000000

But how is the transaction Tx1 (in this case) readable? Obviously, it's not a default english clear text. How can I decode it so that I recognize that Satoshi Nakamoto sent 50 BTC as a coin base transaction in this transaction Tx1 for example?

4

The transaction, like the block, is in a serialized format. A description of the format is available on bitcoin.org

2

I have got this resource for you may be this could be useful: https://bitfalls.com/2017/10/03/read-bitcoin-blockchain-data-blockexplorer/

  • Whilst this may theoretically answer the question, it would be preferable to include the essential parts of the answer here, and provide the link for reference. This is to avoid the link going down and the answer becoming useless :) – MeshCollider Dec 26 '17 at 11:59
1

I decomposed the tx to make it more visible, the raw tx is this:

01000000010000000000000000000000000000000000000000000000000000000000000000FFFFFFFF4D04FFFF001D0104455468652054696D65732030332F4A616E2F32303039204368616E63656C6C6F72206F6E206272696E6B206F66207365636F6E64206261696C6F757420666F722062616E6B73FFFFFFFF0100F2052A01000000434104678AFDB0FE5548271967F1A67130B7105CD6A828E03909A67962E0EA1F61DEB649F6BC3F4CEF38C4F35504E51EC112DE5C384DF7BA0B8D578A4C702B6BF11D5FAC00000000

VERSION
 01000000

TX_IN COUNT [var_int]: hex=01, decimal=1
 TX_IN[0]
  TX_IN[0] OutPoint hash (char[32])
  0000000000000000000000000000000000000000000000000000000000000000
  TX_IN[0] OutPoint index (uint32_t)
  hex=FFFFFFFF, reversed=FFFFFFFF, decimal=4294967295
  TX_IN[0] Script Length (var_int)
  hex=4D, decimal=77
  TX_IN[0] Coinbase and Sequence
  04FFFF001D0104455468652054696D...
  TX_IN[0] Sequence (uint32_t)
  FFFFFFFF

TX_OUT COUNT, hex=01, decimal=1
 TX_OUT[0]
  TX_OUT[0] Value (uint64_t)
  hex=00F2052A01000000, reversed_hex=000000012A05F200, dec=5000000000, bitcoin=50.00000000
  TX_OUT[0] PK_Script Length (var_int)
  hex=43, dec=67
  TX_OUT[0] pk_script (uchar[])
  4104678AFDB0FE5548271967F1A67130B7105CD6A828E03909A67962E0EA1F61DEB649F6BC3F4CEF38C4F35504E51EC112DE5C384DF7BA0B8D578A4C702B6BF11D5FAC

 LOCK_TIME
00000000

The field for the previous tx (OutPoint Hash) is set to all zeros, and the next field to "FFFFFFFF" (where you normally have a value to the previous tx outpoint). So nothing to spent "from". In tx_out the payment goes to a public key, which translates to: 1A1zP1eP5QGefi2DMPTfTL5SLmv7DivfNa

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.