Macroeconomic Monitor
Home / Economy / What is Bitcoin Part IV: Double spend attack, transactions and fees

What is Bitcoin Part IV: Double spend attack, transactions and fees

Author: Stilgar

This is the fourth part of our series "What is Bitcoin?" You can read the previous parts here, here, and here.

In the last part of the series, we posed the main problem that blockchain technology solves in the field of digital currencies - "double spend". But what would the so-called "double spend" attack and the protection against it actually look like? I remind you that because of public and private keys, there is no way for someone to make a transaction on behalf of another. The attack vector is double spending. Imagine that we have a miner who wants to defraud us of money. The miner sends the merchant Bitcoin, the merchant sees the block where he received the money and sends him the goods. Then the miner mines different blocks starting from an earlier block and instead of the transaction to the merchant, he includes in the new blocks a transaction to another of his addresses and so he both receives the goods and the money remains with him.

However, to achieve this, the attacker will have to mine more blocks than all the other (honest) participants in the network combined, otherwise his chain will not be the longest and will be ignored. To achieve this, he needs 51% of the network's computing power. For this reason, the potential threat to Bitcoin is known as a 51% attack. Satoshi's original vision was that everyone would mine on their own processor at home and no one could have as much computing power as the millions of users combined. In practice, things are developing a little differently and we already have specialized hardware for mining Bitcoin, which is infinitely more efficient than the processors on our home computers. However, there is competition and no one controls 51% of this resource, and if one day this person or organization controls it, they will have invested huge sums of money and if they use them to destroy Bitcoin, they will realize huge losses because this hardware would be useless for other tasks. The reward from generating new blocks is greater than the potential fraud that they could commit.

By now, the reader should have convinced themselves that Bitcoin really solves the problem of decentralized sending of value online.

Bitcoin transaction

A Bitcoin transaction contains information indicating which address to get Bitcoin from and which address to send it to. What’s more, the amounts in each address are not simply counted as a sum but as a result of previous transactions. The amounts available in an address are called utxo – unspent transaction output. When an address receives some amount as a result of a transaction, this amount is added as a new record to its utxo. In addition to signatures, a transaction contains inputs and outputs. When a user wants to send money, he must select one or more utxo (his available money) and put them in the transaction as inputs. These utxo can be from one or more addresses. Then he selects addresses for outputs. These addresses can be more than one. A common scheme is to have two output addresses, one for the recipient of the money and the other for the sender, which acts as a kind of change. This practice adds confidentiality to the transaction because it is not entirely certain which address is the recipient’s and which is the sender’s. Outputs become unspent transaction outputs for the recipient addresses.

Size of block and taxi

At one point in history, Satoshi seemingly temporarily limited the block size to 1MB. Everything is temporary, but forever, and from 2014-2017, a civil war broke out in the Bitcoin community over whether the block size should be increased. The people who wanted to increase it lost. The story is long, but in short, the result was an alternative network with changed rules where blocks could be much larger (currently 32MB) called Bitcoin Cash (Bitcoin and Bitcoin Cash are different things). In the interest of transparency, I should say that I am a firm believer in large blocks and I believe Bitcoin Cash is the technically correct solution to the problem. The arguments on both sides are too numerous to list here. But why does block size matter?

Each transaction is recorded in a certain amount of bytes. It follows that in a 1MB block we can only record a certain amount of transactions. In 2017, Bitcoin became popular enough that the space in the block began to run out. So how do you choose which transaction to enter the block? By bidding. An amount called a fee can be attached to each transaction, which goes to the miner who mined the block. Accordingly, the logical behavior of miners is to sort incoming transactions by fee and push as many as they can into the block, starting with the most expensive, while the rest are left to wait. At the time of writing this, the average transaction price is $10, and it has been as high as $60. This is of course not very pleasant. An interesting detail is that when the network stops giving rewards for generated blocks, miners will have to support themselves from fees. Even now, many blocks generate more revenue from fees than from rewards. With Bitcoin Cash, a transaction can be sent for less than a penny because there is a lot of free space in the blocks.

The market decided that the Bitcoin brand was more valuable than the technically correct implementation of Bitcoin Cash, and as of today, one Bitcoin (BTC) is worth $41,824, and one Bitcoin Cash (BCH) is worth $486. Who am I to argue with the market? Despite the terrible PR, Bitcoin Cash proves that technically large blocks work. In addition, Bitcoin Cash is very suitable for beginners to experiment with Bitcoin. You can create a Bitcoin Cash wallet and send small amounts of a few cents from your computer to your phone and back, and it costs almost nothing. Bitcoin works the same way, but it will cost you a few dollars per transaction. Not very suitable for experimentation

There are attempts to solve the problems of high fees, most notably the Lightning Network project, which provides alternative and cheap ways to send Bitcoin. An explanation of how it works and what its advantages and disadvantages are is too long for here.

Transactions and taxis

The bidding for transaction fees does not depend on the value being sent. It is possible to send a small amount for a lot of money and a huge amount for a small amount of money. The bidding is for space in the block. This means that a transaction that contains less information will be able to pass with a lower fee than a transaction with more information. A transaction that contains more inputs and outputs is more expensive than a transaction that contains less.

It is possible for a person to have a lot of money in a Bitcoin address and still have a fee for sending it that is more than the money in the address. This can happen if the money has arrived in very small transactions. Then there will be a lot of utxo in the address and when sending it, it will be necessary to record many inputs in the transaction, which will increase its size. It is as if Bitcoin has a fee for counting banknotes and coins, and if someone wants to send a lot of "small" ones, they will have to pay a large fee. The good news is that the other party can only receive one output. Large exchanges use moments when fees are low to aggregate amounts from addresses with small amounts in order to pay less fees when users decide to withdraw Bitcoin from the exchange.

Did you like it? Take a minute to support the EKIP on Patreon!
Become a patron at Patreon!

About Guest Author

Read more

The financial coup in Bulgaria of 1947

The year 1947 in Bulgarian history is associated with the implementation of an important monetary reform. It is …