RSK and Sidechains
Rootstock is now live on BTC and is coming to LTC hopefully by the end of the year. Here a brief overview of how it works.
What is Rootstock?
Rootstock (RSK) is an open-source platform. It uses the concept of a “sidechain” to bring Ethereum-like smart contract capability alongside Litecoin.
What is a Sidechain?
A sidechain is a completely separate blockchain from Litecoin that is pegged at a 1:1 ratio to Litecoin (LTC). The word “pegged” means Smart Litecoin (SLTC), the RSK sidechain, will maintain a consistent ratio with LTC in regards to coins in circulation as well as value. RSK achieves this through something called a “two-way peg.”
A two-way peg means that 1 LTC can always be transferred for 1 SLTC and vice versa. This is how it works:
If I want SLTC, I will entrust my LTC to a Federation.
The Federation secures my LTC and then releases SLTC to me.
I can return my SLTC for LTC at any moment through the same Federation.
The Federation is composed of several businesses that support RSK.
This process ensures that there will always be a 1:1 ratio of SLTC to LTC. In order to maintain a stable value ratio between the two blockchains, SLTC won’t be listed on any exchanges and can only be obtained/redeemed through the Federation. However, tokenized assets created through SLTC will be able to be listed on exchanges.
For example, let's pretend Ethereum was a sidechain to Litecoin. ETH would not be able to be traded on exchanges but ERC20 tokens would.
SLTC will be merge mined with LTC to secure its blockchain. In order to understand this, let’s briefly breakdown how mining works.
Mining is the process in which a miner takes a number, hashes it, and hopes that it provides the correct solution in order to solve a block. This number is called a “nonce.” Miners hash thousands of nonces in order to find the right solution. If it’s incorrect, they discard the nonce.
Merge mining is when miners try to solve for two different equations at the same time: one for LTC and one for SLTC. The idea is that LTC miners focus on mining the Litecoin blockchain. But instead of discarding incorrect nonces, they also check to see if the solution is correct for SLTC’s blockchain. If it is, they will then broadcast this block to the SLTC network. In this way, LTC miners can “kill two birds with one stone” and reap transaction fees from the SLTC network even if they don’t successfully block on the LTC blockchain.
How Secure is Merge Mining?
Although this is a neat work around to ensuring security on SLTC, merge mining has some vulnerabilities. For example, merge mining can take a few milliseconds of work away from LTC miners. This doesn’t sound like a lot but can account for hundreds of attempts to solve the LTC block reward. Therefore, miners may not want to merge ming with SLTC because it puts them at a disadvantage.
Another vulnerability is ironically the very thing that makes them able to merge mine with LTC. SLTC and LTC share the same mining algorithm: SCRYPT. This makes them vulnerable to a low cost 51% attack from LTC miners unless the majority of LTC miners are merge-mining SLTC. For example, let’s say only 30% of LTC miners decide to merge-mine with SLTC. That leaves an excess of 70% that could easily be used maliciously to perform a 51% attack on SLTC, of which only 16% would be needed.
Now let’s pretend SLTC is 100% merge mined with LTC. It is still susceptible to low-cost double spend attack through “selfish mining”. Selfish mining is when a miner, with at least 30% of the hashrate, mines separately from the Litecoin network to extend their private version of the blockchain faster than the public one. They can then perform a double-spend attack by broadcasting their private blockchain to switch the SLTC network over to theirs. Litecoin miners are disincentivized from doing this on the Litecoin chain because if they don’t succeed, they risk missing out on the much needed block rewards and mining fees to keep their operations going.
However, the opportunity cost to double spend on the SLTC chain is fairly low because they only lose out on transaction fees from the SLTC side. This is because LTC miners do not risk losing LTC block rewards by mining the SLTC chain as they are mining both at the same time.
For example, let’s say an attacker performs a double spend attack towards the Federation through selfish mining. The miner privately mines the SLTC chain apart from the main SLTC network and then redeems his SLTC for LTC. They then broadcast their private SLTC chain and pretend like they never redeemed their SLTC. The ratio between LTC to SLTC is now broken and someone in the SLTC network will be left with unredeemable SLTC.
RSK’s solution to these vulnerabilities is through the Federation.
The Federation is composed of several businesses and have several roles in RSK:
They secure the transfer between LTC and SLTC and vice versa. They’re financially incentivized to do so because they profit from the fees required to perform the transfers.
Because LTC doesn’t support smart contracts or opcodes to validate external SPV proofs, the Federation acts as a semi-trusted third party. RSK will switch to a trust-free model if and when LTC enables either smart contracts or the ability to validate external SPV proofs.
LTC funds are locked for SLTC and can be transferred back with 51% of the Federation members signatures. This will change as the merge-mining hashrate increases.
Finally, the Federation will be responsible for checkpoints for SLTC’s mined blocks early on as SLTC may not have a majority of LTC miners merge-mining. These checkpoints will be signed by Federation members which SLTC clients can use to decide which is the best chain.
There are some concerns around entrusting the security of a sidechain to a semi-centralized entity. This becomes a single focal point of failure and enables the ability for the Federation to to collectively censor transaction through collusion thereby making SLTC/LTC unredeemable. However, RSK believes this scenario to be highly unlikely due to their legal responsibilities as the fact that the reputation of the publicly identifiable Federation members will be at stake.
RSK will open up the world of smart contracts through a Turing-complete sidechain to Litecoin. This provides a test-bed environment for new LTC technology without impacting the LTC blockchain. RSK ensures a pegged 1:1 ratio of LTC to SLTC through a semi-centralized third party called the Federation. The Federation will also help mitigate the dangers of merged mining until LTC enables smart contracts or the opcodes to validate external SPV proofs.