Sidechains, as a concept, have been around for quite some time now. The idea is to have a blockchain that runs in parallel to the main blockchain. It allows users to move tokens and other digital assets from the main blockchain to the side chain and vice-versa. You can think of them as extensions to existing blockchains that can increase their functionality. In this guide, we are going to look at how sidechains work and then we will explore the two most essential sidechains currently running on Bitcoin’s blockchain:
How do Sidechains work?
The sidechain is attached to the main blockchain via a two-way peg. In a one-way peg, you destroy some tokens, like BTC, and you gain some currency in return for doing that. Eg. in Counterparty – a peer-to-peer financial platform built on Bitcoin – you “burn” some BTC by sending it to an unspendable address. In return, you get some of the native XCP tokens. This is an irreversible process wherein you can’t get back the original Bitcoin.
In sidechains, you create a two-way peg, which makes this whole process reversible.
This is how the process works:
- You lock up some Bitcoins instead of burning them.
- You lock the BTC up in boxes that don’t belong to any address and are controlled by Federations.
- After you block up your BTC, you get a certain amount of newly created tokens on the sidechain.
- You then interact with these new tokens however you please.
- Once you are done, you can burn the remaining tokens and return to the main blockchain by getting back an equivalent amount of Bitcoin.
What are Federations?
Since these chains deal with a lot of money, it is important to have a secure and trustless layer between the blockchain and sidechain. The issue here is that the Bitcoin script isn’t sophisticated enough to make this process entirely decentralized. By incorporating an m-of-n multisignature, we can create a Federation which doesn’t require trust between its members to operate. Blockstream’s Liquid has a federated peg which uses a consortium of exchanges.
To understand how these multisignatures work, consider a 5-of-7 multisig contract, where m = 5 and n = 7. What this essentially means is that in a Federation with 7 members, as long as 5 approve a particular proposal, it goes through.
Security in Sidechains
So, are sidechains as secure as the main blockchain? Well…no, however certain steps can be taken to make sure that the security is upto par. Let’s look at what Rootstock does in this regard.
As per Rootstock, PoW (Proof of Work, aka the consensus mechanism used by Bitcoin) is the only consensus system that provides proper finality. The reason being that it is the only consensus system that actually consumes a valuable resource (electricity). To attract miners onto their platform, Rootstock incentivizes miners through a process called “merged mining.” In merged mining, two separate cryptocurrencies, based on the same algorithm, are mined simultaneously.
Rootstock uses a block reward sharing scheme called “DECOR+” to reduce competition and allow miners late switch to the Rootstock best block. You can read more about Decor+ here.
To prevent the possibilities of a 51% attack, especially in the early days, Rootstock includes federated checkpoints for PoW mined blocks. The Federation members and clients sign federated checkpoints can use the majority of the signatures to better decide which is the best chain.
Despite all these measures, if the Rootstock mining power does go below 5% of Bitcoin’s hashing power, then the Federation gets the authority to create signed blocks. Also, if Rootstock hashing power exceeds 66% of the maximum BTC hashing difficulty, then the users will stop using the federated checkpoints.
Now that we have familiarized ourselves with the basics let’s look into the two most popular sidechains on top of Bitcoin’s network.
Sidechains on Top of Bitcoin’s Network: RSK & Liquid
Rootstock (RSK) is a smart contract platform that is connected to the Bitcoin blockchain through sidechain technology. Rootstock was born to be compatible with Ethereum’s applications (the web3/EVM/Solidity model) but using bitcoin as the underlying cryptocurrency. The idea behind the creation of RSK was to give the Bitcoin blockchain smart contract functionalities. At its very core, Rootstock is a combination of:
- A Turing-complete resource-accounted deterministic virtual machine (for smart contracts) compatible with the Ethereum’s EVM.
- A two-way pegged Bitcoin sidechain (for BTC denominated trade) based on a strong federation.
- A SHA256D merge-mining consensus protocol (for consensus security relying on Bitcoin’s miners) with 30-seconds block interval. (for fast payments).
Reasons for Creation
The Bitcoin blockchain has several advantages. It is long-running with proven security, wide distribution, and awareness. Plus, it also has a healthy community with strong hashing power. RSK wants its users to enjoy the benefits of Bitcoin as a store-of-value and while providing smart contract functionality and higher scalability.
The Rootstock chain is connected to the Bitcoin blockchain via a 2-way peg. The users lock up their BTC and get an equivalent amount of RBTC in the side chain. These coins can be used to deploy or to interact with smart contracts and dApps on the Rootstock blockchain. The RSK Federation secures the RSK Two-way Peg and block consensus is secured by merge-mining.
The RSK sidechain has 15 active functionaries and needs signatures from eight of them to release BTC. The sidechain uses custom Hardware Security Modules (HSMs) to store the private keys and the RSK federation functionaries are allowed to audit both the HSMs’ firmware and hardware.
The native token in the RSK sidechain is RBTC. RBTC can’t be pre-mined, minted, nor coin there is inflation on RSK. This 2-Way Peg between Bitcoin blockchain and RSK blockchain ensures a fixed conversion between BTC and RBTC. (1 RBTC = 1 BTC). The process to transfer BTC to RSK is as follows:
- The sender must make sure that the bitcoins to transfer are locked up in a P2PKH address. If not, then they must be transferred to a P2PKH address in a transaction Tx1.
- The Bitcoins are transferred from P2PKH address to the Federation multisig address in a transaction Tx2.
- After the Federation confirms this transaction, the blockchain immediately unlocks the equivalent number of RBTC to an address that is controlled by the sender.
A bit more on Merged-Mining
We have touched on merge mining before but let’s shed a bit more light on it.
- During the mining process, the cryptographic hash of a newly mined block from the secondary blockchain (RSK) is embedded in the primary blockchain (Bitcoin).
- The hash of the secondary block is prefixed by a merge-mining “tag.” This tag is a short descriptive text, aka “magic bytes.”
- A block from the main Bitcoin blockchain can only be associated with, at most, one block from the RSK blockchain. This makes sure that there is no confusion when it comes to tag location.
- The main security requirement for merge-mining is that it must be more difficult to create a primary-blockchain block that can be associated with two blocks from the same secondary blockchain than to mine two different primary-blockchain blocks.
There is one specific section about merged-mining on RSK´s website explaining the incentives for miners.
Development on RSK
The smart contracts in RSK get executed inside the RSK virtual machine (RVM). The main features of RVM are as follows:
- At the op-code level, the RVM is compatible with EVM meaning that it can RSK can execute Ethereum contracts.
- Users will be able to run Ethereum DApps with the security of the Bitcoin blockchain. Essentially enjoying the best of both worlds.
- The RSK community will continually suggest a performance improvement pipeline documented in numerous RSKIPs (RSK improvement proposals).
This is an ingenious approach that has been adopted by RSK. Instead of creating their own language and forcing developers to work in a certain way, they will allow them to use the most popular smart contract language (Solidity) to create dApps.
Rootstock uses a community-driven improvement proposal system (RSKIPs). RSK’s original white paper proposes a long-term governance model that aims to represent all the actors of the community, providing a board of governance composed of 5 seats:
- Miners will be able to vote with hashing power (1 vote)
- Bitcoin and Rootstock users will vote with Proof-of-Stake (1 vote)
- Exchanges and web-wallets will vote through their participation in the Federation (1 vote)
- Rootstock and Bitcoin Core developers will have a special threshold voting system (1 vote)
- The last vote may be offered to a non-profit established Bitcoin institution, which may represent the largest ecosystem. An institutional vote may also be offered to the organization with the objective to standardize the EVM/Solidity/Web3 toolchain.
RIFOS – A layer above RSK
Lying on top of RSK is its technological stack called RIFOS. One can think RIFOS as a decentralized AWS and a “third layer.” Developers can use RIFOS to bring in a lot of interesting functionalities into the Bitcoin blockchain which would have been impossible to do before. Presently, RIFOS developers are working on Storage, Payment and Naming service applications. If you are interested, you can read about them here. If you are interested in experimenting with RIFOS, then keep in mind the following points:
- As long as a product is compatible with the underlying protocols, developers can seamlessly integrate it within the RIFOS ecosystem.
- All the individual components of RIFOS have been designed to maximize the potential benefits for those who want to offer their infrastructure services within the protocol’s ecosystem.
- All the components are protected by the security provided by the Bitcoin Network.
- Its protocols will include mechanisms to trigger network effects and economies of scale.
- Most of the services running in RIFOS will be consumed utilizing a single token (RIF).
Liquid was one of the first Bitcoin sidechains released for commercial use. Created by Blockstream, Liquid helps mitigate Bitcoin’s scalability problems by allowing instant transfer of funds between Exchange platforms. The native token is called Liquid Bitcoin (LBTC) which is pegged 1:1 with BTC.
Advantages of Liquid
The main advantages of the Liquid sidechain are as follows:
- Near-instant transactions between Exchanges, Market Makers and certain wallets.
- Since sidechains can allow you to move large amounts of capital, it enables more efficient trading operations.
- Liquid is immune to transaction analysis tools making it more private than the Bitcoin blockchain.
- Liquid’s blocks are programmed to be one-minute apart making it extremely reliable.
- Liquid Federation is maintained by reliable entities that have to act in the interest of the system to prevent any loss of reputation in the market.
Who are in Liquid’s Federation?
The Federation has a group of exchanges, traders, and financial institutions from 9 countries across 4 continents. Presently, the Federation has a total of 35 members –
Altonomy, Bitbank, Bitfinex, Bitmax, BitMEX, Bitso, Blue Fire Capital, BTCBOX, BTCTrader/BtcTurk, BTSE, Cobo, Coinone, Coinut, Crypto Garage, DGroup, DMM Japan, FRNT Financial, Gate.io, GOPAX (operated by Streami), Huobi, L2B Global, OKCoin, OpenNode, Poolin, Prycto, Sideshift AI, The Rock Trading, SIX Digital Exchange, TaoTao, Tilde, Unocoin, Xapo, XBTO, and Zaif.
It should be noted that Liquid’s network operated by the Federation members. Blockstream has no control over the network.
How does the BTC-to-LBTC transition happen?
The transition happens in the following steps:
- Liquid users send bitcoin to an address controlled by the Federation.
- The moment this transaction receives 102 confirmation, the users get credited with LBTC.
- Every Liquid member must keep a portion of their funds as LBTC to ensure that the network maintains its liquidity.
Sidechains on Top of Bitcoin – Conclusion
Sidechains are one of the most critical innovations in the cryptospace. Just a few years back, the very idea of “creating dApps on top of Bitcoin” would’ve been a farfetched pipedream. Presently we have implementations like SegWit, Liquid and RSK, making Bitcoin exponentially more scalable and programmable as well. It will be fascinating to see the kind of applications developers will build on top of Bitcoin thanks to these implementations.