Contents of a Transaction

Let’s take a deeper look into the contents of my transaction to Rustie.

As we can see, a transaction has three main “sections.” The metadata section contains some housekeeping data, a unique ID of this transaction, locktime, and size.

The inputs section contains a list of previously created UTXOs as well as a proof that I am eligible of redeeming the money.

This proof allows me to redeem the UTXOs and use them to produce new outputs.

The outputs section contains a list of new UTXOs that will be sent to new addresses.

Each of these values is accompanied with a script that locks the value away from everyone except the intended redeemer who can provide a valid proof.

Taking a deeper look into the transaction, we start with the metadata.

The first piece of metadata is the hash of our transaction, or the unique “ID” of this transaction.

We also get information here in the field vin_sz, which stands for vector input size, or the number of input UTXOs being referenced in this transaction, as well as vout_sz, which stands for vector output size, or the number of new UTXOs being created.

In this case, I created this transaction with 2 UTXOs and send them as one new UTXO to Rustie.

Finally, we have the version and locktime.

Version is a number specifying the version of the Bitcoin software you are using.

We will talk more about locktime later in this lecture.

Now let’s talk about inputs.

Remember that in the metadata section we have a unique ID for this entire transaction object that we’re talking about.

Well these come in handy in the inputs, with each of the hashes you see here being references to the unique IDs of previous transactions containing the relevant UTXOs that are being redeemed now.

We also get a reference to the index of the input in the previous transaction.

“0” means the first input.

“1” means the second, and so on.

The scriptSig is the most important part of these inputs because they’re the required proofs that prove that you can redeem the associated UTXO.

Last but not least, the end product of our transaction is the output(s).

You can see here in this particular transaction we have only one output with a value of about 10 bitcoin.

Satoshi is the smallest unit of bitcoin.

One bitcoin can be converted to 100 million satoshi, which means that it can be divisible to the 8th decimal place.

The accompanying output address is a script that locks the transaction and makes it redeemable only by the specific proof that I specified in this transaction.

In this case, only after Rustie provides his proof can he unlock and spend my UTXOs..

Bitcoin Script Reminders