Skip to content
Branch: master
Find file History
Latest commit 4d45435 Mar 23, 2019
Permalink
Type Name Latest commit message Commit time
..
Failed to load latest commit information.
predicates minor comment fixes Mar 22, 2019
test rename finalize_exit Mar 22, 2019
README.md
commitment_chain_contract.py commitment rename to state_update Mar 22, 2019
erc20_plasma_contract.py fix intersection check Mar 22, 2019
utils.py

README.md

General Purpose Plasma Python Implementation

This repository contains code which simulates a 'generalized plasma' implementation. This means that it implements a few smart contracts which share a common interface that allow for maximal layer 2 interoperability.

This repository contains a standard plasma chain, but also includes python implementations of common state channels like payment channels. It also contains more sophisticated plasma predicate logic which handles things like multi-sigs & more.

Note that this was written in Python so that it can serve as an easy to digest example of these topics. A more special purpose language would be used in practice, like Vyper. However, the core logic will remain the same even if there are slight data structure changes & things like signatures and inclusion proofs will not be mocked.

Requirements

  • Python3

Installation

$ cd gen-plasma # navigate to root directory
$ python3 -m venv venv # create virtual enviornment
$ . venv/bin/activate # activate virtual enviornment
$ pip install pytest # install pytest--the only dependency

Test it out

$ pytest # run the tests!

test/test_erc20_plasma_contract.py ..
test/test_utils.py .                 
test/predicates/test_multisig.py ....
test/predicates/test_transfer.py ....

========== x passed in 0.06 seconds ==========
$ # You did it! Now take a look at the code :)
$ vim test/predicates/test_transfer.py # the transfer predicate is a pretty good place to start :)
You can’t perform that action at this time.