How do bitcoin transactions work?

July 7, 2020   Bitcoin

Today it’s hard to find a person who hasn’t heard of Bitcoin. However, the level of understanding of its principles and mechanisms varies greatly. Many people are satisfied with the knowledge that it’s enough to get a wallet, receive, send cryptocurrency to another person or sell it. For some users this information is sufficient. Nevertheless, for cryptocurrency investors a deeper understanding of Bitcoin’s nature is mandatory as it can resolve many questions and avoid problems with cryptocurrency usage.

Once we already overviewed what Bitcoin is, but did not go into details. In this article, we will try to describe how Bitcoin works in an accessible and detailed way.

Network


As many sources tell us, Bitcoin is a peer-to-peer payment system / network, the cryptocurrency of the same name is the settlement unit of operations in this network.

A peer-to-peer network is a computer network which principle is the equal rights of all participants. Each peer or node, as they are also called, performs the functions of both the client and the server. Such an organization allows you to maintain the network’s operability for any number and any combination of available nodes, the sum does not change from rearranging the places of the terms. Network participants are all peers, so the main feature of the system is complete decentralization: there is no central administrator or server. Instead of the term “peer-to-peer”, you can use such definitions as: a decentralized or p2p network.

Blockchain


The basis of bitcoin, and along the way, the “register” of transaction accounting is an ordered sequence (chain) of a data set (blocks), or simply a blockchain. Each block of the bitcoin network holds up to 1 MB of data, it’s formed on average 10 minutes, and it contains information about all transactions placed in it and information that connects it to the previous block.

Each block in the chain is cryptographically interconnected with the previous and the next. This relationship protects the network from replacing or modifying existing blocks in the future, making the blockchain immutable and transactions irreversible.

Principle of operation


For a clearer understanding of the basics of the Bitcoin network, imagine a hypothetical crypto enthusiast, let’s call him Tony, who has a bitcoin wallet with 2 BTC on balance.

Let’s assume that Tony wants to give 1 BTC to his friend Cindy, and for this he needs her unique bitcoin wallet address - an analogue of the account number in a traditional bank. Tony puts this address to the appropriate input field of his wallet, and in the other field he indicates the transfer amount - 1 BTC. Then Tony goes on to set the size of the transaction fee, and here we will dwell a little more.

Transactions and network load


As in any other payment system, transactions occur in bitcoin, that is, assets are transferred from one client to another. For bitcoin transactions, a commission is charged that is sent as a reward to the miners confirming these transactions. The higher the commission and the lower the network load, the faster transactions are confirmed.

Network load means the total number of participants sending their translation at the same time.

In essence, a transaction is a set of information that indicates to network participants what value the sender’s balance has decreased and what value the recipient’s balance has increased.

Miners


For a transaction to be successfully completed, miners must confirm, or validate, it. Nowadays, these are mostly specialized farms that use powerful computing equipment, ASICs, to verify transactions for “correctness”, they collect these transactions into blocks, and the blocks are sequentially connected to each other. The network algorithm takes 10 minutes to form 1 block, during which the miners perform the same type of computational work in search of one unique solution every second. This is not difficult, it is not a mathematical problem, but it is a very large amount of work, which is difficult to do with small computing power quickly and efficiently.

Miners receive a reward in the form of BTC for the work done. This reward consists of the commissions that users paid for transactions and new bitcoins that the network itself generated when a new block was finished and confirmed from the transactions. We will talk more about miners and generating new bitcoins in a separate article.

Commissions


Let's get back to our crypto enthusiast. Setting the size of the transaction fee, Tony is guided by the fact that for each byte of information he has to pay a certain amount of Satoshi - a fractional part of bitcoin. Since Tony does not know how much data his transaction will take, he decides to save and set the price at 1 Satoshi per byte.

For you, readers, we will tell how the weight and cost of a Tony transaction will be formed.

Those 2 BTC, which he has on the balance sheet, appeared in the wallet for a reason. Tony earned them - 1 BTC in 2017, 1 BTC in 2018. Now he wants to send half to his girlfriend. In his transaction, in addition to information about the number of coins, information on the addresses from which the coins came to him (they are called inputs) will be included, information about the addresses of the recipients (they are called outputs) and information about his own address will also be included.

  • Each input from which coins were received weighs 148 bytes
  • Each exit to which the coins go is 34 bytes
  • The transaction itself weighs 10 bytes, regardless of the number of addresses or the amount of transfer.

