To distill the operation of Bitcoin to its essence, we could say that it records transactions of value between various addresses, logging these transaction details in the blockchain. Thus, the transaction is the most crucial piece of information contained within the blockchain.

What is a Bitcoin Transaction?

A Bitcoin transaction, in its most basic form, signifies the transfer of funds (expressed in bitcoin) from one Bitcoin address, A (the sender), to another, B (the recipient). Every transaction is permanently recorded in the blockchain, ensuring the immutability and transparency of every exchange.

To better understand how a transaction works, we can liken it to the mechanism of bank checks.

Imagine a world without banknotes or coins, where everyone pays each other through the issuance of checks.

In this scenario, to make a payment with checks, it would be necessary to "exchange and transform" these checks. The sender would need to take one or more checks in their name to the bank, endorse them in favor of the bank, and obtain the issuance of a new check made out to the recipient. If the amount of the checks exceeds the payment due, the sender would also receive a "change" check from the bank. The original checks brought by the sender would then be canceled, and only the newly issued checks would be spendable.This process, while cumbersome and unmanageable in real life, becomes much more manageable and quicker in the context of electronic currency.

Bitcoin transactions work exactly like this.

When a person owns bitcoin, they actually hold UTXO (Unspent Transaction Outputs), which are previously received transactions not yet spent. To spend a portion of these bitcoins, a new transaction must be created.

This new transaction consists of two parts:

  • An INPUT part that collects one or more UTXOs, each with the digital signature of the legitimate owner that "unlocks" them.
  • An OUTPUT part, where new UTXOs are generated that cancel and replace the previous ones and are directed to the new owners, identified by their Bitcoin addresses.

It can happen that, in a transaction, the amount of bitcoin we wish to transfer is less than the total value we possess. It's as if Bob had only one high-value bank check, say for 50 BTC, but needed to pay Alice only 0.5 BTC.

In this case, Bob cannot simply tear off a piece of the check for the amount he wishes to transfer; he must use the entire "digital check," i.e., the complete UTXO. After sending 0.5 BTC to Alice, the "change," i.e., the remaining 49.5 BTC, must be directed somewhere. In the Bitcoin world, this "somewhere" is what we call a "change address" or "rest address."

Thus, in the transaction, the output will include two parts: one that transfers the value to Alice and another that redirects the "change" to a new Bitcoin address controlled by Bob. This mechanism ensures that Bob retains control over his unspent bitcoins after the transaction.

How is a Bitcoin Transaction Verified?

For a transaction to be accepted by the network and effect the transfer of value, it must be formally valid and pass various checks.There are over 40 rules that each transaction must comply with to be considered valid! Some of these checks include:

  • Every UTXO in input must be digitally signed by the owner.
  • The signature must match the owner's address.
  • The entire transaction, in turn, must be signed by the sender.
  • The sum of the value of the new UTXOs cannot be greater than the sum of the value of the transactions in input (we cannot create value from nothing).
Attention: As per the protocol rules, there is no designated authority for these validity checks. Each network participant performs these checks in their interest.

Much like each of us checks not to have received a counterfeit check. The transaction is then verified by all nodes that see it pass.

How is a Transaction Confirmed?

Therefore, it is not enough for the transaction to be formally valid for it to take effect; it must be accepted by the network as actual. This happens when it is "mined" (processed by a miner) and included in a block.

The transaction has its lifecycle, which we could summarize as follows:

  • The transaction is created and signed by a user with their bitcoin wallet.
  • The transaction is sent to the network - the first node that receives it checks the transaction.
  • If the first node deems the transaction invalid (it does not comply with the protocol), it ignores it.
  • If it considers it valid, it propagates it to other nodes so that the entire network knows it.
  • The valid transaction is then placed in the mempool, the waiting room for transactions awaiting selection by a miner.
  • The transaction is selected by a miner (or more than one) to be included in a block.
  • Sooner or later, a miner will close a block containing that transaction.
  • The transaction is removed from the mempool.
  • The transaction is inserted into the most recent block of the blockchain and is thus said to have one confirmation.
  • Each subsequent block will add a further confirmation to the transaction.
  • When it reaches the number of 6 confirmations, it is universally considered finalized.
Share on