Cas we have already discussed in “What is Bitcoin mining?“, Miners are an essential piece of Bitcoin. It depends on them that the transactions are validated and, to a large extent, the security of Bitcoin. But they are not the only ones on whom the incredible task of taking care of network security falls. What security are we talking about? Who are the guardians of Bitcoin? What can happen?

To explain this and much more, we will talk about what a 51% attack and what danger it poses to Bitcoin.

A little context

First of all, Bitcoin and the rest of cryptocurrencies (the real ones) are based on a fundamental principle: decentralization. Due to this principle, all participants in the network have a copy of the account book, of the blockchain. Participants are commonly called “nodes".

Each copy reflects the same complete history of all transactions that have occurred since the beginning of time. In Bitcoin this means that every transaction since January 3, 2009, is within the blockchain of this network. But because there is no central node in Bitcoin, all nodes need to have their copy. In this way, they validate transactions and new blocks mathematically to check that everything is fine.

These validations are very simple. But you have to keep one thing in mind, validating transactions / blocks is not mining. Rather, this task means validating that the mining job has been correct and is a very simple mathematical operation. If the validation operation is successful, the nodes add the new transaction to their copy of the workbook, and if not, they discard it. After this action, the network is programmed to follow the longest chain of blocks (yes, there are constantly branching attempts that are orphaned without support).

All this is handled autonomously thanks to the consensus protocols. And is that if more than 51% of the nodes take something for certain, being the majority, it is decided that this is "the truth", in a democratic way. In this way, the chain that receives the support of 51% of the network becomes the longest chain.

Where is the problem?

But surely you will ask yourself: Where is the problem in this work scheme? What if more than 51% of the nodes decide to lie because they are associated with and benefit from that lie?

This, which in theory is possible, has become impossible to implement, due to its technical complexity and cost. In addition, there are not so many advantages that can be obtained from what we see how the Games theory (See Nash equilibrium).

As you may have understood, each node makes the network a more secure network, which makes it possible to avoid falsifying the accounts of the Blockchain. When we mention "nodes" it is important to understand that nodes are not necessarily miners, nodes are all those computers that are linked to the P2P network Bitcoin. Miners are also nodes, but with activated functionality to solve mining problems, so to be a node you don't need to spend electricity beyond what it means to have a computer on with an Internet connection.

Bitcoin's security (and any distributed system) is directly proportional to the decentralization of its nodes.

From

A 51% attack occurs when one person or group controls 51% of the network's computing power. In other words, it would have more computing power than all the other miners and more participants for the “voting” than the rest together. A situation that could negatively affect this distributed electronic system, temporarily altering the operation of the network. That is the theory. Even his own Bitcoin whitepaper It directly mentions the scenario of a 51% attack. In fact, it has been a necessary evil to live with in this type of infrastructure.

These debates are not just a thing of the present, in the past there were also times of many doubts related to the “ghost” of the 51% attack on Bitcoin. Since early 2014, the cloud mining company Ghash.IO It was dangerously close to 50% of the total mining hash (or power) of the Bitcoin network. This situation generated insecurities in all those users who had just discovered Bitcoin. However, the company is currently no longer operational and BItcoin's hashing power is more distributed.

But could I have done something? Let's see it with a simpler example.

I am the Evil Evil and I want to destroy Bitcoin

Do you hate that humanity walks towards freedom? Does your happiness depend on controlling the planet? Surely you are someone close to a central bank, fiat lover, and therefore, you hate Bitcoin.

Well, from Bit2Me we are going to explain how to destroy Bitcoin: we encourage you to make a 51% attack.

The recipe is very simple, you just have to:

  1. Get 51% of the network, that is, about 6000 nodes.
  2. In addition, you need to have a network of miners powerful enough so that you are always the one to mine the block.

In this way, whenever you mine a block, your 6000 nodes will validate what you do, and not what others do.

Of course, you must do everything very quickly, in seconds!

Does this mean the end of Bitcoin and continue under the fiat regime?

Unfortunately for Evil Evil, and for the peace of all those good people: the answer is no. In practice it is impossible to execute this currently.

The nodes may be "cheap," but the miners are not, and neither is their electricity.

"But a bank prints money for free, it can buy whatever it wants" you will think.

It is true. Well, we also tell you that due to the competition-based scenario, Bad Evil is obliged that his attack must occur constantly and in seconds, something impossible, since each block is mined in 10 minutes, and in just a few seconds you would be detected.

However, imagine that you do it in another time or context.

The end result would be that Evil Evil would control the network, to the blow of a very large checkbook. For what? For example, to make double expenses that could eventually go well, and that would be detected by the network (which would eliminate you by forking and leaving you out).

There are many financial entities that dared to say that Bitcoin was easily attachable and months later they had to rectify.

The Bank of Canada itself, among others, has had to rectify before a first "mockery" that it made to the security of Bitcoin. After getting to know in depth how Bitcoin works took out a study where he ensures that it is practically impossible, currently, to violate the bitcoin network through a successful 51% attack.

Current situation network

There are currently more than 10.000 nodes: View node map.

However, the scenario is not perfect. Why?

Bitcoin has millions of users. But there are only about 10.000 nodes. This means that almost all the people who use Bitcoin do not have their own node, they use third-party nodes: for example, users of online wallets, light wallets, exchange houses, ...

On the other hand, as we have explained, miners are a very important part. They are the ones that create blocks, the only ones that can, and the blocks are necessary for transactions to be validated, without blocks there are no secure transactions.

The nodes can only validate the work, that is, in this case that of the miners.

The problem is that within the mining power we do not know how many nodes there are, and more than 60% of the mining power is only 5 great Pools currently: See mining distribution.

Hash power pools BTC

However, it is estimated that there are very few nodes behind the miners compared to the total network, and although there were many, we should not be alerted more than expected.

Cost and consequences

In the case mentioned above, this entity could use that advantage to carry out operations:

  • Reverse transactions and double-spend with your bitcoins
  • Avoid transaction confirmations that should be validated normally
  • Prevent other miners from mining valid blocks

Despite this, both the time and the investment that would be required to carry out such an attack is so high and complex that it would not be optimal for the person or entity concerned. Let's see some acts that the attacker could not carry out:

Reverse other people's transactions but do prevent transactions or new blocks from someone other than himself. (showing as 'unconfirmed').

  • Change the number of coins generated by each block
  • Create coins from nothing
  • Send coins that never belonged to you

Enter the following link if you do not know yet how Bitcoin transactions work.

However, for years it has been debating hypothetical scenarios in the 51% attack on Bitcoin, and there are many solutions that have been proposed. For example, that of Gavin Andresen.

Gavin Andresen (developer of the Bitcoin project), added some details and clarifications about this attack on their website Gavintech:

Something like “ignore a longer chain orphaning the current best chain if the sum (priorities of transactions included in new chain) is much less than sum (priorities of transactions in the part of the current best chain that would be orphaned)” would mean a 51% attacker would have to have both lots of hashing power AND lots of old, high-priority bitcoins to keep up a transaction-denial-of-service attack. And they'd pretty quickly run out of old, high-priority bitcoins and would be forced to either include other people's transactions or have their chain rejected.

According to Gavin, defending the network against a 51% attack would be relatively straightforward, forcing the attacker to have very high high-priority old hash and BTC power.
The time in which the attack would last would be relatively low and the attacker would quickly run out of high priority BTC being forced to include transactions from others or suffer rejection of their chain.

How to help avoid the 51% attack?

If one thing is clear it is that there are more and more nodes, but we must continue promoting decentralization more from Bit2Me and from each one of you.

What can a simple person like me do? Maybe you are wondering.

You are not a simple people. In Bitcoin you have the power.

As we have said, the health of Bitcoin is linked to the nodes that make it up, not to its price. Its price is a direct consequence of it.

If you believe in Bitcoin you can do two things:

  • Participate in the network. You only need to install a program and you will become a node: How to mount a Bitcoin node.
  • Share this post to everyone you can so they understand the importance of decentralization for Bitcoin.

Bitcoin is an incredible technological, financial, political and social revolution, but it depends on each of us to make it stronger and stronger.

Do you think that the current mining network tends towards centralization or decentralization? Can you think of more ideas to improve this situation?