Skip to content
Rootchain contract implementation according to the Plasma MVP.
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
contracts
docs
migrations Hamdi/fee challenge (#87) Dec 13, 2018
test Hamdi/audit fixes (#101) Feb 25, 2019
.gitattributes Create .gitattributes Apr 30, 2018
.gitignore Hamdi/challenge vulnerability (#68) Oct 14, 2018
.solcover.js
.travis.yml Hamdi/final contract (#98) Jan 18, 2019
CHANGELOG.md
CONTRIBUTING.md
LICENSE
README.md fixed link (#116) Mar 19, 2019
package-lock.json Hamdi/audit fixes (#101) Feb 25, 2019
package.json Hamdi/audit fixes (#101) Feb 25, 2019
truffle-config.js folder restructure Mar 14, 2018
truffle.js Fix truffle file Mar 22, 2018

README.md

PLASMA MVP

travis build license Coverage Status

Implementation of Minimum Viable Plasma

Overview

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.

Documentation

See our documentation for a more detailed description of the smart contract functions.

Testing

  1. git clone https://github.com/fourthstate/plasma-mvp-rootchain
  2. cd plasma-mvp-rootchain
  3. npm install
  4. npm install -g truffle ganache-cli // if not installed already
  5. ganache-cli // run as a background process
  6. npm test

Running

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 build folder.

Contributing

See our contribution guidelines. Join our Discord Server.

You can’t perform that action at this time.