PEGGED SIDECHAINS

sahana karki
Blockchain Musings
Published in
5 min readApr 12, 2018

Consider the following 2 inter related questions :

Internet is becoming a basic need nowadays. Every work we do depends on the internet.But how secure is the internet ?. It depends on the Internet Service Providers(ISP) which makes it a centralized network.We can replace the current centralized internet with a decentralized one using a blockchain network. Internet implementation on blockchains will include multiple chains which need to interact with each other. How does the interaction between the multiple chains take place?

One major issue with the blockchain network is the lack of scalability. We have witnessed this issue when a game’s(cryptokitties) popularity congested the Ethereum network, causing it to slow down significantly. How do we make blockchains more scalable?

SIDECHAINS!!!

We can use sidechains for interaction between the multiple chains and to make blockchains more scalable. Let us see what these sidechains are.

Sidechains explained:

Pegged Sidechain are used to transfer assets between multiple blockchains. Despite this bidirectional transfer of assets between multiple blockchains they are isolated i.e, any cryptographic break in one blockchain will not be reflected in the other blockchain. Sidechains offer a way for new technologies to be implemented without affecting the main chain.It is done by implementing technical changes through the creation of independent but essentially similar system called sidechains. With sidechains users can safely and temporarily experiment with them.Users don’t have to keep track of the sidechains that they are currently not using.

Pegged Sidechains:

Pegged sidechain is nothing but a blockchain that is attached to the parent chain (blockchain) through the two-way peg mechanism which allows bidirectional transfer of assets between the parent chain and the sidechain at a fixed deterministic exchange rate by simply reusing the existing bitcoin currency.

What is one-way peg?

In one-way peg the transfer of assets occur when one blockchain destroys its assets publicly and upon deletion of these assets a new blockchain will create new assets.

What is two-way peg?

Instead of destroying assets and creating new assets every time you want to transfer them from one blockchain to another like in the case of one-way peg,we transfer existing assets from the parent chain i.e. we create a transaction on the first blockchain by locking the assets on the first blockchain and then we create a transaction on the second blockchain and provide cryptographic proofs to the transaction on the second blockchain that the assets were locked correctly on the first blockchain. So sidechains cannot cause unauthorized creation of coins.

Symmetric two-way peg:

If we want to transfer assets from the parent chain to a sidechain, then we send those assets from the parent chain to a special output located on the parent chain itself and lock it there.We can redeem these coins in the sidechain from the special output located on the sidechain by providing SPV proofs to the sidechain that the assets were locked correctly on the parent chain.

What are SPV(Simplified payment verification) proofs?It is used to verify if a transaction has occurred or not.It has a list of blockheaders demonstrating proof-of-work and a cryptographic proof that an output was created in one of the blocks in the list.Anyone in possession of an SPV proof can determine the state of the chain without needing to replay every block.

We can synchronize this process by having 2 waiting periods:

1.Confirmation Period : It is the duration of time for which the coins are locked on the parent chain before it can be transferred to the sidechain. After locking the coins in the special output of the parent chain, the user has to wait until the confirmation period is over. After the confirmation period is over, the user can create a transaction on the sidechain by providing SPV proofs that the coins were locked correctly on the parent chain.

2. Contest period: The main purpose of having the contest period is to prevent double spending. The user has to wait for this duration of time before spending the newly transferred coin. If a reorganisation proof is provided during this delay which doesn’t include the block in which the lock output was created, then the previous proof is invalidated.

Both confirmation and contest period would be on the order of a day or a two.We can use atomic swaps to avoid this delay.

If a user wants to transfer coins from the sidechain back to parent chain, they can follow the same process.The entire transfer process is demonstrated in the figure below.

Symmetric two-way peg

Asymmetric two-way peg:

Transfer of assets from parent chain to sidechain do not require SPV-Proofs because the users of the sidechain are validators of the parent chain and are aware of the state of the parent chain whereas the parent chain is still unaware of the sidechain , so SPV-Proofs are required to transfer back. However the problem with this approach is that the sidechain validators should keep track of the state of the parent chain and reorganisation on the parent chain will cause reorganisation on the sidechain.

Assurance contracts: This means that the miners won’t be rewarded with the sidechain’s transaction fee unless their hashpower is atleast , say, 66% of that of bitcoin.

Time-shifted fees: To keep the chain operational, the miners will receive the fees after some number of blocks.

Demurrage: To encourage honest mining , the miners will be rewarded with block subsidies through demurrage.

Co-signed SPV proofs: Introducing signers who must sign off on valid SPV proofs, watching for false proofs. This results in a direct tradeoff between centralization and security against a high-hashpower attack. Signers may be required only for high-value transfers; they may be required only when sidechain hashpower is too small .

FEDERATED PEG: To implement sidechains the the bitcoin protocol has to be changed i.e. some enhancement has to be done in the bitcoin script.Instead it can be done by implementing a federated peg. This is similar to creating multi-signature off-chain transaction. The functionaries(people who are authorized to validate the transaction) validate the transaction. So trust in the functionaries is required. 3 of 5 federation ,means that atleast 3 out of the 5 functionaries in the federated peg should validate the transaction.

Atomic Swaps: It allows for the exchange of one cryptocurrency for another cryptocurrency without the need for a trusted third party.

We will discuss about the usecases of sidechains as well as the usecases of Plasma (a way to do scalable computations on blockchains by running series of contracts on top of root blockchain just like lightning networks) and atomic swaps in our next post.

Reference:

https://blockstream.com/sidechains.pdf

--

--