Finding Consensus 2/4: Proof Of Work

Till Antonio Mahler
blockwhat?
Published in
11 min readJan 17, 2019
Photo by Ricardo Gomez Angel

Welcome back to blockwhat?, it’s a pleasure to welcome you here once again on our journey to explore the technological fabric behind blockchains.

In today’s post, we will explore an ingenious idea that constitutes a truly technological marvel — a fascinating concept to find consensus, known as Proof of Work. We will dive into the importance of this revolutionary idea, understand its inner workings and get to know the limitations surrounding this concept as well.

A captivating story in three chapters — let’s get going!

Consensus

Photo by Olav Ahrens Røtne

Agreeing upon what’s “true” is almost always a tricky business, even more so in decentralized systems, where there is not a single authority of power.

In order to understand why finding consensus is so incredibly important in a blockchain context, it’s important to note that at their heart, blockchains are simply ledgers that record the state of a system at a specific point in time.

The challenge of finding a single universal “truth” about the state of transactions and ownership within in public global ledger lays at the core of blockchain technology and the ingenious solution found for it sets this technology apart from all the traditional systems before it.

Legacy systems depend on a trust model with a central authority that enables them to verify and authenticate the state of affairs within their database. Since an inherent characteristic of blockchain technology is that it has no central authority, it is of utmost importance to find a mechanism with which consensus can be achieved, so that every node can trust the public ledger as the ultimate authoritative record.

Satoshi’s main invention is arguably the decentralized mechanism for emergent consensus within a decentralized system.

You might find asking yourself now, what the hell is emergent consensus?

Well, in order to understand this, it’s indispensable to recall the topic of the last post — Byzantine Fault Tolerance. This topic dealt with the incredibly complex problem of ensuring consensus in a decentralized system, which might contain malicious actors. A Byzantine fault tolerant system is one, that ensures that consensus still can be reached completely.

To get an in-depth understanding of this concept, check out this article:

Satoshi’s idea, Proof of Work, works slightly different though. Instead of having a consensus that can directly be believed 100%, it is rather a probabilistic one — meaning that the probability that this particular consensus is correct, is growing with the time passing by, but will never be 100%.

It is an emergent consensus, since the consensus is an emergent artifact of the asynchronous interaction of all the independent nodes (aka computers), all following the same simple rules.

The way this emergent decentralized consensus is achieved is by the mesh of four different processes, which take place independently of each other across the network:

1) Full nodes use a comprehensive list of criteria to independently verify each transaction.

2) All these transactions are bundled independently into new blocks by mining nodes, together with a Proof-of-Work.

3) The new blocks are independently verified by every node and assembled into a cryptographically linked chain.

4) Each node then independently decided on the assumed correct chain by choosing the one with the highest cumulative computation performed through Proof-of-Work.

By harnessing the synergies of these four processes, blockchains can secure the system and enable emergence of a network-wide consensus without a central authority. All the properties of blockchain technology emerge due to this, such as currency, transactions, payments and the security model.

The mechanism by which transactions are verified and aggregated into new blocks is achieved by so-called mining, as is the case for Bitcoin and Ethereum for example. This process is basically the decentralized security mechanism, which enables the establishment of a trusted public ledger without a central authority.

After having combed through this introductory part, let’s now explore how mining works in detail.

Mining

Photo by Simon Basler

The process by which consensus is achieved is described synonymous as mining. As in the real world, where mining is hard work, the connotation translates well into the meaning within a blockchain context.

Before we get into the nitty gritty details of how this process works, we will start with an overview of the flow of transactions. Let’s take Bitcoin for this example. The first step is to verify and subsequently bundle transactions during a certain amount of time (in Bitcoin’s case ~10 min) into a single block.

The nodes than all take part in a race to solve a cryptographic puzzle, this process is known as Proof of Work. If a node has found the right answer to the puzzle, they get the right to broadcast to the network, which then verifies the validity of the solution found and the transactions included. Once this is done, the block is cryptographically linked to the blocks before it — slowly growing into a chain of blocks.

Source

After having looked at a high-level description of the process, we will explore the fascinating specifics of this ingenious marvel.

There are some concepts mentioned below, such as hashing and merkle trees, that have been covered in prior posts, therefore we will not get into them in too great detail — if you haven’t read them yet, feel free to do so here:

We will begin by looking at the way all of these blocks are constructed. Each block has a so-called block header, which consists of several components, such as the version of the software, the previous block hash, the merkle root, a timestamp, a difficulty target and a nonce.

Source

The software version is used in order to keep track of changes or upgrades in the underlying protocol.

The previous block hash creates the chain of cryptographically linked blocks.

The merkle root is the all encompassing hash of the underlying merkle tree (explained in a prior post in depth).

The timestamp is counting the quantity of seconds that have passed since the first of January 1970. https://en.wikipedia.org/wiki/Unix_time

The difficulty target is an important part in the cryptographic puzzle and dictates, well, the difficulty.

Last but not least, the nonce, is used in the cryptographic puzzle as well.

