HomeAcademyHow Bitcoin Works

How Bitcoin Works

List

Today, probably only the least interested haven’t heard of Bitcoin. Everyone has heard of it, but few have asked how it actually works “under the bonnet”. Many people are satisfied with just enough knowledge to open a wallet, receive, send or sell cryptocurrency. It works — fine; how exactly — not important.

In fact, this knowledge matters, because it can remove many questions and prevent problems in use.

We have already looked at what Bitcoin is, but we didn’t go into the details. In this article, we will try to explain clearly and thoroughly how Bitcoin works.

Network

As many sources state, Bitcoin is a decentralised payment system in which the unit of account is the eponymous cryptocurrency, BTC.

A decentralised (peer-to-peer) network is a computer system in which all participants are equal. Every node (peer), as it is also called, fulfils the functions of both client and server. This organisation ensures the network’s resilience regardless of the number and arrangement of nodes (swapping the order of addends does not change the sum). All nodes are participants in the network, so a defining feature of the system is full decentralisation — there is no central administrator or server.

Instead of the term ‘peer-to-peer’, we can also use terms such as: decentralised, peering or P2P (peer-to-peer) network.

Blockchain

The foundation of Bitcoin — and at the same time its ledger of transactions — is an ordered sequence of data (blocks) known as the blockchain. Each block in the Bitcoin network contains up to 1 MB of data, is produced on average every 10 minutes and includes information about all transactions as well as linking data to the previous block.

Every block is cryptographically linked to the previous and the next one. This mutual linkage prevents the network from being forged or from altering already existing blocks, making the blockchain immutable and the transactions irreversible.

Operating principle

To understand better how the Bitcoin network functions, let’s imagine the hypothetical crypto-enthusiast Tony, who has a Bitcoin wallet with a balance of 2 BTC. We have already discussed what a Bitcoin wallet is in previous articles.

How Bitcoin Works — blockchain overview

Tony wants to gift 1 BTC to his friend Cindy. To do that he needs her unique Bitcoin address — analogous to a bank account number. Tony enters this address in the relevant field in his wallet and specifies the amount of 1 BTC. He then proceeds to set the transaction fee — we’ll pause on this in a little more detail.

Download Trustee Wallet

Transactions and network load

As with any other payment system, Bitcoin processes transactions — the transfer of funds from one user to another. A fee is charged for each transaction, which is paid as a reward to the miners who confirm transactions. The higher the fee and the lower the network load, the faster transactions are confirmed.

By network load we mean the total number of participants sending transactions at the same time.

Essentially, a transaction is a packet of information that shows participants in the network by how much the sender’s balance has decreased and by how much the recipient’s balance has increased.

Miners

For a transaction to be executed successfully, it must be confirmed (validated) by miners. Today these are specialised organisations that use powerful computing devices (ASIC farms) to check transactions for correctness, group them into blocks and link them sequentially.

Creating one block takes on average 10 minutes, during which miners perform intensive calculations in search of a single valid solution. This isn’t a complex mathematical problem, but it does require a huge amount of computing power that small devices cannot provide quickly and efficiently.

For their work, miners receive a reward in BTC. It consists of:

    • the fees paid by users for transactions;

    • new bitcoins generated by the network itself when a new block is created.

These new bitcoins are a reward for miners’ efforts. Every 210,000 blocks (approximately 4 years) the reward is halved — this event is called the halving.

Fees

Back to our crypto-enthusiast… When setting the transaction fee, Tony knows he has to pay a certain number of satoshis (the smallest fraction of a bitcoin) for each byte of information. Since he doesn’t know how much data his transaction will take, he decides to economise and sets a fee of 1 satoshi/byte.

For you, dear readers, let’s see how to calculate the size and cost of his transaction.

Those 2 BTC in Tony’s wallet didn’t appear out of thin air. He earned them:

    • 1 BTC in 2017

    • 1 BTC in 2018

He now wants to send half to Cindy. In his transaction, besides information about the coins being transferred, the following will be included: data about the addresses from which he received the coins (inputs); data about the recipients’ addresses (outputs); his own address.

    • Each input weighs ~148 bytes;

    • Each output weighs ~34 bytes;

    • The transaction itself weighs ~10 bytes, regardless of the number of addresses or amount.

Calculation:
148*2 + 34*2 + 10 = 374 bytes
We now know that “thrifty” Tony will pay 374 satoshis for the transaction.

Change

You might ask why we multiply 34 (output size) by 2 if there is only one recipient. It turns out that when you send part of your balance, the entire amount is drawn from it, and after confirmation (inclusion in a block) the remainder (minus the fee) is returned to your wallet.

Therefore, besides the recipient’s address, the transaction also includes the sender’s address (yours). This return is called change and can be seen in blockchain explorers.

How Bitcoin Works — change output example

Mempool (transaction memory)

Having set a low fee of 374 satoshis, Tony confirms sending 1 BTC and waits for miners to validate the transaction.

