Why Consensus is better than Proof of Work

Hodor

Hodor

I blog about Ripple & XRP. FULL DISCLOSURE: All views are my own. I do not work for Ripple; I am not a professional financial analyst, and the majority of my crypto holdings are XRP.

Read More

Do you remember where you were on Halloween in 2008?

That was when the term “Bitcoin” was first used, and it’s when a name was first given to the new decentralized, peer-to-peer electronic currency that had recently been created by a small group of developers. 1

The first time I heard about Bitcoin was when Wired Magazine did an article on it roughly a couple years later. Wired magazine was delivered to me in paper form (I’m old school). I remember reading about Bitcoin and shaking my head, thinking “there’s got to be some catch. It’s just electronic tokens like I’ve seen in video game item shops. Or Bitcoin must be some fad that will disappear in another year and become like “Second Life” – a boutique notion that will always have some die-hard advocates.

But Bitcoin was more than just a one-off fad.

Two years later in 2013, I realized I’d missed my opportunity to cash in on Bitcoin’s popularity, even though the writing was on the wall for all to see in Wired magazine’s early coverage years prior. So I tuned in. I started reading every whitepaper or research article on Bitcoin that I could get my hands on, and I frequented the online forums hoping to find some clue to the “next big thing” after Bitcoin. After all, I thought, by now – years later, there’s got to be a more modern version of Bitcoin’s idea that doesn’t require mining, right?

And there was. A futuristic startup from Silicon Valley had created a new cryptocurrency with a completely different validation mechanism. It did not require wasteful mining to secure its network in a decentralized fashion; instead, it used something called “consensus” to achieve agreement among its various nodes. This was different than Bitcoin, but it solved the “double-spend” problem flawlessly.

The Double-Spend Problem

If you’re new to cryptocurrency, you’re probably wondering what all the fuss is about.

Electronic cash has been around for many years, and we’ve been able to use credit cards for electronic transactions long since I can remember. So why would everybody get excited about Bitcoin when it was created?

The difference between a cryptocurrency and the traditional concept of electronic cash has to do with actually transferring value, as David Schwartz (Ripple’s Chief Cryptographer) put it. He pointed out that previous to the creation of digital assets like Bitcoin, organizations like banks would simply move the ones and zeros around in their own database to keep track of how much money someobody had, and to prevent them from spending the same dollar twice. 2

Old School: Centralized Database

For example: If I go to a restaurant with Mrs. Hodor and pay for it with my bank debit card, essentially what’s happened is that my bank has updated their centralized database with my purchase. Somewhere in the server that my bank controls is an account with my name on it, along with the purchase details of my transaction.

My bank doesn’t allow me to spend more than is in my account.

For each purchase I make, it deducts an equivalent amount from my bank account, leaving me with whatever remains to make further purchases. This is an efficient method of conducting a transaction. Settlement is immediate, as the restaurant communicates instantly with my bank to make the purchase. In a few seconds, the transaction is complete, and I’m on my way.

The bank prevents me from ‘double-spending’ money in my account in this way.

Decentralized Money

Bitcoin was one of the most important innovations of its decade.


It introduced the concept of a decentralized currency that didn’t depend on a centralized database. It would depend on each individual user to participate in the network and support it (if they wished) by running a ‘node’ and engaging in competitive mining. 3 Bitcoin didn’t depend on one central database controlled by one organization or individual. Instead, every node would have the same database and each of us would be responsible for keeping the database up to date.

Yes, it means duplication of effort (and the database of transactions), but it also removes the trust in one entity for updating the ledger.

This means that instead of just ‘moving ones and zeros’ around, a bank could actually send the value – the real value – to another person. The value sent would be determined by the free market of traders who buy and sell these new decentralized ‘coins’ as the early adopters called them.

This concept – and its invention of decentralized, no-counter-party digital assets – was something that the world had seen before in physical form (gold), but never in electronic form.

