The layers of blockchain (Article 8)

A way of solving the blockchain trilemma.

Al_ref
Decentralized Innovations
5 min readMay 20, 2022

--

Photo by Chor Tsang on Unsplash

Blockchain technology suffers from a trilemma, as a blockchain has to compromise on either decentralization, security or scalability to be able to provide sufficient performance in the other two features. Private blockchains completely remove the decentralization-features from the blockchains to provide high levels of security and scalability. On the other hand, Bitcoin was mainly invented to provide decentralization, so it compromised on scalability. Following its steps, permissionless blockchains likewise didn’t compromise on decentralization; and to be able to guarantee the integrity of the blockchain, they chose security as their other priority. This meant that Bitcoin, Ethereum and other blockchains suffer from scalability issues.

Scalability concerns the number of operations and transactions that can be performed per second, the number of transactions per block, and the storage space required by nodes. Those issues limit the usability of blockchains and limit their potential as competitors against traditional centralized solutions. This led to blockchain developers starting to look for solutions, and they expanded the blockchain to 3 layers.

Layers of Blockchain

Layer 1:

The first layer is the blockchain itself and the consensus mechanism it uses. Bitcoin uses Proof-of-Work (PoW) to guarantee security and ensure trust. Using PoW as a consensus mechanism means that it would take on average 10 minutes to add a block and have the transactions within it confirmed; so if you are paying for a coffee at a café, you would have to wait 10 minutes before you can get your coffee. As discussed in a previous article, other consensus mechanisms, such as the proof-of-Stake consensus, have been devised to accelerate this process.

Batching:

Another scalability issue is transaction fees. On bitcoin and other blockchains, transactions are relatively expensive, even to the point where the fees would be higher than the transacted amount, which renders small transactions uneconomical. In the original system, a transaction on the blockchain included an input from the sender, an output to the receiver and a change back to the sender. This process had to be repeated for every transaction. To scale this process up, a sender can batch multiple transactions together with one input and multiple outputs. The original system is like paying 10 dollars to buy a coffee and getting the change back, then paying another 10 dollars to buy some snacks and getting your change back. Batching is paying 20 dollars to buy a coffee and a snack and getting your change back. Batching can save up to 80% on Bitcoin transaction fees.

Batching system vs original system

Sharding:

Another scalability issue concerns storage space required: if you try to run a full Bitcoin node — which means you keep a record of all the blocks since the genesis block — you will currently (year 2022) need about 400GB of storage space. To some, this is a reasonable price to pay to ensure decentralization. However, it is important to remember that, compared to the global population, the number of Bitcoin users is still very small. If every transaction in the world were to be recorded on Bitcoin, we would have a serious storage problem. To solve this problem, sharding has been introduced.

Sharding

Sharding means that the blockchain is divided into multiple smaller parts (so-called “shards”) that are, however, still connected. Nodes will be assigned shards at random and they will keep a copy of a single part of the blockchain. Distribution through sharding makes blockchain-storage and operation more manageable and increases transaction processing capacity. Sharding is still in its experimental phase, but it looks promising.

Layer 2:

Side-chains (frameworks or protocols):

Blockchains (or layer 1) are inflexible due to a set of rules for consensus, decentralization and security reasons. However, since not every transaction or operation requires full decentralization, side-chains were introduced, with the aim to increase the magnitude of transactions. Imagine a situation where 2 parties — for example, two companies — are engaging in multiple bi-directional transactions: company A sells petroleum product to company B, and company B uses it to make rubber rings that are used in oil rigs, which company A uses in its petroleum-extraction-machines, some components of which it then sells to company B. These two companies can settle all the transactions between them on a side-chain, and once the accounts are settled, the required payment from one company to the other is recorded on the blockchain.

Side chains

Parachains:

A second layer 2 solution is the so-called parachains, which is short for “parallel chains”. While parachains are not technically layer 2 solutions, they are included here for completeness. Parachains are parallel blockchains where transactions can be processed in parallel, hence increasing the throughput of the network. Each chain can have an independent coin and its own consensus mechanism. However, all chains are still able to communicate with each other, and the communication is coordinated through a central chain called the ‘relay chain.’ Parachains are implemented in the ‘Polkadot’-multichain protocol. Parachains capabilities and uses are explained here, and you can have in-depth understanding about their workings from here.

Parachains, Source: https://polkadot.network/blog/parathreads-parathreads-pay-as-you-go-parachains/

Layer 3:

Layer 3 of blockchain is the smart contract layer. Smart contracts are the building blocks of all decentralized applications, whether it is DeFi (Decentralized Finance), NFTs (Non-Fungible Tokens) or any other decentralized application. Smart contracts can be used to batch transactions for mass distribution. For example, after a new project launch, a smart contract can distribute token allocation to investors and buyers. Simply put, any scaling solution that is not implemented in the main blockchain, and doesn’t include a secondary side/parallel chain, is a layer 3 solution.

--

--