Transactions

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:
curl "https://blockchain.info/unspent?active=1Cdid9KFAaatwczBwBttQcwXYCpvK8h7FK"
Returns the following JSON:
{
  "notice": "",
  "unspent_outputs": [
    {
      "tx_hash_big_endian": "ce3454376a468f3fa7f241355724dd340fde63b9e51d7da3c3197a97691d0534",
      "tx_hash": "34051d69977a19c3a37d1de5b963de0f34dd24573541f2a73f8f466a375434ce",
      "tx_output_n": 1,
      "script": "76a9147f9b1a7fb68d60c536c2fd8aeaa53a8f3cc025a888ac",
      "value": 9978,
      "value_hex": "26fa",
      "confirmations": 214481,
      "tx_index": 1830290334084931
    },
    {
      "tx_hash_big_endian": "b45a9cb4a1061b7c48752757c44c28575051366483c54c9934036130c4752289",
      "tx_hash": "892275c430610334994cc5836436515057284cc4572775487c1b06a1b49c5ab4",
      "tx_output_n": 1,
      "script": "76a9147f9b1a7fb68d60c536c2fd8aeaa53a8f3cc025a888ac",
      "value": 6236,
      "value_hex": "185c",
      "confirmations": 303562,
      "tx_index": 4824995125922848
    },
    ...
]
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.