How do Bitcoin transactions work?

07/29/2021, 01:58 PM

How do Bitcoin transactions work?
How do Bitcoin transactions work?

Mining, miners, blocks, blockchain. Below we are explaining these terms and their significance in performing Bitcoin transactions.

Mining, miners, blocks, blockchain. Below we are explaining these terms and their significance in performing Bitcoin transactions.

The users often ask us why they have to wait for Bitcoin transaction to be processed, and why can't we do something to speed up the process. In this article we will explain how Bitcoin transactions work, who processes them and how the whole process works.

How to avoid waiting for confirmation?

If you’re not interested in the details on how the whole process works, the only thing you have to know is that miners compose transactions into blocks which have a limited capacity in relation to the demand.

In order for your transactions to be confirmed as soon as possible, it is necessary to pay the miners a transaction fee which is pretty much high.

Most wallets which we recommend automatically calculate the necessary fee, depending on the fact how long are you ready to wait for confirmation.

Still, high fee does not guarantee that your transaction will be confirmed quickly, so to the users who are in a hurry or don’t want to wait we recommend using ETH, NANO or some of the other cryptocurrencies.

Bitcoin and his clones are simply not designed to be fast. The speed lost primacy due to other important characteristics, such as security and decentralisation. When speed is of extreme importance, Bitcoin is not the real choice.

Below we will explain how does Bitcoin transactions processing function, from the beginning to the end.

The blockchain

Bitcoin is the first cryptocurrency which successfully implemented blockchain technology and initiated the revolution which enables transfer of values without an intermediary. As the name suggests, blockchain is comprised of several blocks connected in an uninterrupted chain.

Each block contains a certain number of transactions considering its limited size. Bitcoin blocks have a limit of approx. 1 MB. This changed to. approx. 2 MB after Segwit upgrade. Considering the still relatively weak acceptance of Segwit upgrade, the size of most Bitcoin blocks is approx. 1.2 MB.

Now when we know the size of the blocks, we should be able to calculate how many transactions can fit into one block, compare it to the number of unconfirmed transactions and find out the current network status. Still, things are not so simple, because Bitcoin transactions don’t have a fixed size.

There are also several different types of Bitcoin transactions. In order to understand the way in which the size of a certain transaction is formed, we first have to understand how do Bitcoin wallets and Bitcoin ledger work.

UTXO format

The graphic explainer shows how Bitcoin transactions work.

Unspent transaction output (UTXO) is a model of recording of account balance, invented by Satoshi Nakamoto, who implemented it into Bitcoin.

It is interesting that this model is not mentioned in Bitcoin whitepaper (PDF). This way of organizing transactions significantly differs from the standards to which we are used to when using traditional banking accounts, also used by Ethereum (ETH).

Standard accounts have an account balance, which changes after each transaction and is not divided into smaller amounts.

It can be seen as one large banknote of a changeable amount. On the other hand, the easiest way to imagine UTXO model is as a wallet which has different banknotes. Each UTXO is equal to one banknote.

Let’s consider, for example, that we want to buy a phone which costs €800, and we have three banknotes of €300 in our wallet. We will give all three banknotes to the seller, and he will return the change, which is a €100 banknote.

BTC transactions function the same way. Your BTC wallet displays summary value, i.e. the amount of BTCs owned by you, but in reality, that amount is divided into several different UTXOs (banknotes), depending on the dynamics of your transactions.

In other words, wallets display an aggregated value of all UTXOs owned by you. Depending the schedule and amount of certain UTXOs, it will be necessary to use one or several UTXOs in order to successfully make a transaction.

Now when we know how Bitcoin wallets function, we can calculate the size of certain Bitcoin transactions, as can we calculate the average.

So, the size of a Bitcoin transaction does not depend on the amount of Bitcoins you send, but on the number of UTXOs which have to be processed in order to send a certain amount of BTCs.

