I’d like to put it out there that I am not a fan of onions but I love blockchains, and since both have layers I guess that’s an “agree to disagree” scenario where I have to like the feature but not the product. Seriously onions have no business in my burgers, noodles or jollof rice. I mean they should be there because they give the meal flavour but I don’t want to see them, man. Same way I don’t see blockchain layers but I know they are there.
So what is a blockchain?
A blockchain is a decentralized network that processes data and transactions over a large number of servers/computers in such a way that anyone who logs into the network can see what has been done and who did it. What makes blockchains and blockchain technology so special is the fact that there are layers to it. Blockchain technology can be applied in a handful of ways but for the sake of this article I will be focusing on cryptocurrency.
Blockchains are monstrous in size and hard to maintain because with respect to crypto, they handle thousands (maybe hundreds of thousands and even millions) of transactions every second. That is sure enough to put a strain on the network.
Imagine a body builder carrying 5 bags of rice on each arm and walking the length of a football field to and fro, every second.
Yeah. Now you get the picture.
This complexity and difficulty in processing data and transactions has brought about a problem called “scalability”; which simply means how can we make this blockchain serve a larger number of people, doing this same thing, but with ease? Layers. That's how.
Scalability and Layers
The true pain in the neck for all blockchains is scalability since they are prone to have serious bottlenecks like Ethereum’s gas fees:
or Bitcoin’s legacy wallets that sometimes hang transactions for longer periods because all other servers on the blockchain are too busy to validate a transaction. This is the bane of blockchains.
Though it is worthy of note that this is a problem peculiar to Layer 1 blockchain tech.
Now that layers have been brought up, let us talk about onions!
Blockchains are in many layers but the most popular are Layer 1 (L1) and Layer 2 (L2).
Layer 1: networks with their own blockchain, they operate within their space.
Layer 2: networks and technologies that operate ON a blockchain.
There are layer zero and layer 3 but those will require separate articles.
Moving on, the problem of scalability in Layer 1 brought about the development of Layer 2. However before that there were two solutions that proved to work at the time:
Consensus Protocol Changes: this started with the movement of blockchain networks from PoW (Proof of Work; which has to validate that the transaction was carried out), to PoS (Proof of Stake; which has to validate if any money changed hands in the transaction).
Sharding: here, a transaction is broken into shards (practically bits and pieces) and spread across the blockchain so that these bits can all be validated in parallel before joined back at the final point. Though the problem with this, as Ethereum has proven to us, is gas fees. Vitalik, we need oxygen. 😢😢😢
So, how does L2 help L1 do its job? Layer 2 networks handle the load of processing transactions for Layer 1 and as a result, decongests the number of transactions that happen per interval on the main blockchain. That way our body builder (as mentioned earlier) gets to carry the total of ten bags of rice in a pick up truck with four-wheel drive. Easy, fast, and maybe affordable. Want some examples?
(L1) Bitcoin; (L2) Lightning
(L1) Ethereum; (L2) Raiden Network
*pause for dramatic effect*
What if I told you that there are other Layer 2 solutions that serve many other purposes other than onchain-to-onchain transactions? Well here they are:
Nested Blockchains
These are blockchains that have a series of parallel layer 2 networks, serving the base blockchain. The way they work is that when the base blockchain delegates a transaction or action to the sub-chains in its layer 2, these sub-chains take care of it and then return all data back to the base once it has been completed. Onions, right?
State Channels
State channels enable peculiar transactions from onchain to offchain. Where a transaction takes place between a party that is on the blockchain and a party that isn’t. This process is enabled using programmable data that validates and upholds transactions, known as smart contracts. A good example of this is Ethereum’s Raiden Network, which is a standalone L2 network as well. Fantastic stuff right there!
Sidechains
Hybrid blockchain networks; they are a combination of layer 1 and layer 2 though instead of acting like a standalone L1 or L2, they function more like an extension of the base blockchain. Think of it as your arm having an arm. They are, and rightly so because they are great for large transactions so if you are not moving over 20 BTC at once, you may have no business using networks like xDai which an Ethereum sidechain.
To close this off, I still do not like onions—or at least I don’t enjoy seeing them in my meals. But I do think blockchains and onions have layers in common therefore as a result, haha I think onions are cool.
What do you think?
I found this article very helpful and insightful. Thank you