A Bitcoin transaction is a multi-step process that allows the transfer of bitcoin from one user to another. To understand how Bitcoin works, grasping the concept of a Bitcoin transaction is one of the key components of the operation of the market's first and largest cryptocurrency. This blog post will go through step-by-step how Bitcoin transactions work.
Last updated: 15.10.2024 15:00Phases of a Bitcoin Transaction
A Bitcoin transaction can be divided into three phases:
Next, we will explore the functioning of a Bitcoin transaction through these three phases.
- Transacting
- Broadcasting
- Settlement
Transacting
The first phase of a Bitcoin transaction is transacting. The transacting phase involves relatively many details, and for this reason, this phase will be discussed separately from the user's perspective and the technical perspective.
User Perspective
In the transacting phase, the user initiating the transaction carries out all the actions required for the transaction to be completed. From the user's standpoint, making the transaction is usually quite easy, as the services and applications typically handle all the details that the technical perspective requires.
The user making the transaction usually has to make three choices:
Sending Address:
The user often does not need to specifically choose a sending address, as this usually happens automatically when the user logs into a service or application.
Receiving Address:
The Bitcoin address of the recipient must be entered in the existing field. A Bitcoin address is a string of about 30 characters consisting of numbers and letters. For example, the first Bitcoin address of Bitcoin's creator Satoshi Nakamoto is "1A1zP1eP5QGefi2DMPTfTL5SLmv7DivfNa". A Bitcoin address starts with one of the following depending on the address type: "1", "3", or "bc1". In some services and applications, the receiving address can also be added in the form of a scannable QR code.
Amount to Send:
The amount of bitcoin to be sent must be filled in the existing field. This amount can be practically anything between the smallest unit of bitcoin, which is 0.00000001 bitcoin (satoshi), and the balance of the sending Bitcoin address.
After these three items, the transaction is usually completed by pressing the "Send" or "Withdraw" button. After this, in many services, the user is required to confirm the transaction using two-factor authentication.
Technical Perspective
From a technical perspective, the aspects related to the transaction phase are somewhat more complex. These are elements that pertain to every Bitcoin transaction but are not visible to the user initiating the transaction in many services and applications.
The key terms related to the transacting phase from a technical perspective are:
Public Key:
The public key is a shareable key from which a Bitcoin address can be generated.
Private Key:
The private key is a secret key used to carry out Bitcoin transactions.
Unspent Transaction Output (UTXO):
Unspent Transaction Output (UTXO) is a very central part of Bitcoin, as all existing bitcoins exist in the form of UTXOs. Let’s go through what UTXO means with an example: Bitcoin address A has 1 bitcoin, and from this address, a transaction of 0.8 bitcoins is being made to address B, which has no bitcoins at all.
The aforementioned 1 bitcoin has arrived at address A in a single transaction. The term used to refer to this 1 bitcoin is UTXO. Thus, there is one 1 bitcoin UTXO in the wallet.
When making a 0.8 bitcoin transaction from address A, which has 1 bitcoin made up of one 1 bitcoin UTXO, the following happens: The UTXO used for the transaction is referred to as an input, and the result of the transaction consists of two UTXOs, which are called outputs. The first output is 0.8 bitcoins (the amount sent), which goes to the receiving address B. The second output is the UTXO used for the transaction (1 bitcoin) minus the amount sent (0.8 bitcoins), which is 0.2 bitcoins. This 0.2 bitcoin will be returned to the sending address A after the transaction is completed.
In this example, the situation is as follows:
Before the transaction:
A: 1 bitcoin UTXO
B: -
After the transaction:
A: 0.2 bitcoin UTXO
B: 0.8 bitcoin UTXO
In practice, the UTXO model can be compared to paying in cash: If a buyer pays 10 € with a 10 € note for an 8 € purchase, they receive 2 € in change. This 2 € can be seen as analogous to the UTXO discussed above.
The example presented is quite simple, and often multiple UTXOs are needed to make a transaction. However, the underlying principle remains the same regardless of the number of UTXOs used in the transaction.
Technically, during the transaction phase, the following occurs:
The details of the Bitcoin transaction, which include information about the UTXOs used and those remaining from the transaction, among other things, are digitally signed using the public key and private key of the sending Bitcoin address. From the user's perspective, the digital signature is the result of pressing the "Send" or "Withdraw" button.
Transaction Fee
The transacting phase also fundamentally includes a transaction fee, which will be handled as a separate part for clarity and simplification. A transaction fee is always paid for Bitcoin transactions, which can be viewed as compensation for miners for executing the transaction. The size of the transaction fee varies according to the utilization of the Bitcoin network; the more transactions made, the higher the transaction fee. On average, transaction fees have been in the range of tens of cents or a few euros in recent years. In many services, the transaction fee is predetermined and cannot be changed. If one wishes to influence the transaction fee, this can often be done in their own cryptocurrency wallet.
Broadcasting
In the second phase, namely the broadcasting phase, the details of the Bitcoin transaction are sent to the Bitcoin network. Servers called nodes, which store the history of the Bitcoin network, ensure that the transaction complies with the rules of the Bitcoin network. Once the nodes have verified the correctness of the transaction, the transaction moves to wait in the place called mempool (short for memory pool).
Settlement
The final phase of a Bitcoin transaction is the settlement of the transaction. At this stage, a significant aspect of Bitcoin's operation, namely Bitcoin mining, comes into play. The core of mining consists of efficient computers specifically designed for Bitcoin mining, referred to as miners. Miners compete with computing power to see who can be the first to solve the problem and add the next block to the Bitcoin blockchain. This competition based on computing power is a result of the Proof of Work consensus algorithm used by Bitcoin.
Adding a block to the Bitcoin blockchain is also a key aspect from the perspective of the Bitcoin transaction. From the mempool mentioned in the broadcasting phase, the Bitcoin transaction moves next to the Bitcoin block and becomes part of the Bitcoin blockchain. The winning miner adds the transactions waiting in the mempool to the block and subsequently adds this block as the latest block in the Bitcoin blockchain.
A Bitcoin transaction does not always fit into the next block to be added, as only a limited amount of data can fit in a block. The number of transactions that can fit in a block depends on several different factors, but on average, the Bitcoin block size, or the amount of data in a single block, is less than 2 megabytes. Miners prioritize transactions to be included in the block based on the size of the transaction fee; the larger the transaction fee, the more likely the transaction will fit into the next block.
Once the block containing the Bitcoin transaction is added to the Bitcoin blockchain, the transaction can be considered executed. In practice, a transaction is deemed finalized once it has received 3–6 confirmations. A transaction has one confirmation when the block containing the transaction is added to the blockchain, and it receives one additional confirmation every time a new block is added after it. A new block is added to the Bitcoin blockchain on average every 10 minutes, meaning the transaction is finalized in approximately 30–60 minutes. Comprehensive real-time data on Bitcoin blocks, transactions, and mining can be found, for example, on the Mempool.space website.
Summary
A Bitcoin transaction consists of three phases: transacting, broadcasting, and settlement. In the transacting phase, the essential details for the execution of the transaction are determined, after which the transaction is sent with a digital signature. In the broadcasting phase, the transaction details are sent to the Bitcoin network, where nodes verify the transaction's correctness. In the settlement phase, miners add the transaction to a block and the blockchain. Ultimately, a transaction is considered finalized once it has received 3–6 confirmations, which usually takes about 30–60 minutes.
Ville Viitaharju Cryptocurrency specialist