We consider: 148*2 + 34*2 + 10 = 374 bytes. Now we know that our “greedy” Tony will pay 374 Satoshi for transaction.

Change


You ask, why do we multiply 34 (the weight of the address of the recipient) by 2, when the recipient is only one? The fact is that when you send part of your balance to someone, then not part, but the entire amount, leaves your balance, and after validation, i.e. inclusion of the transaction in the block, the balance minus the network commission is returned back to your wallet. Therefore, in addition to information about the address of the recipient, information about the address of the sender, that is, your address, is also included in the transaction. This return is called change.

Mempool


Having set a minuscule commission of 374 satoshi, Tony confirms the sending of 1 BTC and waits for the miners to confirm this transaction.

It's just that the miners are in no hurry to confirm it, the transaction falls into the mempool - the book of the queue for confirmation. Why? Because the miners want to earn money, and not just operate their equipment, because for the confirmation of Tony's transaction, they will receive only 374 satoshi. Especially for such very cheap transactions, there is a mempool with its sorting system.

First of all, miners “take” lighter transactions with a higher commission from the mempool, because confirming them is more profitable and much more is placed into their block.

By the way, if the sender uses SegWit technology, then his outgoing transactions weigh less than usual, which also attracts miners.

But you should not think that once in the mempool, the transaction is assigned some kind of sequence number. No. This queue is dynamic, every second a lot of transactions with different fees and weights enter it, so our Tony's transaction can wait a long time for confirmation. And, most importantly, while it is in mempool, Tony will not be able to dispose of the change.

In fact, in such a situation, the sender’s balances are “frozen”. It is this mechanism that protects the network from spam transactions - situations where a spammer creates a lot of cheap transactions, thereby overloading the network.

While Tony's transaction is in mempool, it is not considered confirmed and is not considered to be suspended. At the same time, it can be in the queue for a rather long time - until it is confirmed, or until it is removed by validating nodes from the mempool. According to statistics, the maximum waiting period of a queue is about 3 days, but at times of high network activity this period can be extended for a week or longer.

Agree that the speed of transfers in our time is one of the priority characteristics in the issue of using payment systems, and such queues are not very pleasant, to say the least.

There are many ways to push a transaction through the mempool. All of them are quite difficult to understand and implement for the average user, and some of them border on such a fraudulent way as "double-spending", or repeated spending. Nevertheless, there is one great feature that anyone can use, and we'll talk about it. It is called “Replacement Commission” (Replace-by-Fee or RBF).

Replace-by-fee (RBF)


Nowadays, not each bitcoin wallet has similar advanced functionality. RBF is editing an existing transaction that is in the mempool.

Editing means that the new inputs will use the same inputs as the old, but the commission will be changed. Such an edited transaction will not be considered double-spending, since using the Replace-by-Fee option will avoid this. The nodes of the bitcoin network perceive the edited transaction as old, and it is transferred in the queue of the mempool to more attractive positions for miners.

Thus, if the commission is too small, then increasing it is normal practice if you need to expedite the operation. Do not neglect the RBF function and enable it before making transactions, this will allow you to play it safe in case the transfer is delayed in the queue.

The confirmation


Tony realized in time that, due to his greed, Cindy might not receive a gift at all, so he timely used the RBF function and increased the commission. The transaction, as expected, became more attractive for miners, and they included it in the next block - the transaction received 1 confirmation. With each subsequent block found, this transaction will receive 1 additional confirmation. When there are 6 or more such confirmations, the transaction is considered confirmed.

Transaction rate


Speaking about the speed of transfers, it should be understood that there is no definite value. But let's calculate it based on Tony's transaction and the data we have.

Condition:

  • the size of one block is 1 Mb (1048576 bytes);
  • each block filled with transactions is formed once in 10 minutes (600 seconds);
  • our Tony's transaction has a weight of 374 bytes.

Decision:

  • 1048576 bytes: 374 bytes = 2803.6 transactions in a 10 minutes block.
  • 2803.6 transactions: 600 seconds = 4.6 transactions per second.