Cryptocurrencies like Bitcoin, XRP, and Ethereum all showed that value could be transferred without depending on one specific organization or individual to keep track of the amounts spent; we could instead depend on a network of computers that were all part of a group dedicated to validating transactions and settling them.

What is Proof of Work?

Bitcoin used a validation technique called “proof of work” to validate transactions. In proof of work, various computers compete with each other to solve a complex mathematical problem for the right to decide which transactions are included in the next ‘block’. Once one computer wins that right, they have control over which transactions are included. This computer – called a ‘miner’ – is also rewarded with transaction fees and a reward of new UTXOs (freshly minted Bitcoins). 4

A proof-of-work proponent will tell you that this approach – competitive mining – ensures positive network behavior, because it is financially rewarded. For more information about the Bitcoin proof-of-work model:

What is Consensus?

XRP uses a different method of transaction validation to prevent double spending.

In XRP, if validators agree on a transaction, then it is included in the next ledger. Validators must maintain a list of ‘trusted’ validators that they look to for reaching a majority of agreement on a transaction. The ordering of transactions is one of the central issues, and XRP validators must agree on that ordering as a key component of solving the double spend problem. 5

Once the validators agree on a set of transactions, an approved ledger is created and the network progresses to the next one. No one validator controls the network’s forward progression; it’s the entire network. The following is Ripple’s own description of a consensus round from the point of view of one individual node: 6 22

  1. Ledger is open. Servers will attempt to apply transactions they receive to their open ledger. Transactions that successfully apply will be relayed.
  2. Start Ledger Closing process. Servers will start the closing process any time they have transactions that have not gotten into a consensus ledger (or a certain amount of time passes).
  3. Servers send a hash of the transaction bundle they think should be applied to the previous ledger based on the transactions that got into their open ledger. This is called their proposal.
  4. Proposal are flooded to the network in the same way that transactions are.
  5. As each proposal is received, servers check if it's a newer proposal from a server on the UNL. If it is, they look for any transactions that server has taken a different position on.
  6. If necessary, server change positions on disputed transactions to reach a consensus. They send new proposals as necessary to converge. (The ledger close time is also converged on.)
  7. Once a consensus is reached, they apply the consensus transaction set to the last closed ledger. They accept this ledger as the new last closed ledger and send a validation message for the new last closed ledger.
  8. They create a new open ledger that follows the new last closed ledger. Any transactions that didn't get into the consensus set, any new transactions in their open ledger, and any held transactions are applied to the new open ledger.
  9. Collect validations
  10. Look at the validations from the nodes on the UNL. If the majority of nodes on the UNL back a different last closed ledger switch to this new ledger.
  11. There is now a new last closed ledger and a new open ledger, notify clients and start the process at 1) again

Keep in mind that the Ripple Protocol is only one specific implementation of the Consensus model of cryptocurrency validation. For those that wish to do a deep dive into the Ripple Protocol, you can refer to the following resources:

For those that like videos:

Halloween

Which Is More Secure?

To answer the question about which type of network is more secure, we have to look at specific implementations. If the goal is to generically answer the question, then the purpose of the discussion should be to draw high-level conclusions based on overall characteristics of proof-of-work cryptographic networks versus consensus-based models.

And to target these high-level points, we have to look at both worst-case scenarios as well as general strengths and weaknesses of each network. First let’s look at some general characteristics of the two types of networks.

POW: 51% Attack

A 51% attack occurs when the total processing power (hashrate) of a proof-of-work network is majority-controlled by one entity or group of entities. This enables them to carry the blockchain forward with transactions that may not be legitimate; i.e. transactions that would essentially double-spend units of value. 7

Although not common, it does happen; recently we’ve seen examples of this type of behavior on proof-of-work networks like Verge, Bitcoin (Gold), and Zen cash. Those are example just from the prior two months. Hashrate and validation attacks on a proof-of-work network are a very real problem, and it’s one that still exists for Bitcoin and others.

XRP Doesn’t Care About Hashrate

