Implementation of Minimum Viable Plasma
Note: The develop branch contains the current development for v2 of the rootchain contract.
There is very little development occuring for this project. We will continue to maintain this repository by thoroughly reviewing any open source contributions. We will provide support and guidance for anyone looking to continue development.
Plasma is a layer 2 scaling solution which conducts transaction processing off chain and allows for only merkle roots of each block to be reported to a root chain. This allows for users to benefit from off chain scaling while still relying on decentralized security.
The root contract of a Plasma child chain represents an intermediary who can resolve any disputes. The root contract is responsible for maintaining a mapping from block number to merkle root, processing deposits, and processing withdrawals.
Root Contract Details
A transaction is encoded in the following form:
RLP_ENCODE([ [Blknum1, TxIndex1, Oindex1, DepositNonce1, Input1ConfirmSig, Blknum2, TxIndex2, Oindex2, DepositNonce2, Input2ConfirmSig, NewOwner, Denom1, NewOwner, Denom2, Fee], [Signature1, Signature2] ])
The signatures are over the hash of the transaction list (first list) signed by the owner of each respective utxo input.
See our documentation for a more detailed description of the smart contract functions.
git clone https://github.com/fourthstate/plasma-mvp-rootchain
npm install -g truffle ganache-cli// if not installed already
ganache-cli// run as a background process
The first migration file
1_initial_migration deploys the
PriorityQueue library and links it to the
RootChain contract, while the second one
2_deploy_rootchain finally makes the deployment. Ethereum requires libraries to already be deployed prior to be used by other contracts.
If you encounter problems, make sure your local test rpc (e.g. ganache) has the same network id as the contract's json from the