6. Transactions

In this chapter we’ll deconstruct a Bitcoin transaction and examine each of its parts to see how they facilitate the transfer of value in a way that’s highly expressive and amazingly reliable.

A. A Serialized Bitcoin Transaction

The example provided showcases a serialized Bitcoin transaction in hexadecimal format, retrieved using Bitcoin Core's getrawtransaction command. This command fetches the raw transaction data from the Bitcoin blockchain, enabling users to analyze the transaction in its serialized form

Example Transaction:

Alice's payment to Bob is retrieved with the following command:

$ bitcoin-cli getrawtransaction 466200308696215bbc949d5141a49a41\\
38ecdfdfaa2a8029c1f9bcecd1f96177

Serialized Transaction Breakdown:

The resulting output is a long hexadecimal string representing the entire transaction:

01000000000101eb3ae38f27191aa5f3850dc9cad00492b88b72404f9da13569
8679268041c54a0100000000ffffffff02204e0000000000002251203b41daba
4c9ace578369740f15e5ec880c28279ee7f51b07dca69c7061e07068f8240100
000000001600147752c165ea7be772b2c0acb7f4d6047ae6f4768e0141cf5efe
2d8ef13ed0af21d4f4cb82422d6252d70324f6f4576b727b7d918e521c00b51b
e739df2f899c49dc267c0ad280aca6dab0d2fa2b42a45182fc83e81713010000
0000

1. Transaction Version (4 bytes): 01000000 2. Marker and Flag (2 bytes): 0001

3. Number of Inputs (1 byte): 01 4. Input Details: eb3ae38f27191aa5f3850dc9cad00492b88b72404f9da135698679268041c54a0100000000ffffffff

  1. Number of Outputs (1 byte): 02

6. Output Details

First Output: 204e0000000000002251203b41daba4c9ace578369740f15e5ec880c28279ee7f51b07dca69c7061e07068f824

Second Output: f8240100000000001600147752c165ea7be772b2c0acb7f4d6047ae6f4768e

  1. Witness Data: