Proof-of-Work for Dummies

()

Proof-of-Work

You have probably heard that blockchain provides secure data storage. But due to what he succeeds?

In the article “What is blockchain really?” We figured out what makes the blockchain decentralized, and touched on the concept of Proof-of-Work – PoW, proof of work. However, we did not discuss in detail how the mechanism works, what problems it solves, and what difficulties it faces.

Decentralization is a key property of the blockchain, but it makes it potentially vulnerable. When one member of the network wants to download his copy of the blockchain, how does another user know that the “correct” blockchain is downloading? If there are thousands of computers on the network, what prevents hundreds of them from starting to bombard a new user with the data that they forged together?

In computer science, this is called the task of the Byzantine generals. This is a very difficult question, but we will still try to figure it out.

If you are familiar with the game in a damaged phone, then you understand how easy it is to distort information when transmitting along a chain for the sake of a joke or wanting to substitute another. The fact is that in this game, truth and falsehood are the same. But what if for false data had to pay extra?

The Proof-of-Work (PoW) algorithm allows participants in the blockchain network to know whether the information they proposed was created free of charge or if its authors had to seriously invest in its creation.

Why PoW Is So Important

PoW is used in bitcoin to solve several problems facing a decentralized network that does not have a ‘boss.’ Consider the most important of them.

  • Which version of the story is correct?
    In a network where you need to know who has the money, who spent the money and who received it, history is all. It used to be that it was impossible for participants in a decentralized network that no one directs to reach full consensus and agree with each other.
  • Network timing
    Online time is critical as bitcoin creates new coins every ten minutes. In a traditional system, you simply say, “Look at the clock,” but in a decentralized global system, the question arises of which watch to look at.

    Imagine a new computer joining a network today. The “old-timer” may say: “Hey, here is the money that I minted six months ago, and the money that I minted another ten minutes later.” How will a new network member be able to confirm past actions?

    To understand how Proof-of-Work deals with these two questions, you first need to understand what kind of mechanism it is and how it works.

Proof-of-Work Analysis: Without a Code, Nowhere

When Stephen Hawking wrote his masterpiece A Brief History of Time, a colleague told him that every scientific formula he included in the book would reduce the number of readers by 50%. So in the end, Hawking left only the famous Einstein’s E \u003d mc2. As a result, the book of Hawking was read by millions of people, many of whom are very far from physics.

Since this article is aimed at a wide audience, we will try to use as little code as possible.

If someone sees this hash, he does not know what is behind him, but we can say: “If you type matt text using a computer program, you can prove that we know what this hash is. The fact is that your program will generate the same hash, therefore, we know what this hash refers to. ‘

When the miner creates a new block for the blockchain, he must provide the network with two hashes: one of them is the hash of all transactions in the block, and the other is the hash, which proves that the miner spent a huge amount of energy on creating the block. These costs make data corruption unprofitable. But for this, as mentioned in a previous article, miners need to work in a system acting like a lottery, where there can be only one winner. Both of these tasks are solved using Proof-of-Work.

Cryptographic hash functions always return the same value for a given piece of data.

But why do this? Imagine that the computer set a task for us: ‘Give me the first number added at the end of the name Matt, as a result of which the hash will start from scratch.’

Our computer responds with matt14 and includes a hash; The receiving computer looks to see if the received hash matches the one that was requested.

This proves that our computer did the calculations adding numbers from 0 to 14 to find this hash. This is effective because our computer performed 15 actions, and the receiving computer was able to verify this with a single action.

In fact, we provided evidence of our work, that is, we performed proof of work.

A computer is capable of creating millions of hashes per second, 15 operations are given only as an example: in fact, such proof of work does not make much sense. But imagine a group of other computers telling us the following task: “Provide us with a valid transaction block, its hash, and also a number that will lead to a hash starting with 15 zeros.”

Finding a hash with 15 zeros at the beginning will take many trillions of attempts. A slow computer would take hundreds of years to do this, and several powerful computers would do it in minutes.

These computers will obviously eat a lot of electricity. Due to the cost of electricity, it is not beneficial for a miner to find a valid hash for an invalid transaction block. That is, it is foolish for the miner to confirm the “wrong” block, claiming that all transactions are valid, and just proceed with hashing. Other computers on the network will reject the invalid block, and the miner will not receive his reward.

One of the things that helps maintain decentralization of mining is that two miners cannot hash the same blocks. When hashing ‘a + b’, the result is not the same as when hashing ‘b + a’. Miners receive transactions over the network in a different order; Because of this, and also because of individual preferences in matters of commission, each miner processes the block a little differently.

Although all blocks may have been validated correctly, only one block can enter the blockchain. All miners will have to continue to hash until they find a number that, when added to their block, gives a result starting with the number of zeros that the network agreed to accept as a valid indicator.

In order to support the financial policy of Bitcoin, the network must guarantee the creation of a new block every ten minutes. The network does this by adjusting production complexity every two weeks. Therefore, if blocks are detected too quickly due to the number of new miners, the network to reduce inflation increases the required complexity, and miners have to look for hashes with a large number of zeros at the beginning.

It is impossible to know in advance what this hash will be, so miners should work quickly using many fast computers. Since there is an element of randomness in this “game”, a miner with the most powerful computer does not always win. Imagine this as a lottery, where the user with the most tickets has more chances to win, but does not win every time.

A brief repetition of the passed: the miner creates a block of valid transactions, and then runs Proof-of-Work on this block, hoping to find the hash set by the network rules before other miners. If successful, his block will enter the blockchain, and he will receive his reward plus a freshly released bitcoin.

The next time you hear in the media that miners earn bitcoins by solving complex mathematical problems, you will know what this is about.

Proof-of-Work Issues

Mining with the Proof-of-Work algorithm is not the only known method of achieving consensus in a decentralized network. Nevertheless, it is the safest and least centralized option to date.

There are other systems, such as Proof-of-Stake: it aims to solve some problems related to Proof-of-Work, but generally leads to a semi-decentralized (or semi-centralized) network.
So, there are two problems with Proof-of-Work.

High power consumption

Hashing from matt to matt + 14 takes less than one microsecond. However, the Bitcoin network consists of millions of specially designed microchips, hashed every ten minutes. It takes a lot of energy!

The current hash rate of the bitcoin network is 20 exashes per second, or, more simply, the network creates 20 billion hashes per second. An ordinary computer cannot even produce 1 billion hashes per second; But if it were possible, it would take 20 billion computers to have the same hashrate as the Bitcoin network.

Bitcoin miners use special chips designed for hashing. This protects the network from botnet attacks, in which hackers capture a lot of computers and use them for mining. Hackers can do this, but the power of all the computers available to them is not enough to trick the Bitcoin network. Blocks created by hackers will simply be rejected.

The blockchain keeps a history of all ever created blocks, including Proof-of-Work for each block. When a new computer joins the network, it downloads the entire blockchain and checks every piece of work to ensure that everything is correct. Hackers may send the wrong blockchain to the user, but the user’s software will connect to many computers and consider the longest chain with the longest cumulative proof of work – and this will be the “true” blockchain.

This is what we call thermodynamically safe, or protected by the laws of physics. If hackers want to confuse the network, they need to burn more energy on faster computers than the network itself. It will cost hundreds of billions of dollars; If hackers could possess such resources, they would find a more economical option to play by the rules and earn bitcoins.

Due to the security model of Bitcoin, where the network is protected by the energy it consumes, the main cryptocurrency is seen as something very energy-intensive. While the world’s population seeks to reduce the global carbon footprint, it provides the media with news that can stir and frighten the public.

Due to the fact that electricity is the most serious expense item that miners face, mining bitcoins is associated not only with the race for the right hash, but also with the search for the cheapest electricity. The best solution to get cheap energy was to use hydropower and other renewable sources. The winner in the race will be the one who finds the cheapest electricity. Thus, bitcoin supports the development of modern types of energy and contributes to the protection of the environment.

Centralization of mining

The boundaries of the profitability of bitcoin mining are very thin. To make a profit, you need to have access to cheap electricity, and its supply must be reliable. So far, most of the bitcoin mining is in the western provinces of China, where cheap electricity is produced in abundance. In contrast, the Proof-of-Stake model does not have a geographic reference.

The situation may escalate if the exclusive manufacturer of equipment for mining bitcoins decides to dictate its own rules, not taking into account the interests of customers. This will lead to centralization of the network. However, if the equipment manufacturer wants too much, network users can agree to change the Proof-of-Stake method. In this case, the equipment produced by the monopolist at one point will become unnecessary garbage.

Theoretically, there should be enough competition in the profitable market, but in this area consumers prefer to buy only the equipment that promises the greatest profit. Some rely on Moore’s law and believe that in the end, no miner will have an advantage over another; Others believe that market leaders will constantly succeed one another.

One thing is certain: today Proof-of-Work provides the highest level of security for decentralized blockchain networks.

How useful was this post?

Click on a star to rate it!

Average rating / 5. Vote count:

No votes so far! Be the first to rate this post.

Leave a Reply

Your email address will not be published. Required fields are marked *