Answer: Every second, miners confirm 5 transactions, similar to Tony's transaction.

Of course, all these are approximate values, since the processing speed changes every second and depends on many factors. The main thing is that your transaction is taken from the mempool as soon as possible, and if this happens, then your transfer will reach the recipient within 1-600 seconds.

In fact, after the transaction is included in the block, the recipient can not only see the funds on his balance sheet, but also, under a certain condition, manage it. Fast, right? Yes, but what about the 6 confirmations rule? 6 blocks, 10 minutes each, total - 1 hour…

Bitcoin clients


It's all about the software that cryptocurrency holders use. Classic Bitcoin wallets will display the transaction as “unconfirmed” until it receives 6 confirmations (blocks).

Services that accept BTC as payment can set their limits on the number of blocks needed for confirmation (7, 10, 45, 214).

BTC, which are generated by the network as a reward for finding a block, can be used only after 100 confirmations, but classic bitcoin wallets will not display coins received for finding a block until 120 confirmations are collected.

The number "6" was not chosen by chance. With each new block, the transaction becomes less vulnerable to spoofing or change. To do something with an already confirmed transaction in a block, you will need to “rewrite” all subsequent blocks, and this requires very huge computing power and millions of investments. And the more confirmations a transaction receives, the more secure it will be.

But in such a powerful and stable blockchain as Bitcoin, it is more likely the requirement of the recipient of the transaction, and not a rule of the protocol.

Therefore, our Cindy and Tony use not a classic, but a very advanced and functional Bitcoin wallet. Thanks to the function of using unconfirmed transactions activated in it, Tony's outgoing transaction, after being included in the block, will be immediately displayed on Cindy's wallet. In this case, Tony will be able to immediately dispose of the change, and Cindy can receive the gift.

The link “SegWit + RBF + use of unconfirmed transactions” allows you to squeeze the maximum speed out of the BTC blockchain, which is important for non-custodian services.

Conclusion


Bitcoin is very complex and very technologically advanced. In one article it is impossible to describe all the subtleties and nuances of its work, but we still told you about its basics. Now you know what difficult journeys your coins make within just one single transaction between two wallets and at what speed. How and in what way the network protects itself from hacking, spam attacks, fraud or rash actions of beginners.

The stable operation of bitcoin equally depends on both miners and ordinary users, and the more participants there are on the network, the more secure and decentralized it will become.

Author: Kate Solano for Сrypto-Rating.com
Share
Pin
Send
Share
Share



Top 10 upcoming ICOs

ICOs Rating Days left
1 DogData 5 31
2 2local 5 62
3 SerenitySource 5 91
4 Geco.one 5 91
5 Tycoon 5 92
6 Pawtocol 4.9 63
7 Curate 4.9 84
8 Ledder 4.9 92
9 IdeaFex 4.9 625
10 BitWings 4.8 0

Rating

Top 10 Crypto Brokers

Broker Status
1 FIBO Group information
2 XM information
3 OctaFX information
4 101investing information
5 T1Markets information
6 easyMarkets information
7 Orbex information
8 LH Crypto information
9 USGFX information
10 FOREX.com information

Rating

Top 10 Cryptocurrencies

Сryptocurrency CVIX Price Change, 24h
Bitcoin 21 $10 694.94 -0.41%
Ethereum 42 $355.09 -0.10%
Tether 1 $1.00 0.02%
XRP 30 $0.240397 -1.02%
Bitcoin Cash 32 $228.18 0.33%
Binance Coin 63 $28.36 2.14%
Polkadot 50 $4.33 -4.23%
Chainlink 77 $9.71 -5.82%
Bitcoin SV 37 $174.71 3.47%
Crypto.com Chain 44 $0.152295 -0.59%

Rating

Top 10 Crypto Exchanges

Exchange Volume change, 24h
1 Binance 36.37%
2 ZG.com 2.65%
3 HBTC 13.25%
4 CITEX 11.02%
5 TAGZ Exchange 11.50%
6 Bidesk 14.76%
7 IDCM -11.63%
8 Bitribe 17.13%
9 Binance.KR 33.14%
10 Chiliz 16.90%

Rating