Sidechains and 2-way Pegs

Sidechains, 2-way pegs in blockchain

The major issue with bitcoins today is the difficulty to scale.

Secondly, the world’s most popular cryptocurrency Bitcoin was created for cryptocurrency trading. However, with increased popularity, there is a demand to have systems or platforms that will enable transfer of assets through bitcoins. These platforms need to be scalable while still retaining the trustlessness and decentralized nature of the blockchain.

How do you go about it? Using 2-way pegs!

Understanding 2-Way Pegs

When you have to transfer coins between two platforms dealing in different cryptocurrencies, we have a problem at hand. 

Suppose, one blockchain deals in bitcoins while the other blockchain deals in ethers. When a transfer of coins is initiated, there is no way to know the authenticity or verify the balance in the other blockchain. So in reality, coin does not get transferred in between blockchains.

Instead what happens is called a 2-way peg. This means that coins in one blockchain platform is locked up and the equivalent amount is unlocked for the user to utilize in the other blockchain platform.

For our example, bitcoins will get locked up while equivalent amount of ethers will be released to the user for use.

Similarly, if ethers in one blockchain have to be transferred back to bitcoins in the other, ethers will get locked while equivalent amount of bitcoins will be unlocked.

Two most widely discussed and implemented 2-way pegs are – 

  1. Sidechain
  2. Drivechain

In this lesson, we will discuss and learn more about sidechains.

Understanding Sidechains

Sidechains provide features to build scalable solutions at a cheaper price.

What is a Sidechain?

A sidechain is a blockchain that is linked to the parent blockchain (also called parent chain) via two-way pegs. Sidechains are also called as childchains.

Sidechains make the implementation of smart contracts possible in bitcoin which otherwise would only be a cryptocurrency platform.

Basically, it provides a way for bitcoin users to move their coins to a non-bitcoin (blockchain) platform with different features for transaction (buy/sell goods and services). The secondary blockchain thus opens a door to let bitcoin users use the features on its platform.

The following diagram shows a very simple architecture involving a parent chain and sidechain.

sidechain blockchain
Simple Sidechain architecture

It is important to note that no bitcoins are created by the sidechains. They are all originating in the bitcoin main net. So the total number of in-supply bitcoins always remain constant.

How do Sidechain Works?

The following steps are followed to make a sidechain work – 

  1. User on the parent chain or parent blockchain send funds (cryptocurrencies) to an output address
  2. Once the funds/coins reach the output address, they get locked. This means the user will no longer be able to use these coins
  3. Communication is sent from the parent chain to the sidechain and a waiting period is initiated. This is a measure to increase security and is taken care of federations. Federations are group of servers to decide on when the user’s coins will be locked and when they will be unlocked. In a way federations act as a layer between the main blockchain and sidechain
  4. When the waiting period is completed, equivalent value of coins are released on the sidechain which the user can utilize

Conversely, when funds need to be transferred from the sidechain to the parent blockchain, the opposite happens. The coins from the sidechain is released to an output address and a waiting period is initiated. Once the waiting period is over, the coins are released in the main or parent blockchain which the user can utilize.

It is important to note that coins released in sidechains are equivalent to the number of coins locked up in the output address based on the exchange rate.

For example, suppose the main blockchain or parent chain uses bitcoins and the sidechain uses Ethereum coins (ethers). The exchange rate is set to 1 bitcoin = 5 ethers. Now if a user transfers 6 bitcoins, and this amount gets locked in the output address; once the waiting period is over, 30 ethers will be released to the user on the sidechain.

Security in Sidechains

Security is a very important aspect of blockchain-based systems. Sidechains are in themselves secure. This is because if a failure happens on the sidechain, it does not affect the main blockchain or parent chain.

Advantages of Sidechains

The most important advantage of sidechains are that they allow interaction between different cryptocurrencies.

For example, you can use your bitcoin wallet to buy a new mobile phone on a platform that allows only Ethereum coins. 

Secondly, sidechains provide flexibility to launch beta versions before a full launch on the main chain or parent blockchain. 

Imagine a scenario where you want to launch a major feature to your cryptocurrency but in spite of all the testing, you are not 100% sure and confident of whether it will work fine once a hard fork is done. To be more confident you can launch a sidechain to check whether the feature functions as expected. Once satisfied, you can do a fork on the parent blockchain.

Disadvantages of Sidechains

While federations provide an enhanced security layer between parent chain and the side chain by deciding when to lock and unlock coins, it is also vulnerable to threats and attacks.

As you have seen, to help the blockchain scale and grow and become really useful to how complex businesses are set up and run, sidechains cannot be ignored. Sidechains enable faster transactions, lower transaction costs, allow greater scalability, thus bringing about significant improvements in the blockchain.

Sidechains can prove to be very promising to the future of blockchains.

Read More: Watch this video on Bitcoin Sidechains and SPV Proofs for more technical details

Sidechains and 2-way Pegs

Leave a Reply

Your email address will not be published. Required fields are marked *

Scroll to top