But the miners aren’t in a hurry. The transaction goes into the mempool — the confirmation queue. Why? Because miners want to earn, not merely run their hardware. For Tony’s transaction they will receive only 374 satoshis, which is too little. That’s why the mempool exists — a place where transactions are sorted by priority.

Miners first choose smaller transactions with higher fees, because they’re more profitable and more of them fit into a block.

By the way, if the sender uses SegWit, their transactions are lighter, which makes them more attractive to miners.

But don’t think that once it enters the mempool, a transaction gets a fixed number. No. The queue is dynamic and resembles an auction — new transactions with different fees and sizes arrive every second. That’s why Tony’s may wait for a long time. And most importantly — whilst it is in the mempool, Tony cannot use the change.

Effectively, his balance is ‘frozen’. This mechanism protects the network from spam transactions — when someone sends numerous cheap transfers, overloading the system.

While Tony’s transaction is in the mempool, it is neither confirmed nor “stuck”. It can remain there for a long time — until it is confirmed or dropped by nodes. According to statistics, the maximum waiting time is ~3 days, but under heavy load it can stretch to a week or more.

Transfer speed today is a key factor when choosing a payment system, and such delays are, to put it mildly, unpleasant.

Download Trustee Wallet

Replace-by-Fee (RBF) — Fee replacement

There are different ways to “push” a transaction in the mempool, but most are complex for the average user, and some even border on fraud (double-spending — spending the same coins twice).

However, there is one useful feature available to everyone — Replace-by-Fee (RBF).

Not every Bitcoin wallet (especially mobile ones) supports this feature. RBF allows you to edit an already sent transaction that is in the mempool.

How Bitcoin Works — Replace-by-Fee in practice

Editing means the new transaction uses the same inputs but with a changed fee. This is not considered double-spending, because RBF prevents abuse. Bitcoin nodes treat the modified transaction as the original and move it to a better position in the mempool.

If the fee is too low, it is perfectly normal to increase it to speed up processing. Don’t overlook RBF — enable it before sending to ensure your transaction won’t be delayed.

Confirmation

Tony realises that his thrift could stop Cindy receiving her gift, so he uses RBF and increases the fee. The transaction becomes more attractive to miners and they include it in the next block — it receives 1 confirmation.

With each new block, the transaction receives another 1 confirmation. When it reaches 6+, it is considered fully confirmed.

Transaction speed

There is no fixed speed, but let’s calculate it based on Tony’s transaction:

Assumptions:

    • Block size: ~1 MB (1,048,576 bytes)

    • Block generation time: ~10 minutes (600 seconds)

    • Transaction size: 374 bytes

Solution:
1,048,576 / 374 = ~2,803 transactions per block
2,803 / 600 = ~4.6 transactions/second

Answer: Miners add ~5 transactions/second of this type.

Of course, these are approximate values — speed varies every second. What matters is that your transaction is confirmed as quickly as possible. If that happens, the transfer will reach the recipient in 1—600 seconds.

In fact, once included in a block, the recipient can not only see the funds but also use them (under certain conditions). Swift, isn’t it? But what about the six-confirmation rule? 6 blocks at 10 minutes each = 1 hour

Bitcoin clients

It all depends on the software you use. Classic wallets display a transaction as “unconfirmed” until it receives 6 confirmations. Some services that accept BTC require even 7, 10, 45 or 214 confirmations.

BTC generated as a block reward can be used only after 100 confirmations, but classic wallets hide them until 120.

The number “6” is not accidental. With each new block, the transaction becomes more secure. To alter an already confirmed transaction, the entire subsequent blockchain would have to be recalculated, which requires enormous computing power and multi-million-pound investments. The more confirmations, the more secure the transaction.

But with a blockchain as stable as Bitcoin’s, this is more of a recipient requirement than a protocol rule.

That’s why Cindy and Tony use not a classic but a modern, feature-rich wallet (like Trustee Wallet). Thanks to the ability to use unconfirmed transactions, once included in a block the transfer immediately appears in Cindy’s wallet. Tony can use the change, and Cindy — the gift.

The combination of SegWit + RBF + unconfirmed transactions enables maximum speed on the Bitcoin network, which is critical for non-custodial services.

Download Trustee Wallet

Conclusion

How Bitcoin Works — summary

Bitcoin is extremely complex and highly technological. It’s impossible to describe every detail in one article, but we hope you now understand how your coins move even in a single transaction — and how the network protects itself from hackers, spam and fraud.

The stability of Bitcoin depends on both miners and ordinary users. The more people participate, the more secure and decentralised the network becomes.

Install the Trustee Wallet multicurrency wallet right now!

Buy, sell, trade and earn cryptocurrencies

Download Trustee Wallet
wallet-screen
second-layer-img
This website uses cookiesIn order to ensure the functionality of the Website and to prepare a statistical analysis of the website visitors' navigation methods, we use cookies. Manage preferences