Consensus Protocols

Consensus protocols are required in trustless and distributed environments in order to allow actors to reliable transact with one another. A consensus protocol should result in at least the following three conditions:

  1. An actor that discovers the next block in the chain should be incentivised to broadcast it over the network and not hold it
  2. Actors should be discouraged from discovering blocks on top of intermediate chains (i.e. forks that are not the longest)
  3. The protocol should be able to resolve forks

Consensus protocols should try and make the cost of attack higher than that of defence in order to provide a defender’s advantage in maintaining the network. The most obvious costs are economic and these are relatively easy to evaluate. However, economics is not everything and in reality actors will often be influenced by their own moral and ethical viewpoints. In addition, there are always communication inefficiencies across a network. This means that in most cases the costs of an attack will usually be higher than the nominal economic incentive structure would otherwise imply. More secure protocols will make the differential cost between attack and defense as large as possible and implement multiple layers of defense.

All consensus protocols have benefits, costs and limitations. For example, PoS requires actors to invest in the cryptotoken whereas PoW requires them to invest in the network. As such, one would expect PoW systems to have a larger network with higher capacity and more liquidity then an otherwise similar PoS system which would be expected to have greater price stability.

The best protocols are ones that can work under a variety of conditions and assumptions.

PoW vs PoS

Proof of Work (PoW) and Proof of Stake (PoS) are probably the most popular consensus protocols currently but differ markedly in their implementation and outcome.

PoW was developed primarily as a method for deterring actor vectors, in particular double spending, on a distributed, decentralized network by making such attacks extremely expensive to carry out. It is based on a computational expensive mathematical problem that needs to be solved. In the expansion phase of the cryptotoken, miners are paid rewards for solving the problem associated with each block. Miners on the network then compete to be the first to find the next block and claim their reward.

PoW protocols work on the basis of energy expenditure in return for potential rewards. However, this is resource expensive and in principle the cost of attack and defense are at a 1:1 ratio with no defender advantage for the network. PoS relies on potential penalties and ensures the security of the system by making actors stake economic value in order to participate.

In PoS systems the creator of a new block is chosen in a deterministic way based on the number of cryptotokens the actor is willing to stake on the network. No block rewards are given for creating a new block, but instead, the creator of a new block is able to charge transaction fees. The fact that computational expensive work does not have to be done in PoS systems makes them several times more cost effective than similar PoW systems.

The costs of mining (hardware, electricity, maintenance, etc) are paid for primarily with fiat currency in the local country where the miner is based. This constant requirement for exchanging the miners earnt cryptotoken to fiat in order to pay these expenses leads to a constant downward pressure on the value of the cryptotoken.

CriteriaProof of WorkProof of StakeComment
Cost of attackHigherLower
Distribution of blocksBased on % of total network hash power Based on % stake of total cryptotokens staked
ConsensusObjectiveWeakly subjective In PoS a node needs a recent state, network messages and protocol rules to determine current state of the network
VulnerabilitiesDoS, Sybil attacks and selfish miningBribe attacks

Proof of Stake (PoS)

Proof of Stake (PoS) is a consensus algorithm for public blockchains designed to be less expensive than Proof of Work (PoW) whilst still being able to achieve high degrees of security and reliability. It was first developed by Sunny King and Scott Nadal in 2012 as a method to address the increasing energy cost of PoW networks.

Whilst there are a number of implementations of PoS the general principle is that actors participation in a network is dependent on their economic stake in that network. The more cryptotokens the actor is willing to stake, the more control over the network they will have, but at the same time, the greater their potential loss should they try to corrupt the system. It gives cryptoeconomist greater control over the asymmetric risk and reward structures for various actions by allowing them to explicitly design the penalties for adversarial behaviour.

In PoS networks, a miner who creates a new block has to trade in old coins to get new ones. However, the protocol prefers miners who have held a lot of coins for a long time so a miner that has just created a block has a lower chance of creating the following block.

If implemented correctly PoS has two main advantages over otherwise similar PoW networks:

  1. It does not waste significant amounts of energy
  2. It can process transactions much faster

However, there are a number of issues with Proof of Stake networks that need to be considered carefully, including:

  • How to initially distribute the cryptotokens amongst actors
  • The potential for increasing monopolisation – the rich get richer
  • The potential for 51% (by stake) attacks
  • The potential for nothing at stake attacks and how to resolve forks
  • The potential for long range attacks

Handicap Principle

This idea stems from applying game theory to observations of animal behaviour.

When two actors would benefit from cooperating they need to be able to signal good intentions to one another in a believable way. One way to do this is for the signaling actor to impose a constraint on themselves that would make it very costly for them to cheat.

Nonce

Nonce stands for nonsense number and is a short string of meaningless data. It is used to adjust the difficulty in Proof of Work (PoW) systems. In such cases miners have to search for the right meaningless string such that the block as a whole satisfies the difficulty set by the number of leading zeros required in the hash of the block. Since hashing is a one-way function there is no easy way to find the correct nonce. Instead, miners try random nonces until they find one that works.

Pooled Mining

Consider a steady state scenario in which there are many miners with a constant hash rate and a constant PoW difficulty. In this case, any single miner will have to be constantly expending real world resources but may expect to wait on average a very long time before receiving a block reward.

Therefore miners often decide to work together in order to combine their hash power and then receive partial block rewards more frequently in an effort to smooth out their cash flow.

Different mining pools operate on different terms depending on how hash power is directed and rewarded and a number of different schemes and approaches exist.

The presence of mining pools results in some interesting game theory. The first thing to note is that mining pools are a form of centralization. Whether or not this is viewed as problematic depends very much on the protocols and independence of the miners in a given pool.

It is also the case, that theoretically, if more than one mining pool exists, it would potentially make sense that the stronger pool attacks the weaker pool. The only real defense against this happening is the potential to harm the underlying value of the cryptotoken (thus undermining the purpose of doing the attack in the first place) and the mining pools believe in the given blockchain.

Difficulty

To find an input whose binary hash value begins with 10 zeros you would have to try many potential combinations with each combination having a 1 / 210 probability of being suitable. In other words, to find an input that gives a hash value beginning with 10 zeroes you would, on average, need to try 210 inputs.