The Ripple Protocol, along with other consensus models, doesn’t suffer from this same danger, because it is cooperative in nature among the various stakeholders that are 1) users and 2) validators. Users only need to trust one server or validator to access which ledger is the latest ledger, so that they can access account balances and other point-in-time data. Validators can submit transactions for inclusion, and can also look at other proposed transactions.

Since each validator must define which other validators that it ‘trusts’ or looks to for assistance in validation, there is no danger from previously-unknown parties attempting to attack the network; one validator only points or defers to a limited set of other validators that they trust, so new, possibly-hostile validators are not able to disrupt the network. In over five years, the XRP Ledger has never successfully been attacked.

XRP Worst-Case Scenario?

If enough disagreement exists on the XRP Ledger, and bad actors are suddenly introduced, or if previously-trusted validators suddenly become compromised, in theory this could lead to a non-optimal outcome for XRP.

The worst-case scenario for a consensus-based network would be something akin to a fork, although David Schwartz has indicated that the worst-case scenario for the Ripple Protocol under normal conditions is more like ‘stopping the network from making forward progress’ until validators can adjust their trusted nodes list to avoid the validator that seems to be causing the disruption. It’s definitely not a preferred outcome, but it shouldn’t debilitate the overall XRP Ledger.

XRP’s protocol is fault-tolerant, and has never encountered a situation that exceeded its ability to move the ledger forward. In addition, changes related to Cobalt are speculated to result in much higher degrees of fault-tolerance than exist currently.8 9

Bitcoin Worst-Case Scenario?

In the case of Bitcoin, the worst case scenario would be an attack based on raw computing power.

That’s all that is needed to bring down a proof-of-work system; the ability to double-spend based on controlling over 50% of the network’s hashing power. Note: Some experts point out that it is possible to execute successful attacks against a proof-of-work system even with less than 50% of the hashing power. 10

In theory, if a completely hostile entity wanted to cripple or otherwise destroy a proof-of-work’s network, they could repetitively attack the network with their hashing power. If their goal is to simply steal some tokens, then they could easily accomplish it. However, if their goal was to inhibit or otherwise interfere or destroy a network, they could do that as well.

Why would an organization of miners (or some other unknown organization) do this? If you’re looking for a financial incentive, then think of the futures markets or just old-fashioned double-spending. If you’re looking for a political motive, think of black ops programs or national policy (China?).

While I would like to believe that this won’t occur to Bitcoin, there are several examples of recent hashing power attacks that have been successfully used against proof-of-work systems, including Bitcoin Gold, Verge, and ZenCash.11 12 13

Which is More Censorship-Resistant?

For ten minutes, one miner that has successfully solved the nonce-identification puzzle in the Bitcoin network now has control over which transactions are validated and included in a block. This is the nature of competitive mining, but it also provides extensive power to the successful validator. The thinking is that the miner will not do anything detrimental because it goes against their own financial self-interest; despite this, users frequently encounter miners who refuse to validate transactions if the fee isn't high enough. This is a form of censorship based on monetary rewards, and it's one reason why Bitcoin fees approached the $55 dollar mark in late 2017. 21

In XRP, the validator nodes keep a list of other validators that they trust to order the transactions accurately. Halloween

Why is ordering of transactions important? Because if there are a series of three submitted transactions, and the first two would completely deplete an account, the third one will be unsuccessful. However, if the third one is processed first, it may be declared a valid transaction, thereby ‘bumping’ one of the first two transactions into the ‘invalid’ category.

Because it’s not possible in XRP for one validator to control transaction validation, the likelihood of one entity or group being able to disrupt the network – or even re-order transactions – is very low. Here's what Ripple (user @MDUO13 on XRPChat) had to say about the possibility that a rogue validator might try to censor transactions:

"...those transactions would lose slightly more "coin flips" in the cases where they were being broadcast right around the borderline between one ledger and the next. The size of this effect is inversely proportional to the number of validators, and you could detect when it was happening by analyzing the validators' proposals."

