A few days ago, we started this series of articles focusing on the basics of Blockchain technology.  Do not hesitate to check the first article in the series:

Understanding Blockchain – Part 1 – Basics

Today is aimed at answering the questions raised in this previous article, namely about

  • block creation at node level,
  • validation of the block by the network (reaching consensus), and
  • adding the block to the chain.

Impact of fees on transaction selection during block creation at node level

As previously described blocks containing new information are continuously added to the chain. Blocks are usually of a predefined size (currently 1MB in the case of Bitcoin) and are first validated and then added to the Blockchain when enough transactions have been gathered to fill an entirely new block. As we are dealing with a peer-to-peer system each new transaction made is broadcasted to the complete network by its originating node. Due to the topology of the network, different nodes will receive the notice of the transaction at different times with the nodes the furthest away receiving it last. Hence each particular node starts building its own version of the next block by stacking the information related to all the transactions as it receives them. It is then a very real possibility that a transaction made after another one (in terms of timestamp) may be included in a later block depending on how the information gets distributed through the network. In order to mitigate this most Blockchain implementations introduce some sort of prioritization mechanism.

This is where transaction fees become important. Fees are collected on new transactions by nodes running the network for maintaining it (the same way credit card processors collect fees from merchants for providing the payment service). In the case of Bitcoin (and other blockchains such as Ethereum), the network takes this approach to the next level by allowing for varying transaction fees. The aim of the system is to propose a way for transactions that require a quick validation (e.g. for high amounts or time sensitive matters) to pay a higher fee to jump in front of the line. A node receiving notice of a new transaction will be more likely to include it in the next block if it pays a higher fee. As the fees are supply and demand based, the higher the traffic, the higher the fee for any transaction, but certainly those to be prioritized.

The impact of transaction fees has become an important subject of discussion as the rise in popularity of Blockchain applications has created massive network congestion leading to elevated competition between transactions. For example, in the case of Bitcoin, fees per transaction reached an all-time high in the $30-$50 range in late December / early January and are now back to an average of around $1.50.

Bitcoin average transaction cost - Source: Bitcoinfees.info
Bitcoin average transaction cost – Source: Bitcoinfees.info
Source: Bitcoinfees.info
Source: Bitcoinfees.info

The fees vary significantly from one chain to another but are not negligible:

  • BTC : $1.50
  • ETH : $0.40
  • DASH : $0.40
  • BCH : $0.05 – $0.10

If we look at the fees as a percentage of transacted amounts, we are now in the 1.50% area for Bitcoin, 1.08% for Ethereum and 0.07% for Bitcoin Cash. These figures are not particularly small and some range around the same charges as for current conventional payment processors (e.g. bank wires, credit card fees…), at least for the case of BTC. Dealing with network congestion with the ultimate goal of reducing fees plus speeding up transaction acceptation and validation has been a hot topic in the community for the longest time and different possibilities are being explored. While developers of Bitcoin (and derivatives based on Proof of Work) are working on greater process efficiency (introduction of lightning network for example), others have taken a more radical approach building completely new Blockchains using different validation mechanisms (Monero, Cardano, Ripple, NEM …). Their different approaches will be discussed in a follow-up article.

Block validation & consensus

Transaction fees only play a role on prioritizing transactions at the node level. The second problem faced by distributed chains revolves around block validation and acceptance at the network level (reaching consensus). In a setup where multiple nodes come up with their own proposal for the next block up for validation some form of consensus has to emerge between them to agree on which block to confirm and add to the chain. An innovative solution to this problem was published in the initial Bitcoin whitepaper under the name of Proof of Work (PoW).

Original Bitcoin whitepaper

Under PoW each node will try to solve a computational intensive problem involving their freshly created block. Having no analytical solution, the problem can only be solved by trial and error (brute force). In this process all nodes are competing against each other to find the solution for their block first. The winner validates the new block which is added to the block chain and is rewarded with coins. To better understand how it works, let’s have a closer look as a block structure in the case of Bitcoin.


