A Bitcoin transaction is an authorised transfer of bitcoin from one address to another. These transactions have two main elements:
Inputs: Amount of Bitcoin that are going to be transferred.
Outputs: Amounts of bitcoins sent to different addresses. We can identify different types of outputs, such as: transaction fee (payment to the miner for adding the transaction to the blockchain), change (similar to cash, if the value of your input is higher than the amount you want to pay, you will receive the change) and the actual payment.
Inputs:
12 BTC
Outputs
10 BTC as payment to Bob
1.98 as change
0.02 as Fee
All transactions inputs are outputs in a previous transaction of the blockchain, the outputs that has not been used as inputs yet are named UTxO.
Transaction chain example
We can obtain all UTxOs given a address making a HTTP GET call to a bitcoin node, for example:
To create a transaction, you typically need to choose your inputs and design your outputs. Fortunately, most modern wallets can handle this process automatically. However, it's still relatively straightforward if you want to do it manually. You have two options: either select one large UTxO that covers the total amount and receive change, or use multiple smaller UTxOs that add up to the correct value.
Transfer funds
The simplest transaction consists of one input and two outputs, but this is not the most common scenario as you usually don't have an UTxO with the exact amount of a payment.
Be careful, this transactions are often recognised as transferring coins between different addresses of the same user, making them highly traceable.
Transaction with one input adn two outputs
The most common transaction would be a transaction with one input and three outputs (fee, payment and change). This transaction usually represent a payment between two users.
Transaction with one input and three outputs
Consolidation
This transaction is done by the same person, it is done to aggregate different UTxOs into one so future transactions fees will be lower.
Consolidation transaction
Fees
Fees are the payment made by users to miners for verifying and adding transactions to the blockchain. The fees for a transaction are calculated based on its size, meaning smaller transactions tend to be cheaper - resulting in lower costs for fewer inputs and outputs.
Miners prioritise which transactions to add to the next block by fee, with the highest-fee transactions being added first. This creates a market dynamic where users compete to have the
highest fee without being too excessive. Fees are typically categorised based on their cost, with different priorities established, this can be check in the our node mempool or in a web block explorer.
Transactions fees section in mempool.space
Propagate
After creating a transaction correctly within your wallet, you need to send it to a node that connects to various peers. When a node receives a new transaction, it broadcasts it to all its peers, and those peers continue propagating the transaction until it reaches all nodes in the network.
Confirmations
The term "confirmation" refers to how many blocks are added after a transaction is recorded. As more blocks are added, the transaction becomes increasingly secure, making it more costly for an attacker to attempt to rollback. When a transaction is added to the blockchain, it initially has only
one confirmation (the current block). After 60 minutes, the transaction will have acquired six confirmations, as there will be six blocks added after it. Typically, having only one confirmation is sufficient, and even with small amounts, you can rely on seeing the transaction in the mempool.