What is a layer 2?
If you have been active in the blockchain
world for a while, you might have seen the term "layer 2" pass by. It is a term used to describe a specific part of blockchains and is often technically difficult to understand. In this article, we explain in a simple way what layer 2 is, and whether there are other layers (and what the difference is).
What is a blockchain?
To understand what is meant by layer 2, it is important to first understand what a blockchain is. Fortunately, with the explanation below, that is easier to understand than you might think.
A blockchain is a large network of computers that are connected to each other. These computers store all sorts of different data. You can therefore compare them to large servers that hold a database.
Someone can make use of the blockchain by sending a request to the network. For example, to transfer one bitcoin. The user sends this request to the network, and the network makes sure that every computer sees this transaction.
The computers on the network will try to process this transaction as quickly as possible. When processing, one of the things they look at is whether someone has enough money to be able to transfer a transaction. The computer that finishes this check first gets to put the transaction in a block, and the block is then stored on all computers. Thus, everyone in the blockchain network knows that a user made this transaction, and cannot make the transaction again in the future (after all, the Bitcoins have already been spent). Creating a block can be simply compared to a text document that you place in a folder, and then this folder is stored on all computers.
What is meant by the scalability problem of a blockchain?
It is quite often said that blockchains have scalability problems. This means that the blockchain can no longer handle the number of transactions. Nowadays, there are so many transactions that the blockchain cannot process them all, which creates what is known as network congestion.
Think of a highway on which traffic jams occur because there are not enough lanes. The highway can be compared to a blockchain on which network congestion occurs. There is not enough room to process all the transactions, so there is a traffic jam. People who want to make a transaction have to wait longer before it is completed, just like in a traffic jam on the highway.
What do we mean with layer 2?
Layer 2 is the name of an application, framework or protocol that runs on top of an already existing blockchain. A framework or protocol is another name for a piece of software, also called computer code, that has a specific purpose. In this case, the purpose of such a framework or protocol is to solve a problem that the blockchain is facing, which is usually about the scalability of the blockchain.
For example, there are many layer 2 protocols for Ethereum's blockchain
. This blockchain is known for its problem with scalability. In the past, the makers of Ethereum never expected the blockchain to be used so often. The increase in popularity grew much faster than the development of the blockchain. As a result, the technology fell behind
Why are layer 2 protocols needed, and can't blockchain solve the problem themself?
You may be asking yourself why it is necessary to write a new piece of code, and then place it on an already existing blockchain. Surely it should be possible to set up the blockchain in such a way that the problem no longer occurs?
It is indeed possible, but it is quite difficult to implement in practice. A blockchain consists of a network of thousands of computers. These computers all have a program running, which makes them participate in the blockchain.
To update a blockchain, an update must first be sent to all these machines. This is not difficult. The hardest part is in the fact that these computers must perform the update. In fact, the owner of a computer may also decide not to do so, for various reasons.
For example, an update could cause the owner to make less money for the same work he does. This was the case with Bitcoin's SegWit update. Many miners did not implement the update because they were going to receive a lesser reward for their work.
Therefore, it sometimes works better to build a new protocol separately from the existing blockchain, so problems can be solved with a workaround and without needing the help of an entire network.
What is the difference between layer 1 and layer 2 blockchains?
With layer 1 we mean the blockchain itself, in its original state. For example, consider Bitcoin
, Ethereum or Ripple
. These are all three blockchains with their own network of computers. They also all work in their own way and independently of each other.
Not every crypto project is a layer 1 blockchain. In fact, there are many cryptocurrencies that use a layer 1 blockchain. For example, it is possible to develop an application on the blockchain of Ethereum, which we also call a dApp. The application then runs on a layer 1 blockchain, because Ethereum is the blockchain it happens on.
Layer 2 protocols, frameworks and applications run on a layer 1 blockchain. They allow the layer 1 blockchain to do its job better, by solving or taking certain processes out of its hands.
Blockchains are very popular, and they are therefore being used more and more. This can cause the blockchain to sometimes not be able to handle all the traffic, making it take a long time to process a transaction. Updating the blockchain to improve speed is easier said than done.
There are special layer 2 protocols, frameworks and applications built on top of the layer 1 blockchain to make it easier and to take care of scalability issues through a workaround.