In other words, the more nodes that actively participate in consensus as trusted validators, the less likely this is.

This is not the case in Bitcoin. One Group or individual could re-order or exclude certain transactions if they’d like. In addition, it’s possible for one group or coalition of miners or computers to launch a 51% attack to double-spend a specific amount of coins on a proof-of-work network.

Which is More Scalable?

While reading through the differences between ‘proof-of-work’ and ‘consensus,’ you might be wondering about how the validation method affects the speed of transaction processing. Both types of validation successfully solve the double-spend problem. So which method of decentralized transaction validation is more scalable?

To answer this question, you need to familiarize yourself with the speeds of Bitcoin & Ethereum (the top two POW cryptographic networks by market cap) and then compare them to XRP:

Raw Processing Speed (On-chain)

• XRP: 1,500 TPS 14
• Ethereum: 15 TPS 15
• Bitcoin: 6 TPS 16

This basic difference in transaction processing speed is very significant, and it has resulted in very real problems during Ethereum and Bitcoin’s history. Even in the case of XRP, it’s on-chain speed is not enough to scale to VISA levels of processing. So what did all of the cryptographic networks do? They developed off-chain capabilities.

Off-chain processing involves summarizing a series of transactions and then communicating it once to the blockchain.

This allows many (unlimited) transactions to be processed at unlimited speeds that are considered horizontally scalable. This is one thing that is common across all of the cryptographic networks, and you’ll see unbelievable numbers quoted when these crypto teams talk about their off-chain capabilities. Essentially, there is no specific upper limit to the amount of off-chain throughput that is possible for these networks, since only a summary transaction is processed.

For example, in one initial test, XRP reached speeds of over 50,000 TPS using its off-chain processing, known as “Payment Channels.” Likewise, Bitcoin maximalists tout their “Lightning” network, and Ethereum answers back with its “Plasma” off-chain metrics. The key thing to keep in mind is that a payment channel must be communicated back to the main chain at some point, and is thereby restrited by the on-chain core metric of settlement time.

What does this mean? It means that no matter how fast off-chain transations can process, they won’t settle at any speed faster than the on-chain speed. This means that all Bitcoin transactions still take an hour to fully settle, and Ethereum takes around fifteen minutes.

XRP does it in less than four seconds.

Settlement Speeds

Settlement is a description of the state of a transaction after completion. Settlement indicates that value has been irrevocably transferred from account “A” to account “B.”

In ‘proof-of-work’ networks, there is no concept of 100% settlement, because a subsequent block could reverse a prior block, as long as history can be completely re-written successfully with all inter-leaved blocks. However, from a practical sense, the probability of this happening approaches zero after a specific number of blocks. For the Bitcoin network, this is widely accepted to be six blocks; in Ethereum, it’s fifteen blocks.

Average full confirmation times for Bitcoin, Ethereum, and XRP:
• Bitcoin: 1 hour 17
• Ethereum: 3.75 minutes 18
• XRP: 3.75 seconds 19

XRP Reaches 100% settlement in less than four seconds, because there is no chance of reversal; once consensus is reached and a ledger is closed, it becomes the irrevocable history of the XRP network, and all current users point to the latest ledger to obtain the state of the network.

This difference means that you can purchase your coffee and by the time you’ve put your wallet back in your pocket (or purse), the transaction has settled. There is no waiting for six confirmations for an hour while your coffee gets cold.

Fees

Network fees are necessary in Bitcoin for when block rewards disappear. Eventually, all Bitcoins will be mined even at the full difficulty level; this means that miners need some sort of motivation to continue to provide their services. Fees do this job, as they are paid to validators that can process the transactions. Network fees in Bitcoin are designated by users of the network; if the user is not willing to pay enough of a fee, their transactions may never be validated – it may sit in the memory pool awaiting validation while block after block is established.