Bitcoin block structure – Source: Original Bictoin whitepaper

Block structure:

  1. Each block starts with the hash of the previous block. A hash is a digital signature of the information contained in the previous block after a function (i.e. the hash function) has been applied to its data. Hash functions have a few particularities: They generate output in a given format (specifically in terms of bit length, usually 32, 64, 128, 256 … bits), and they are built in a way that makes it very difficult – if not impossible – to find the reverse function that allows to find the original input data from the hash value. Finally, their output is highly sensitive to input data in a way that even a small change in the input will generate a vastly different output. Many types of hash functions exist and the one used by Bitcoin is SHA-256.
  2. As a second part, the block contains transaction data in a unified format.
  3. Finally, a number called a ‘Nonce’ is added to the block and its calculation is described below.

Up to this point a full block has been built but it has not been validated, yet. For a node to claim a valid block the data structure of the proposal must satisfy one condition: The digital signature (i.e. the output of the hash function) of the block taken as a whole has to be equal to a predefined value (zeros in the case of Bitcoin). With the Nonce being the only outside variable in the block data one can only arrive at the proper signature by changing the value of the Nonce which varies the hash function input. Because hash functions cannot be inverted, the only way to find the proper ‘Nonce’ is trial and error (aka brute force). When the node finds the proper Nonce value, it broadcasts the proposed block to the whole network. Other nodes can verify that the Nonce is correct very easily and will accept the block (also after checking that the hash of the previous block is correct).


Block validation algorithm


Once accepted, nodes will start working on the next block and so on. Because PoW is computationally intensive and nodes are using resources to run it (mostly electricity) the network rewards the winning node with freshly minted Bitcoins (hence the term ‘mining’). In order tokeep the average block creation time constant (about 10 mins for BTC), the network automatically adjusts the difficulty of the problem as a function of the number of transactions being processed and total computing power.

Advantages and disadvantages of mining

On top of providing a way to validate a new block (first node solving the hash problem), PoW also adds a strong degree of security to the chain. Indeed, if a corrupted node were to send a false version of the Blockchain (with changed account balances for example), then it would have to submit a ‘valid’ block proposal. This proposal would include the proper Nonce of the current block but it would also have to include the proper hash signature of the previous block. By way of recursion, this means that the node would have to rebuild (mine) valid blocks from the genesis to the current block and while this node would be working on this, the rest of the network would move forward, making it impossible to succeed alone. Theoretically, it is possible to rewrite a completely different Blockchain but this would require taking over more than half the processing power of the network (known as a 51% attack) and especially as the network grows it becomes less and less feasible and overall unlikely. Still, there are on-going concerns in the community due to the current consolidation movement in mining power around a few very powerful pools.

PoW (mining) has also drawbacks. Here are the main ones:

  • Scalability issue: Because blocks have a given size and target mining time, the network cannot scale easily to process an increasing amount of transactions. A few options are being explored to mitigate this issue (increasing block size that led to Bitcoin Cash, moving data out of the block like is the case for SegWit, or processing some transactions away from the chain like done by Lightning Network).
  • Environmental issue: PoW is criticized because nodes are burning resources finding the proper Nonce. The power consumption of the network is reaching unsustainable levels and the PC parts market is being disrupted (the price of GPUs has been increasing continuously over the course of the last year while availability keeps dropping).
  • Concentration issue: The success of the mining process (hence its return) is very random by design. This led to nodes pooling their resources together to increase their chances of finding the next block and sharing the profits. It also led to the creation of dedicated mining hardware (‘ASICS’) making it impossible for individual nodes to compete. Many in the community see this as the complete opposite of the vision depicted in the initial Bitcoin paper, calling for a truely decentralized system. This concentration trend could also make it easier for a 51% attack to succeed.

Different solutions have been envisioned to deal with the above issues and will be the subject of the next article.

Leave a Reply