Note
For a comprehensive coverage of blockchain development in Ethereum or mastering Solidity programming, taking our below self paced courses is highly recommended:
- Blockchain Solidity Course for Beginners
- Ethereum Developer Course
- Blockchain Security Course for Beginners
Recap
In our previous article (How to Manage Ethereum State Channel with Raiden), we covered how to manage Ethereum state channel with Raiden.
In this article we learn how Plasma Chains work in Ethereum.
Ethereum side chain with Plasma
As we discussed earlier, one intuitive solution to improve scalability and throughput is to create many small chains. This may sound like a plausible solution, since it may suit business and social needs. Take ourselves for example, as customers or citizens, we buy fruit and vegetables from our local grocery, which might leverage one blockchain to ensure traceability and food safety through the entire supply chain of fresh produce.
At the end of your shopping, you may pay the grocery directly through a P2P payment blockchain. When you apply your mortgage or business loan, you might be able to get your mortgage and loan approved through the mortgage blockchain, and so on. We are more likely to meet all these vertical chains or private chains before we see a gigantic global chain.
However, it creates cross-chain integration and security enforcement issues. This is what Plasma tries to address. It was first proposed in August 2017 by Joseph Poon and Vitalik Buterin. The design idea is to offload transactions to many faster and less crowded side chains, also called Plasma chains. Similar to the state channel approach, a Plasma chain will periodically commit its transactions to the Ethereum root chain.
One-to-One Live Blockchain Classes
Coding Bootcamps school offers One-to-One Live Blockchain Classes for Beginners.
Security and integrity will be enforced through the root chain. If any suspicion of fraud is detected in the plasma chains, the transactions will be rolled back and Plasma users can exit the plasma chain and move out to the root chain.
The following diagram shows what a Plasma network may look like:
Each plasma chain is a blockchain on its own. They are bonded with an Ethereum root chain through a smart contract. The smart contract essentially connects an entire child chain to the root chain, acting as a bridge. Anyone can create a plasma chain, and write a smart contract binding the plasma chain to the root chain.
As the following diagram shows, at each period, the block headers of each block of the plasma chains are submitted to the root chain and recorded in the blocks of the root chain. Transactions in the plasma chains will stay at each plasma chain. The Merkle proof in the block headers will then be used to verify data on the child chain. This allows for tens and thousands of transactions to be processed in many plasma chains in parallel, and also leaves minimal and enough Merkle header information on the root chain to enforce security:
The root chain will play an arbitrator role, somewhat similar to the federal court system in the United States, where the root chain is the supreme court and the plasma chains are the circuit courts, or the district courts. In the federal court system, once the federal district court has decided a case, the case can be appealed to the circuit court or supreme court for an arbitration.
When a fraud occurs in a plasma chain, whether it is a double spend across the chains or you cash out more than you have in all accounts, anyone can provide a fraud proof to prove the transaction is invalid. If proven to the fraud transactions, the transaction will be rolled back.
Plasma users can exit the child plasma chain and transfer ethers back to the main chain. The original proposals introduce a single validator concept, as the operator for the plasma blockchain, to validate and add transactions to the blocks, and manage the state of the child blockchain.
The idea behind this approach is that security and integrity of the blockchain at the global level is enforced by the root chain, using either PoW or, most likely, a hybrid PoW and PoS consensus protocol. In the case where the validator of the plasma chain may hold the fund and commit fraudulent activities, anyone can provide a fraud proof against the validator to the root chain.
Once proven to be fraudulent from the validator, the root chain will allow all accounts at the impacted plasma chain to move out to the root chain. This is called a mass exit scenario. In this case, individual accounts will be migrated to the root chain one by one, the invalid transaction will be rolled back, and the validator of the plasma chain will be penalized with the stake it puts in the smart contract. Depending on how many accounts need to be migrated, it may take a while to complete the mass exit.
Although it has been one of the most interesting and active topics in the Ethereum research community, there is no public release of a plasma implementation yet. Instead, a scaled down version of the original proposal, also called a minimal viable plasma, or MVP, was proposed for a simple implementation, which includes a simplified security model and basic operations for exiting plasma chains.
One very interesting aspect of an MVP is the reintroduction of a UTXO model. As we discussed in the last two chapters, one key difference in Ethereum is to move away from Bitcoin’s UTXO model to a more defined account model, where account balance is the state object maintained at the world state.
The Ethereum account model makes transaction verifications and money transfer simple, with the sacrifice of parallelism. This may not be a significant drawback, since all transactions need to be verified by all nodes. But with Plasma, as the root chain moves away from transaction processing to security enforcement and arbitration, it becomes important to be able to verify invalid transactions in parallel.
A tree structure of blockchains, hence the tree of UTXOs from all child chains, makes it easy to apply distributed parallel algorithms to verify fraud proofs and enforce security across all plasma chains.
The following diagram shows what the potential Plasma may be able to bring into the Ethereum blockchain network when a tree of Ethereum plasma child chains are bonded with the parent plasma chain, and are ultimately connected to, and secured through, the Ethereum root chain:
Massive scalability will be achieved through offloading expensive computations to the child chains, and allow the root chain to provide the shared security and arbitration services to the blockchain at a global level. There are a few similar cross chain interoperability solutions, like Cosmos network. Claimed to be the internet of blockchains, Cosmos network provides a hub-spoke integration architecture. Independent blockchains, as the zones or spokes, are attached to the main blockchain as the hub. Its purpose is to facilitate blockchain integration through the IBC (inter-blockchain communications) protocol.
Next Article
In our next article (How Sharding and Gasper work in Ethereum), we discuss how Sharding and Gasper work in Ethereum.
This article is written in collaboration with Brian Wu who is a leading author of “Learn Ethereum: Build your own decentralized applications with Ethereum and smart contracts” book. He has written 7 books on blockchain development.
Resources
coming soon