Blockchain technology suffers from scalability and speed issues. This phenomenon has a formal proof and is called the Decentralization, Consensus or Scale trilema. The DCS theorem is a probability proof showing that decentralized consensus systems can have Decentralization, Consensus, or Scale, but not all three simultaneously.
- Decentralization. Means that the systems has no single point of failure or control.
- Consenus. Means that the systems uses a collective decision algorithm to update its internal state.
- Scale. Means that the system is able to support a very large number of users.
The theorem states that a blockchain cannot have two of the three properties. The scaling property is the main feature blockchain solutions don’t focus on by design. Scaling has now became a big issue when it comes to adoption of this technology inTo improve scaling different approaches have been introduced.
In this article I will cover a specific type of optimisation called off-chain solutions.
Offchain solutions use transactions that are not not occurring on the blockchain. The bulk of transactions are ‘off-loaded’ to the secondary systems to provide faster processing speeds. There are two main types of offchain solutions.
Side-chains are a popular type of off-chain scaling approach. It involves the creation of a secondary blockchain (sidechain) that is attached to the main blockchain. Funds (Coins) can be transferred from the both chains. To perform transactions in the sidechain a user must first transfer coins to the sidechain from the mainchain using an output address. Once the coins are in the output address, they are locked. This means that the user is no longer able to use the coins anywhere else.
After the waiting period, the coins are released on the sidechain, allowing the user to access and spend them there. The reverse happens when coins are moved back from a sidechain to the main chain.
The transfer of coins between the mainchain and the side chain is handled by a Federations. Federations are a group of servers that manage the transfer of coins between the mainchain and the sidechain.
All the transactions performed in the side chain do not involve the mainchain. This means that the performance issues related block propagation have been removed as the sidechain is much smaller when compared to the mainchain. Also such an approach improves overall security. If there is a security problem on the sidechain it will not effect the mainchain and vice versa. The main drawback on this approach is that we have introduced a centralised entity to manage the transfer of funds between the mainchain and the sidechain.
Stratis is a blockchain infrastructure that utilises sidechains as a means to scale their infrastructure.
State Channels is a concept of moving interactions off the blockchain, by allowing entities to send transaction between them. Each transaction performed through state channels must be signed and timestamped. When used, only the final outcome is saved to the blockchain.
To close a channel, participants must provide the updated state to the blockchain. If the participants do not agree on the final state, the blockchain will resolve the dispute based on the information submitted by each party. Given that the transactions are performed off the main blockchain the transaction free will be minimal or zero.
The most well known implementation of such an approach is payment channels in the Lightening Network Project which forms part of the Bitcoin ecosystem.
If two users wants to transfer money between them. They first create a mulitisignature wallet. A mulitisignature wallet is a wallet that can be accessed by both parties using their respective private keys. Before they start to do transactions both parties need to deposit Bitcoin in the wallet.
The two user can do multiple transactions between them. Each transaction transfers the ownership right of that amount to the other party. The users private keys are used to sign for an updated balance sheet after each transaction.
The actual distribution of funds happens when the channel gets closed. The algorithm uses the most recently signed balance sheet to determine who gets what from the shared wallet. Also the algorithm waits a fixed time period to give the time to either party to challenge the signed balance sheet just in case one of the parties submitted an old version of the balance sheet.
Apart from performance improvement state channels also provide an added security property that transactions are viewed only between the parties involved. The major drawback of such a scheme is that both parties are required to be online all the time if not one of the parties can submit the old balance sheet without being challenged by the other party.