For our little journey into Proof of Work, we will focus on the last two bits, difficulty target and nonce. The original idea behind this concept can be traced back to 1992, when Dr. Cynthia Dwork and Dr. Moni Naor published their research on how to combat junk-mail.

More commonly known is Adam Back’s hashcash though, which is covered in depth in the following post:

Hashcash was designed as a system to combat junk email. It does so by obliging the sender of an email to solve a little cryptographic puzzle, which requires some processing power and thus energy (that has to be paid for) to be solved. On a small scale for individual emails this does not matter too much, but in the case of spam, where potentially millions of emails are send, this suddenly incurs a very high energy bill.

Satoshi Nakamoto incorporated this idea into Bitcoin and directly credits Adam Back in his whitepaper “Bitcoin: A Peer-to-Peer Electronic Cash System”.

So what exactly is the place of this concept within some of the most widely used blockchains like Bitcoin and Ethereum?

Well, Proof of Work is the most commonly adopted consensus algorithm and is used both by those systems. It constitutes a cryptographic puzzle, which competing mining nodes try to solve.

In order for a competing mining node to win the right to broadcast their block into the network, the node needs to hash the block header repeatedly, changing one parameter at the time (the nonce we mentioned earlier). They continue doing this until the resulting hash output matches a predefined target, which is defined by the software in the block header.

By changing the nonce, the mining nodes need to use a lot of computational power to use brute-force in order to produce a hash that is less than the target. By setting a lower target, the computational power needed increases exponentially and it is thus more difficult to find. Since the probability of any possible outcome can be calculated in advance, is is possible to use an outcome of a specific difficulty as a proof of a specific amount of work.

Photo by Dominik Vanyi

But why would people willingly commit their computers to perform so many random guesses simply to solve a cryptographic puzzle?

Well, the incentive structure behind this idea is what truly makes Bitcoin and other blockchains so secure and ensures integrity! If your computer is the one to find a valid solution and the block is accepted by the other nodes into the chain of blocks, you get two rewards — Bitcoins and the fees that all the transactions incur.

Right now that would still amount up to 12.5 Bitcoins (even though this number is halving every 210.000 blocks), which would make you a nifty ~40.000 Euro — not too bad, heh?

As more and more people want to take part in this mining race (and thus the possibility to make some nice income), the total processing power increases — this is also called the total hash rate of the network. In order to ensure a steady production of new blocks (and therefore a steady process of minting new coins), the mining difficulty increases proportionally to the total hash rate of the network.

Source

Using Proof of Work has the advantage that it makes it extremely costly for malicious actors to introduce false transactions or change the ledger, since they would need to be in control of a vast amount of the total processing power within the network.

Blockchains that use Proof of Work as their consensus mechanism always encourage the computers that form part of their respective system, to take the chain with the most Proof of Work as the valid chain.

For an in-depth look into both Bitcoin and Ethereum, I’d humbly recommend you to read these two posts:

Before we end this section, I’d love to highlight some of the different ways in which different blockchains enable computers to mine and therefore perform the Proofs of Work.

There are mainly five different ways which can be used to take part in the mining process:

CPU mining is utilising the Central Processing Unit of a computer, which is the “heart” of a computer, controlling instructions and the data flow inside a system.

GPU mining is using the Graphic Processor Unit (aka Graphic Card) to perform the required calculations.

ASIC mining is making use of specialized chips that were designed to calculate hashes with a very high throughout. It stands for Application Specific Integrated Circuits and is the most widely used way for mining on Bitcoin and Ethereum currently.

Mining pools bundle together the processing power of many individual computers and share the profits — for most people this is the most common and most effective way of taking part in the mining business.

Cloud Mining refers to the possibility of utilizing the services of a remote datacenter to take part in the mining process.

So far so good, before coming to an end of this post, we will briefly examine the limitations and problems surrounding Proof of Work.

Limitations & Problems

Photo by Jose Aragones

While Proof of Work ensures a very high degree if security and integrity for blockchains, it also has its downsides.

For one, due to the very heavy processing that takes place, the energy required to perform all the random guessing is quite enormous.

The current hash rate of the Bitcoin network is above 38 trillion hashes per second for example. Since the Proof-of-Work algorithm consumes vast amounts of computing power and therefore energy, it is not very environmental friendly, consuming more that 47 Terrawatthours, almost equaling the annual energy consumption of Singapore.

Source

Another problem are the mining pools that were mentioned above. The massive concentration of mining power into these pools has led to a de facto miner centralization — there are opinions that suggest that this doesn’t really constitute a big problem tough.

Source

You’ve made it to the end of this post, congrats! I hope you’ve enjoyed reading this bit on Proof of Work and that your understanding of this crucial aspect of blockchain technology is now clearer to you.

If you have any questions, remarks or constructive feedback, please let me know — I’d love to get in contact with you.

All the best

Till

PS: If you’re looking for helpful and great resources to learn more about blockchain’s paradigm shifting technological potential, check out these awesome resources.

--

--

Till Antonio Mahler
blockwhat?

Technology enthusiast from Berlin. Lover of random yet mesmerizing knowledge. Curious about all aspects of life.