Open blockchains such as the Bitcoin network and Ethereum are the most secure and decentralized open ledgers in the world. However, both have scalability problems. They can process only a small amount of transactions; for Bitcoin ~5 transactions per second and for Ethereum ~15 transactions per second. When there is a high demand, people have to wait a very long time and pay huge amounts of transaction fees. Currently, on the base layer, there is no clear solution to solve this problem. It is an extremely difficult task because any solution needs to offer exactly the same security and decentralization levels, since these are the most important features in blockchain. Ethereum developers are working on a scalable version of Ethereum which is Ethereum V2, however they had to postpone the delivery time several times, because it is more complex and difficult than it was planned. Any scalability solution on the core level (on the base layer) can easily take decades. As a solution, some developers came with an idea that it is possible to create additional layers (additional infrastructure/network) on top of the base layer. Since the additional layers do not change or affect the base layer security, these can be more flexible and open to experiments. Currently, these solutions are called layer 2 (or second layer solutions). Layer 2 solution is not a single project, there are tons of different projects trying to come up with a layer 2 solution.
As you can understand, the main idea of the layer 2 solutions is to move most of the work from the main network to the second layer network. If you want to buy a coffee why would you want to use the most secure decentralized open ledger in the world, you should be okay to use more flexible networks such as the second layer networks. But let’s say you want to transfer 100 million US dollar, then you would definitely want to use the most secure open public ledger which is the base layer of the Bitcoin or Ethereum network. If we can separate these two actions to different layers, we can reach scalability.
When it comes to the open finance and censorship resistance, the second layers have to be decentralized. Just moving the transactions from the main base network (base layer) to the centrally controlled database is extremely useless, but it is actually quite common. For example bitcoin transfers between coinbase accounts are off-chain, it happens on the coinbase’s centrally controlled database. Do we call these transactions as second layer transactions ? Hell no. The second layer solutions can be more flexible and less secure but it has to be decentralized and censorship resistant, otherwise there is no point in using cryptocurrency.
Let’s jump to the real-life second layer projects. Currently, we can divide the second layer solutions into two; Side Chain and State Channel. There are tens of projects trying to implement second layer solutions using these two main methods. Here, we are not going to examine all these projects, but mentioning the most common projects would be helpful to understand these.
When developers started to work on decentralized second layer solutions, they realized that we already have a decentralized network technology, open blockchain. Thus, they decided that the second layer can be another blockchain. If the second layer network is also an open blockchain, it is called a side chain. Since the side chain is another network itself, it is possible to use more experimental technologies to build the side blockchain. Open blockchains themselves are secure and decentralized because they use proof-of-work (PoW) (most commonly), an open consensus mechanism, and they are public and permissionless. However, mainly because of the PoW consensus mechanism, it is slow. Most of the side chains do not use PoW as a consensus mechanism, to reduce block time. Therefore side chains are slightly less secure, but Plasma implementations help to solve this problem using checkpoints and “exit game” (mechanism which accepts proofs on-chain data). Matic Network created arguably the best plasma side chain and Resardis is also building its DEX on top of Matic Network’s side chain to offer users an extremely fast DEX experience. You can read more about sidechain on our side chain article.
You may haven’t heard the term state channel, but state channel layer 2 solution strategy is more popular than you think. The most popular example of this strategy is Lightning Network. State channel strategy consists of creating a channel between two parties on-chain, so the first transaction is on the blockchain and broadcasted to everyone. But what is a channel here? The channel means that both sides lock some amount of money using a 2-of-2 multisig wallet. Let’s say Bob and Alice locked 10$ each to create the channel, so they have 20$ in the channel. In this case, the state is 10$ is owned by Bob and another 10$ is owned by Alice. From now on, when they exchange money using this channel, they do not have to put the transactions on the chain, instead they just exchange the signed transactions and update the balance of the channel between them. Due to the transaction not put on the blockchain, it is instant and does not require any fee. However, it should be noted that both sides need to be online during the state update because they have to be sure that the transaction is valid. This is an example of just one channel, when all channels are connected, this is called the Lightning network. Similarly, on Ethereum chain, Connext Network is using state channel strategy to move the transactions from on-chain to off-chain.
There are two more strategies definitely deserve to be mentioned here. ZK Rollup and Optimistic Rollup are fantastic scalability solutions. Some people characterised ZK Rollup and Optimistic Rollup as layer 2 solutions, and some characterised as layer 1.5 or semi-layer 2 solutions. The main goal is the same: moving most of the transactions (or computations) out of the main chain. The security is provided by mathematical proofs that cannot be falsified. Large amounts of transactions are bundled together in a merkle tree and the proof sent to the chain. All the merkle tree calculations happen outside the main chain, therefore it is much cheaper and the system is able to handle thousands of transactions per second.