Imagine cooking biryani at home. There can be multiple ways of making it. Either you could take the meat, rice, spices & flavors all together in a cooker and boil them. Or you can take multiple vessels and cook the meat separately, boil the rice before and spice it all up together at the end. If the timing of all this is right, the end product will be much better than boiling all together.
Now I know that is kinda confusing & you may think we are going slightly off topic but trust me sidechains are not much different than this. In our example, we outsourced cooking the meat & spices on a separate vessel.
What are Sidechains?
Sidechains are separate blockchain that is connected to another blockchain through a two-way peg. This two-way peg helps to process some of the data to & from both the chains.
What is a Layer-2 Scaling Solution?
Let’s be honest, there are problems with main blockchains be it in terms of speed, transaction fees & security. Layer 2 is a secondary method to make things faster for people.
Sidechains try to replicate some of the things that the main chain tries to do but with enhanced speed and transaction costs. But it comes with a trade-off in terms of decentralization. You guessed it right. Sidechains are more centralized when compared with the main blockchain.
But this trade-off is okay for most users since we are giving away some security for a far higher TPS. Remember, Sidechains are responsible for their own security. It is a separate thing from the main blockchain.
Also, Sidechains need their own miners and validators since they can have their own consensus mechanism. They are free to use Proof-of-Stake or Proof-of-Work whichever the developer team prefers.
Validators or miners earn rewards in a sidechain in the exact same manner as all other blockchains work.
This thing can be a little technical to understand but I will try to break it down as simply as possible.
This term means people can mine or validate two blockchains at once and earn double the rewards with the same amount of work. This is also possible in a Sidechain.
Two Way Peg
Tokens are pegged while being transferred to and from a sidechain to the main chain or vice-versa. There are two parts to this process of locking up and releasing.
What is Locking up?
When tokens are moved from the main chain to the side chain, you’d have to lock up your token else there could be multiple tokens just floating around basically double spending will start otherwise.
Locking up on the mainchain means the token will be taken to a wallet or a smart contract controlled by code or a machine which then issues new coins on the sidechain.
The new coins issued are the same thing as on the main chain but this process allows the back and forth movement of assets without manipulation in between.
What is Releasing?
When coins are locked on the main chain, the protocol issues/mints new coins on the sidechain. They are representations of coins on the main chain.
You are free to withdraw coins from the sidechain to the mainchain whenever you want.
Now back to our example at the start.
If we did all the transactions & data processing on the main chain it would get super congested and packed up, similar to cooking with all ingredients in a single vessel. It wouldn’t work well with proper efficiency.
On the contrary, if we split it up into multiple vessels, each having different purposes it would be a bit more centralized but would allow many more transactions which would allow the network to scale.
When users want to move their funds on the main chain, they basically have to go through the locking & releasing mechanism and the protocol would release the funds.
In simple words, it is a technical term for the middleman who is in charge of locking & releasing the funds whenever it is required. Most of the sidechains don’t need any physical federation and it happens mostly using code but many do since they can be useful.
The job of the federation is to make sure whatever is locked up on the main chain is present on the side-chain. This way the side-chain has never more tokens in value than those which are locked up on the main chain.
In fact, many people consider this as a huge risk of centralization between moving funds back & forth across chains.
Rootstock or RSK is a sidechain to Bitcoin. Since Bitcoin could not support smart contracts initially, a sidechain called Rootstock was formed. Rootstock is a sidechain that allows the usage of smart contracts.
Rootstock federation is made up of the biggest 25 exchanges out there and they have created a Bitcoin bridge where users can transfer their own Bitcoin to Rootstock Bitcoin versions so that people could build smart contracts on the network.
It is very similar to ethereum but is made for Bitcoin.
You can run Smart Contracts, you can use Gas, and can program an entire protocol using the platform.
How can we conclude this article without mentioning the biggest sidechain of Ethereum?
Ethereum is known among people for its super high gas fees. Just a couple of weeks back, you had to pay $20 in fees to send $1 to your friend on ethereum. That is because Ethereum can only make around 30 Transactions every second and everyone is bidding against each other in terms of network fees.
Polygon can process around 65,000 transactions every second and the fees are less than a penny. The native token of Polygon is called Matic and it can do everything just like the Ethereum network in a much faster way.
The block time on Polygon is 2 seconds compared to 10 seconds on Ethereum. People can move assets from the Ethereum mainnet to the Matic network using the Matic Bridge it takes less than an hour.
It is one of the widely known sidechains because of its mass adoption among users & scalability among users.
Sidechains are permanent solutions that are difficult to change once they are out there in public. In this article, we have covered mostly everything which you need to know about Sidechains. I hope this article was helpful for beginners.