Sebastian Guła
5
min read
Last Update:
March 27, 2023

Sometimes the technical specification of chosen blockchain doesn’t align with the needs of our project - the waiting time for the confirmation of a block might be too big or it can be too expensive to process all the data on-chain. That’s where sidechains come to the rescue.

In this article I’m going to explain:

  • what are the sidechains,
  • how do they work,
  • what are some examples of their applications.

To understand this concept it is necessary to have some basic knowledge about blockchains and smart contracts.

What is a sidechain?

Sidechain is a separate blockchain that acts as an extension to the parent blockchain, often referred to as the mainchain. To create a sidechain it is necessary to introduce an off-chain process that will propagate the data between both blockchains. This will allow for the transfer of the assets or synchronization of any kind of data between the blockchains.

What is a sidechain in blockchain technology?
                                                   

The procedure of synchronization requires us to pass the information between blockchains in a form of events. In the above infographic, we can see the process of transferring the funds from one blockchain to another. To initiate the procedure the user has to lock the funds, which can be done through a transaction to a smart contract. The smart contract will emit an event, which will be picked up by the off-chain process, which observes the blockchain in order to find such events. The off-chain process will take care of that event and create a transaction that will pass the information to the smart contract in the opposite blockchain in a form that will allow for the verification of the event’s validity. After verifying the validity of the event the smart contract in the opposite blockchain can release and transfer funds to the user. This operation can be done in both directions, allowing us to use both the mainchain and sidechain interchangeably.

The off-chain process can take various forms and in this article, we’re going to discuss two commons variants.

  1. In the first one, a gateway oracle will use its private key to sign the information about the deposit and forward them to the smart contract in a target blockchain.
  2. In the second, a more decentralized variant of the off-chain process, any interested third party can pass the information about its transaction along with the block headers, allowing the smart contract to check its validity.

Each one comes with its own risks that I’m going to discuss in the further section of this article and they both can be combined and even optimized. It is worth mentioning that it is possible to mimic the functionality of sidechain through the use of multi-signature wallets, where instead of communicating with the smart contract a group of trusted validators can simply sign the withdrawal transactions. It is subject to discussion whether such a solution could be called a sidechain.

Possibilities of a sidechain

Sidechains can greatly expand the possibilities of our application, allowing us to integrate it with many different kinds of blockchains and cryptocurrencies. If the mainchain doesn’t suit the needs of our application we can simply allow the user to transfer the tokens to a  customized sidechain and execute all the business logic there. If we want to develop an application that supports multiple cryptocurrencies then moving logic to the sidechain can save us a lot of work that would be necessary to replicate the same functionality across cryptocurrencies that don’t use the same type of smart contracts. This also brings us a reduction of transaction fees on the mainchain, as we only need to store the logic responsible for communication with the sidechain. Sidechains can use different consensus mechanisms, have a different block time and features without the need to introduce any changes to the parent’s blockchain protocol.

Risks of using sidechains and mainchains

The security of funds that are locked in both the sidechain and the mainchain depends on the security of the weakest point of the whole process. The attackers might target the mainchain, the sidechain or the off-chain process. Relying on the gateway oracle without additional security checks might put the funds at risk of forgery. Even if we introduce additional security checks the gateway oracle could simply withhold the transaction, unless there’s more than one oracle and we can assume that they don’t have interest in withholding our transaction as a group. A third party capable of creating blocks could mint a block that is separate from our mainchain or sidechain and trick the smart contract into acceptance of a transaction that wasn’t executed on the real blockchain. This risk can be mitigated by the introduction of a delay between the deposit and withdrawal and counting on the fact that the attacker won’t be able to maintain a fake blockchain with a larger amount of the blocks than in the real one. Whether we use sidechains or not, a 51% attack still remains a real threat in the world of blockchains.

Examples of sidechain platforms

Loom Network is a platform for creating applications that work with multiple cryptocurrencies. It consists of a blockchain called Basechain which is secured by a group of 21 validators and offers support for smart contracts that are based on Ethereum Virtual Machine and its own smart contract engine based on the Go language. Each of the decentralized applications created through the Loom Network is a separate sidechain to the Basechain. Loom Network not only offers integration with Ethereum and Tron through the gateway oracles but also with the Binance Chain and Bitcoin thanks to the threshold-based multi-signature wallets.

POA Network is a sidechain solution for Ethereum, which offers a higher transaction throughput, lower transaction fees and more reliable block times. It uses proof of authority consensus mechanism where the network is governed by a decentralized autonomous organization composed of US notaries with a valid license. Due to the public identity of the notaries, there’s an incentive to act in the best interests of the network.

Rootstock is a sidechain that enables you to have faster transaction times and to create smart contracts that operate with tokens that are equivalent to the Bitcoins. It consists of a complex consensus mechanism that combines merge-mining and federated consensus protocol. Integration with Bitcoin is possible thanks to special multi-signature wallets that are governed by Rootstock’s federation.

Summary

Sidechains can greatly expand the capabilities of cryptocurrencies, reduce the costs and enable the transfer of assets between blockchains. There are multiple approaches to the integration of different blockchains with varying levels of security trade-offs. Building a sidechain is in itself a very complex task but using a pre-existing solution can actually simplify the architecture of the application, allowing it to support multiple cryptocurrencies with a single codebase.

Are you looking for a partner to develop your blockchain project? Contact us!

Written by
Sebastian Guła
Full-Stack Python Developer

Build the Top Web3 Dev Team

8 years of experience in one ebook. Check it out

Download