Each UTOX you have in your wallet increases the size of the transaction, and with size also the price of transaction grows.

Statistics show that an average Bitcoin transaction weighs approx. 450 bytes and, having in mind the variable size of Bitcoin blocks, each can hold an average of approx. 1,800 transactions. The next question is how much do we have to pay in order to have our transaction inserted into the first next block and is it worth to us, considering the size of the transaction.

Bitcoin nodes

The image of the world heatmap shows active Bitcoin nodes around the globe.

Bitcoin nodes are computers which drive Bitcoin software, form a network consensus, and participate in transaction processing. The current number and distribution of nodes can be seen on the image above (source).

When your Bitcoin wallet, i.e. Bitcoin node to which your wallet is connected transmits the transaction to other nodes on the network, the transaction ends up in the mempool- a pool which contains unverified transactions waiting to be incorporated into a block in order to become a part of an uninterrupted transaction chain - blockchain.

In a mempool there is most often approx. 10,000 transactions. Transactions are processed according to the fee.

Transactions with adequate fee have an advantage. Bitcoin wallets of greater quality automatically analyse the mempool and suggest the optimal fee which is to be paid to the miners in order to have your transaction verified as soon as possible.

Still, if you’re in a hurry and you’re not sure will the transaction be incorporated into the first next block, we recommend using a calculator which determines the necessary fee. We had good experiences with this calculator.

Depending on the fact how crowded Bitcoin network is, transaction fees can be pretty noticeable, so depending on the size and amount of the transaction it is not worth to pay a fee for urgency, needed to enter the first next block.

It is more reasonable to pay a somewhat smaller fee and wait a few hours for the first confirmation. Still, when you’re buying something or using our exchange office, the only reasonable option is to pay an urgency fee in order to avoid long waiting for payment.

New blocks are formed in an average of 10 minutes. Still, that is only the average time which has significant deviations in practice. It often happens that several blocks are formed one after another, and we have to wait for the next block even up to an hour.

Therefore, it is clear to you that even a high enough transaction fee doesn’t guarantee a fast confirmation in certain cases. Still, these are extremes on which it is good to calculate, but with a sufficient fee most transactions receive confirmation within 20 minutes.

Until the transaction isn’t confirmed, it is subject to manipulations, and the receiver doesn’t have access to coins.

In order to be sure that the transaction won’t be cancelled, it is necessary to wait for the number of confirmations proportional to the value of the transaction.

For lower amounts one will suffice, while for larger amounts it is recommended to wait for 3 or more confirmations. Remember that unconfirmed transactions are not final and are relatively easily cancelled.

Bitcoin miners

Bitcoin miners are specialised devices designed to create new Bitcoin blocks. Miners scan the mempool searching transactions with the highest fee which will be incorporated into the next block.

Many believe that miners resolve complex mathematical issues, but actually it is not an intelligent, but hard work.

Miners randomly guess large series of numbers, until they don’t guess the correct solution to the next block. The first miner who finds the solution gets an award which currently amounts to 12.5 BTCs plus all transaction fees paid by the users in order to have their transaction incorporated into the blockchain.

Bitcoin mining pools

The pie chart shows the percentage of Bitcoin mem pools distribution.

Considering the exponential growth in the number of miners, individual mining devices or even farms of devices are not strong enough to find a solution which unlocks the next Bitcoin block.

Therefore, several miners join and mine together. A group of miners is called a mining pool.

When a mining pool finds a Bitcoin block, the reward is divided proportionally to the number of miners who participated in finding blocks.

This is also one of the largest flaws of Bitcoin - several of the largest pools control the most of the mining power, which in theory makes Bitcoin mining relatively centralised and subject to manipulations.

However, in practice things function flawlessly, and there have not been noticeable incidents, because it is in everyone's interest  to respect the rules of the network.

For the very end take a look at the graphical display of Bitcoin transaction cycle, shown on the image below.

The infographic explainer of the Bitcoin transaction cycle.