Plato Data Intelligence.
Vertical Search & Ai.

DLT, What Is Proof of Work or Stake?

Date:

Photo by Dominik Vanyi on Unsplash

In my previous post about DLT, I touched on the concept of Proof of Work and mentioned in passing Proof of Stake. In this blog, I expand on these concepts and how they are fundamental to the idea of a trustless distributed consensus.

Firstly we have to describe what the problem is that we are trying to solve. Bitcoin set out to solve the complicated issue of creating trust between a group of trustless agents.

So what is this problem? A person asks to borrow some money from you and agrees to pay you back tomorrow. Since you are trusting, you loan them ten dollars. The next day you ask for your money back, they reply that they never borrowed the money from you. What do you do? There was no transaction record; you don’t have much of a recourse. You probably become less trusting in the future. The next time you enter a transaction of this type, you involve a third party to keep track of the transaction. When the borrower defaults, you can bring in the third party to attest that the transaction happened. If the borrower refuses to pay you back, you can go to the legal system and ask them to intervene on your behalf. Ideally, the third party is a somebody trusted, say a lawyer, and the transaction can be notarized to prove its authenticity. Imagine that you want to do this at a massive scale with people who are not in the same country as you. There are different legal systems, different recourse, oh the headaches.

The distributed ledger sets out to replace the legal structure with identity of ownership, cryptographic notarizations, and a way of establishing trust. The first part is reasonably straightforward. We each have an identity; in the form of a private key; we can use this identity to ‘sign’ any arbitrary data.

At its simplest, the holders of the pubic key can prove with exceptionally high confidence that the signature belongs to the holder of the private key and only the one private key. This digital signature is a compelling concept as it allows anybody with a private key to assert that they own the private key. It is safe to give the public key to anybody as there is no way to take the public key and create a private key copy. Just make sure you don’t lose your private key!

Notarization follows naturally from identity; if one party signs a message, a third party can countersign the signed message. If you trust the identity of the notarizing party, you have their public key, and you know who they are; they can make statements about the original party, such as I know this person, and you can trust them. You can observe this notion of trust throughout the internet every time you visit an encrypted website; you rely on a certificate notarised through a chain of trust. At the top of this chain is a root entity; in this example, it is ‘Baltimore CyberTrust Root.’

Certificate Chain of Trust

This chain of trust still leaves us with a problem. If you don’t know or do not want to trust any central party, how do you notarize transactions so that they can be irrefutable? The classic BlockChain solves this problem by a process called termed mining. Mining can broadly split into two categories, Proof of Work and Proof of Stake. We will talk about that shortly.

First, we should address the elephant in the room, the so-called permission-based blockchain. Over the last few years, many examples of these chains have sprung up, typically offered as high-performance alternatives to the trustless blockchains. The nature of mining is that it takes time and has a cost. These permission-based chains identify one or more trusted groups who perform notarization of messages on the chain. If there is an error or a change of mind, these trusted notaries can rewrite history and, if they are bad actors, they can act on behalf of others to deceive. In our original example, a lousy notary has the potential to side with the person borrowing the money.

From the perspective of trust, one can argue that a permission-based chain is no better than having a managed and operated database by a third party. There are still benefits to the digital ledger in these instances; for example, each party has a full copy of the ledger, transactions are standardized and, cryptographic signing of transactions. The digital signing is a compelling reason on its own, think checking a human signature vs. its digital counterpart. Complexity, performance and operational considerations are generally easier to resolve in a traditional database than with DLT.

We now come back to mining. At its heart, mining is an operation that shows that an actor, customarily referred to as a node, has built sufficient trust that it can sign a set of transactions (the block in blockchain) to state that the transactions are consistent and double-spend free. Double-spend is a simple notion in the ‘real-world’; if I give you a dollar bill, I can only provide that exact bill to you once unless you subsequently gave it back to me. In the digital world, this is a much more complex problem. Classical databases solve this by implementing transactions. You will often hear this referred to as an ACID transactional guarantee.

In a traditional double-entry bookkeeping system, the ledger records the movement of an asset from one account (or wallet) to another. For a ledger that is tracking a single currency, you can enforce two main properties. First, the ledger preserves the total number of any given asset in the ledger across all movement transactions. You can not create or destroy unless there is a specific one-sided transaction supported. Second, you can ensure that you can only move an asset from one wallet to another wallet if the source wallet has an instance of that asset available. In a multi-wallet transaction, all wallets must remain in balance after the transaction. These rules can be generalized to a multi-asset transaction by ensuring that the cost (the value of each asset converted to a common asset) sums to zero across the transaction. The multi-asset model is a longer subject to cover.

For a DLT, all transfers of tokens (or assets) must abide by the rules above. Typically the only one-sided transaction supported by the chain is creating new tokens through the mining process. So how does a distributed ledger do this?

We first tackle Proof of Work as it is the most established system. In Proof of Work, each mining node in the system ‘races’ against each other to come up with a solution to a sufficiently complex problem. For Bitcoin, this problem calculates the hash of the data in the block and adds a ‘nonce’ (an integer) value to calculate the block’s cryptographic hash. Mining is successful when the final hash mentioned above has a specific number of leading zeros in its binary representation. The nonce is updated repeatedly until a solution is found. In reality, it is a little more complex than this, with multiple hashes occurring.

