Skip to content
Branch: master
Find file History
Latest commit 4d45435 Mar 23, 2019
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 commitment rename to state_update Mar 22, 2019 fix intersection check Mar 22, 2019

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.


  • Python3


$ 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/ .                 
test/predicates/ ....
test/predicates/ ....

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