Robustness of a Blockchain

In this article, we look at various exceptions that may occur during the process from when a transaction is executed to when a new block is formed and how they are resolved.

Table of Contents.

  1. Introduction.
  2. Mining.
  3. Double Spending.
  4. Summary.
  5. References.

Introduction

As we now know, cryptocurrencies offer a new form of exchange that does not involve third parties. This also means that trust is to be established between the participants of the blockchain.

Trust in a blockchain such as Ethereum not only involves the execution of transactions and smart contract successfully but also the ability of a blockchain to manage exceptions. A blockchain is said to be robust if it can handle exceptions gracefully and satisfactorily. Managing exceptions is very important for a blockchain since it is not monitored or controlled by a third party. In this article, we look at various exceptions that may occur during the process from when a transaction is executed to when a new block is formed. We will also learn how the Bitcoin and Ethereum blockchain networks handle such exceptions.

An example of exceptions that occur in the event that more than a single miner solves the consensus puzzle at the same time, is how is the reward distributed? who gets to create a new block. Another common exception is the event that multiple transaction references as inputs more than a single asset (double spending).

Handling these exceptions will further improve the trust and security of the blockchain.

Mining.

The first exception involves two miners who solve the protocol puzzle at the same time or at close times to each other. How will a blockchain handle such a situation? Will both miners be rewarded, what about the created blocks. In this section, we look at how the Bitcoin and Ethereum blockchain handles these scenarios.

First, we have three blocks in the blockchain to start;

bit145-1

Thereafter, two miners compete to solve the specified puzzle by the protocol, and two new blocks are created as shown above leading to a chain split;

The bitcoin protocol supports a chain split which is where a chain is split into two chains as shown above. Each of the chains will be led by the competing blocks. The probability of such an event occurring again in both chains is drastically reduced.

Between these two competing miners, the one who wins the next block creation cycle consolidates the other chain.
bit146

In this case, if the upper chain wins the next round of the right to mine the next block, it will consolidate the lower, and if the lower chain wins the next round it will consolidate the upper chain. In the end, we will have a single main chain with the most cumulative proof of work.

bit147

These new chains will form the longest and most valid chain. Transactions of the upper blocks for Miner A are returned to the pool of unconfirmed transactions.

In the case of Ethereum, when two miners solve the puzzle at the same time and two blocks are generated, a single block is selected and the remaining is also incorporated into the main chain, this leftover block is referred to as an ommer block. These are similar to bitcoin orphans but are used, unlike their counterparts. Also, the miners who solved the puzzle are incentivized with a small token even if they missed time by a few seconds. This ensures the network stays secure.

Double Spending.

Consider a scenario where we have 1 BTC and create two transactions to purchase a single asset. In such as case both transactions are forwarded to a pool of unconfirmed transactions. The first is approved and validated and added to the corresponding block, the second on the other hand is rejected and is not verified. When we pull both these transactions, the first will have a higher number of confirmations and therefore is included in a block of the blockchain.

Usually, blockchain participants wait for a couple of transaction confirmations, this way they can make sure the transaction is valid. The tactics discussed here work as expected but they don't address the situation whereby a party controls 51% of the network. In such a case double spending is very possible, the biggest benefit of public blockchains such as Bitcoin or Etherium is that such is prevented as anyone can join meaning gaining a 51% stake becomes very difficult and expensive.

On Etherium double-spending is prevented by the use of a combination of the account number and a global nonce. Each transaction initiation makes sure that a global nonce is included in the transaction, after the transaction, the nonce(number used once) is incremented. In this case, it is only used once. The timestamp and nonce are unique and are verified to prevent double-spending on Etherium.

Summary

The probability of the main chain splitting is usually very low. But when it does, Bitcoin protocol has established protocols to consolidate it into a single chain within a cycle.

Double spending in bitcoin is prevented using the PoW(Proof of Work) consensus algorithm. Miners are responsible for maintaining the network and also preventing double spending on the blockchain. In case of multiple transactions referencing a single asset, the network validates and verifies the first and reject all subsequent transaction to the same asset.

A blockchain that can handle exceptions is considered robust and trustworthy.
On Ethereum ommer miners also receive incentives to ensure network security.
Double spending involves the reuse of digital assets intentionally or inadvertently more than once.

References

Redefining Trust