Each miner is capable of performing a fixed number of hash computations in a second. The hardware of the compute node sets this limit. The problem’s difficulty is adjusted so that the sum of all miners’ hash rates will find a block in approximately ten minutes. The network adjusts the difficulty to take into account the current hash rate. At the time of writing, the Bitcoin network has a hash rate of one hundred and eighty million terra hashes per second. This hash rate is a massive amount of computational power and points to one of Bitcoin’s significant debates, its impact on the environment. Though, as renewable energy prices fall below that of other forms of energy, mining profitability provides an incentive to switch to the lowest-priced power source; how true this is will play out over the next few years.

One of the ‘flaws’ often identified in the Bitcoin mining protocol is to trivially paralyze the hashing operation. This feature has lead to significant centralization of hashing power and arguably defeats some of the decentralized design of the chain. Aggregating hashes together is known as pool mining. Solo mining is worthless to all intents and purposes; the odds on any single node in the network finding a solution on its own before the pooled hashes are infinitesimally small. Pools share the rewards from mining in direct proportion to the hash rate donated to the pool. While you will not get the big payout, you can get a small amount each time a pool mines a block. A small number of pools (8) make up a supermajority of hashing power. If these pools were to conspire together, they have the opportunity to make choices about the future rules of the chain.

Proof of Work provides trust and integrity when it is more expensive to either rewrite the chain’s history or control enough hash rate (greater than fifty-one percent) to change the protocol to benefit one party over another than to take the mining reward. The mining reward is defined as part of the Bitcoin protocol and includes newly minted coins and fees for the transactions processed in the block. Currently, the mining reward for a block is 6.25 BTC, plus the transaction fees. This reward is more than three hundred thousand dollars per block. Every day one hundred and forty-four blocks are printed, generating close to forty-five million dollars of mining revenue.

Miners have a strong incentive to do the right thing. This economic incentive also encourages miners to invest in more mining hardware and helps to ensure that no one group has majority control of the chain. It is the very ‘cost’ of mining that provides this guarantee. As the value of Bitcoin increases, the incentive to mine more also increases.

Newer chains such as Ethereum implement Proof of Work using different algorithms. Today there are many options, the most notable being those that derive work from the cost of moving data in memory (this is how Etherium works) vs. raw computational power. By ‘bandwidth’ limiting the Proof of Work chains like Etherium enable profitable mining on end-user commodity hardware (GPUs). To be profitable in mining Bitcoin, one has to invest in custom ASIC hardware.

Proof of Stake is an emerging replacement for Proof of Work that attempts to tackle the energy consumption (and hardware race) that pervade the current generations of chains. In Proof of Stake, miners post (or stake) a quantity of the chains currency so that they get a reward for signing a block, in the form of transaction fees, and stand to lose their stake if they sign a block in a way that is inconsistent with the rule of the chain. Ie. No double spend.

Let’s try a simple thought experiment. Consider a room with seven people in it, each place a hundred-dollar bill on a table in the middle of the room. This money is their stake; now, two of the seven agree to a deal, one will loan the other ten dollars returned the next day. They write down the agreement on a slip of paper and place it on the stake table. We now choose, at random, one of the seven people in the room to notarize the document. They read the paper and add their signature to say that this is a valid transaction. The other six can examine the document and validate that the terms of the transaction are consistent with the rules of the room. Assuming that everybody agrees, the transaction is binding. Each of the people in the room gets a small payment for validating the transaction. The people making the trade provided the fee. This fee provides compensation for having assets locked up as the stake.

Now imagine that the person selected to validate is one of the two people who are part of the transaction or colluding. They sign the document even though it breaks the rules of the room. Now when the other people in the room validate the trade and more than fifty percent of the room indicate that this contract is invalid, the trade is undone. The stake belonging to the verifier is removed from the table and is divided equally between the other six people. The seventh person no longer has a stake and can no longer participate in the validation, and they are out their one hundred dollar stake. Since the stake value outweighed the value of the validating transaction, it is not in the person’s interest to lie.

When you have more than fifty percent of the participants’ act honestly, the system works. For this, they get to keep their stake, and they get fairly compensated for their actions. While for one transaction, it might be worth defrauding the system; when you look at the total, it is overwhelmingly in their interest to behave honestly.

An interesting observation about proof of stake is that it needs the items you are staking to be valuable. This observation is one of the core reasons Ethereum started with a Proof of Work system and is working on switching to Proof of Stake now that Ether is highly valued.

We have yet to see a Proof of Stake system working at scale with high value at risk, over the next few years we will see how well they replace Proof of Work.

I hope this blog helps explain some of the terms, next time on to Smart Contracts.

Coinsmart. Beste Bitcoin-Börse in Europa
Source: https://medium.com/geekculture/dlt-what-is-proof-of-work-or-stake-41ca9cbdb8a3?source=rss——-8—————–cryptocurrency

spot_img

Latest Intelligence

spot_img