Real story: I once tried to transfer a certain amount of Bitcoin onto an exchange, but I forgot to adjust my fee. The transaction was not picked up and processed until the next day, when the network load finally made it economical for inclusion in a block.

Average Bitcoin fees have been as high as $55, and are now hovering around $2.50 or so. 20

Contrast this with XRP. On XRP, validators don’t receive any compensation for validating transactions. The only incentive is that those that run validators are stakeholders in the XRP ecosystem. In other words, those that have a financial incentive to validate transactions will do so voluntarily for the overall health of the network.

However, XRP still charges a transactions fee. But in the case of XRP, the purpose is to prevent bad actors from spamming the network with thousands of individual transactions. To protect the network from DDOS, XRP charges a very small amount for each payment. The fee is not based on the amount of the transaction, however; it is a flat fee, onto which is added a network load fee based on the current state of the ledger. If the ledger is under high usage, the fee will escalate to a higher amount. This dynamic fee scaling serves to protect ledger and network health.

What is the current minimum fee for one transaction using XRP? Ten drops. A “drop” is one-millionth of one XRP, so the current minimum fee translates to roughly $0.0000067 based on today’s XRP price. That’s 6.7 one-hundred thousandths of one cent. Even with a premium for dynamic network load, the fee is virtually undetectable for even the smallest of transactions.

Why are low fees important? Because they open up a whole world of end-user transactions to XRP that are represented by micropayments. This includes anything from a coffee at a local shop, to paying for web-based content.

Conclusion

I believe that the consensus model of transaction validation and prevention of double-spending is a logical progression from the original proof-of-work paradigm. It doesn’t require wasteful mining, and is more secure and censorship-resistant than the original proof-of-work model pioneered by Bitcoin.


While the first cryptographic network – Bitcoin – introduced the world to what was possible, consensus networks like XRP introduced the world to the realization of that promise; the usage of a no-counter-party, decentralized digital asset that can scale to global levels of utilization.

We need to help wake up the world to XRP. XRP_new1

Sources:

  1. http://satoshinakamoto.me/bitcoin.pdf
  2. https://twitter.com/XRPTrump/status/1003772708436316160
  3. https://bitcoin.org/bitcoin.pdf
  4. https://bitcoin.org/en/developer-guide#proof-of-work
  5. https://ripple.com/files/ripple_consensus_whitepaper.pdf
  6. https://wiki.ripple.com/Ledger_Cycle
  7. https://en.bitcoin.it/wiki/Majority_attack
  8. https://ripple.com/insights/continued-decentralization-xrp-ledger-consensus-protocol/
  9. https://arxiv.org/abs/1802.07240
  10. https://bitcoin.org/en/developer-guide#proof-of-work
  11. https://blog.zencash.com/zencash-statement-on-double-spend-attack/
  12. http://fortune.com/2018/05/29/bitcoin-gold-hack/
  13. https://verifiedtopics.com/strike-three-verge-suffers-third-suspected-51-percent-attack/
  14. https://ripple.com/xrp/
  15. https://etherscan.io/chart/tx https://hackernoon.com/blockchains-dont-scale-not-today-at-least-but-there-s-hope-2cb43946551a
  16. https://en.wikipedia.org/wiki/Bitcoin_scalability_problem#cite_note-3
  17. https://bitinfocharts.com/comparison/bitcoin-confirmationtime.html X 6 blocks
  18. https://etherscan.io/chart/blocktime X 15 blocks
  19. https://xrpcharts.ripple.com/#/metrics X 1 ledger
  20. https://bitinfocharts.com/comparison/bitcoin-transactionfees.html
  21. https://bitinfocharts.com/comparison/bitcoin-transactionfees.html
  22. https://developers.ripple.com/consensus.html

Did you like this post by Hodor?

Send some love:

Hodor

Hodor

I blog about Ripple & XRP. FULL DISCLOSURE: All views are my own. I do not work for Ripple; I am not a professional financial analyst, and the majority of my crypto holdings are XRP.

Read More