• This repository has been archived on 22/Aug/2019
  • Stars
    star
    564
  • Rank 79,014 (Top 2 %)
  • Language
    Python
  • License
    MIT License
  • Created almost 7 years ago
  • Updated over 5 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

OmiseGO's research implementation of Minimal Viable Plasma

Notice!

This is an old research repo. No active work is being done here. Efforts in the direction of production-ready MVP plasma chain (MoreVP, ERC20, audits) are in https://github.com/omisego/plasma-contracts.

Plasma MVP

We're implementing Minimum Viable Plasma. This repository represents a work in progress and will undergo large-scale modifications as requirements change.

Overview

Plasma MVP is split into four main parts: root_chain, child_chain, client, and cli. Below is an overview of each sub-project.

root_chain

root_chain represents the Plasma contract to be deployed to the root blockchain. In our case, this contract is written in Solidity and is designed to be deployed to Ethereum. root_chain also includes a compilation/deployment script.

RootChain.sol is based off of the Plasma design specified in Minimum Viable Plasma. Currently, this contract allows a single authority to publish child chain blocks to the root chain. This is not a permanent design and is intended to simplify development of more critical components in the short term.

child_chain

child_chain is a Python implementation of a Plasma MVP child chain client. It's useful to think of child_chain as analogous to Parity or Geth. This component manages a store of Blocks and Transactions that are updated when events are fired in the root contract.

child_chain also contains an RPC server that enables client interactions. By default, this server runs on port 8546.

client

client is a simple Python wrapper of the RPC API exposed by child_chain, similar to Web3.py for Ethereum. You can use this client to write Python applications that interact with this Plasma chain.

cli

cli is a simple Python application that uses client to interact with child_chain, via the command line. A detailed documentation of cli is available here.

Getting Started

Dependencies

This project has a few pre-installation dependencies.

Solidity ^0.5.0

Mac:

brew update
brew upgrade
brew tap ethereum/ethereum
brew install solidity

Linux:

sudo add-apt-repository ppa:ethereum/ethereum
sudo apt-get update
sudo apt-get install solc

Windows:

Follow this guide

Python 3.2+

Mac:

brew install python

Linux:

sudo apt-get install software-properties-common
sudo add-apt-repository ppa:deadsnakes/ppa
sudo apt-get update
sudo apt-get install python3

Windows:

choco install python

Ganache CLI 6.1.8+

Installation

Note: we optionally recommend using something like virtualenv in order to create an isolated Python environment:

$ virtualenv env -p python3

Fetch and install the project's dependencies with:

$ make

Testing

Before you run tests, make sure you have an Ethereum client running and an JSON RPC API exposed on port 8545. We recommend using ganache-cli to accomplish this when running tests. Start it with the command-line argument -m="plasma_mvp".

Project tests can be found in the tests/ folder. Run tests with:

$ make test

If you're contributing to this project, make sure you also install flake8 and lint your work:

$ make lint

Starting Plasma

The fastest way to start playing with our Plasma MVP is by starting up ganache-cli, deploying everything locally, and running our CLI. Full documentation for the CLI is available here.

$ ganache-cli -m=plasma_mvp # Start ganache-cli
$ make root-chain           # Deploy the root chain contract
$ make child-chain          # Run our child chain and server

CLI Documentation

omg is a simple Plasma CLI that enables interactions with the child chain. Full documentation is provided below.

help

Description

Shows a list of available commands.

Usage

--help

deposit

Description

Creates a deposit transaction and submits it to the child chain.

Usage

deposit <amount> <address>

Example

deposit 100 0xfd02EcEE62797e75D86BCff1642EB0844afB28c7

sendtx

Description

Creates a transaction and submits it to the child chain.

Usage

sendtx <blknum1> <txindex1> <oindex1> <blknum2> <txindex2> <oindex2> <cur12> <newowner1> <amount1> <newowner2> <amount2> <key1> [<key2>]

Example

sendtx 1 0 0 0 0 0 0x0 0xfd02EcEE62797e75D86BCff1642EB0844afB28c7 50 0x4B3eC6c9dC67079E82152d6D55d8dd96a8e6AA26 45 3bb369fecdc16b93b99514d8ed9c2e87c5824cf4a6a98d2e8e91b7dd0c063304

submitblock

Description

Signs and submits the current block to the root contract.

Usage

submitblock <key>

Example

submitblock 3bb369fecdc16b93b99514d8ed9c2e87c5824cf4a6a98d2e8e91b7dd0c063304

withdraw

Description

Creates an exit transaction for the given UTXO.

Usage

withdraw <blknum> <txindex> <oindex> <key1> [<key2>]

Example

withdraw 1000 0 0 3bb369fecdc16b93b99514d8ed9c2e87c5824cf4a6a98d2e8e91b7dd0c063304

withdrawdeposit

Description

Withdraws from a deposit.

Usage

withdrawdeposit <owner> <blknum> <amount>

Example

withdrawdeposit 0xfd02EcEE62797e75D86BCff1642EB0844afB28c7 1 100

CLI Example

Let's play around a bit:

  1. Deploy the root chain contract and start the child chain as per Starting Plasma.

  2. Start by depositing:

omg deposit 100 0xfd02EcEE62797e75D86BCff1642EB0844afB28c7
  1. Send a transaction:
omg sendtx 1 0 0 0 0 0 0x0 0xfd02EcEE62797e75D86BCff1642EB0844afB28c7 50 0x4B3eC6c9dC67079E82152d6D55d8dd96a8e6AA26 45 3bb369fecdc16b93b99514d8ed9c2e87c5824cf4a6a98d2e8e91b7dd0c063304
  1. Submit the block:
omg submitblock 3bb369fecdc16b93b99514d8ed9c2e87c5824cf4a6a98d2e8e91b7dd0c063304
  1. Withdraw the original deposit (this is a double spend!):
omg withdrawdeposit 0xfd02EcEE62797e75D86BCff1642EB0844afB28c7 1 100

Note: The functionality to challenge double spends from the cli is still being worked on.

More Repositories

1

ewallet

eWallet Backend for the OmiseGO SDKs.
Elixir
323
star
2

elixir-omg

OMG-Network repository of Watcher and Watcher Info
Elixir
210
star
3

plasma-cash

Python
122
star
4

plasma-contracts

Root chain contracts for Plasma
JavaScript
113
star
5

airdrop

Python
83
star
6

research

43
star
7

omg-js

JavaScript Library for communication with OMG network
JavaScript
42
star
8

optimism-v2

ARCHIVE of monorepo implementing Boba, an L2 Compute solution built on Optimistic Ethereum - active repo is at https://github.com/bobanetwork/boba
Go
40
star
9

ios-sdk

OmiseGO iOS SDK for integrating with eWallet Server.
Swift
31
star
10

ex_ulid

Universally Unique Lexicographically Sortable Identifier (ULID) in Elixir
Elixir
29
star
11

web-wallet

JavaScript
24
star
12

android-sdk

OmiseGO Android SDK for integrating with Wallet API Server.
Kotlin
18
star
13

sample-ios

Sample iOS application for loyalty point server and OmiseGO Wallet Server.
Swift
15
star
14

honted

OmiseGO node on Tendermint.
Elixir
12
star
15

community-points

Community points monorepo
JavaScript
11
star
16

js-starter-kit

Vue
11
star
17

ex_plasma

Elixir library for the OMG Plasma Contracts Transaction Format
Elixir
10
star
18

dev-portal

OmiseGO Developers Portal
JavaScript
8
star
19

salty

Elixir wrapper for enacl and libsodium.
Elixir
8
star
20

plasma-cli

Go
8
star
21

ruby-sdk

OmiseGO Ruby SDK for integration with Wallet Server.
Ruby
8
star
22

pos-client-android

Kotlin
7
star
23

sample-server

OMGShop, a.k.a Sample Server: sample loyalty points with OmiseGO eWallet Server integration.
Ruby
6
star
24

potterhat

Like Babel fish but you can’t put into your ears
Elixir
6
star
25

pos-merchant-android

Kotlin
6
star
26

OIP

OmiseGO Improvement Proposal
6
star
27

sample-android

Sample Android application for loyalty point server and OmiseGO Wallet Server.
Kotlin
6
star
28

omg-childchain-v2

pronounced /Ch-ch/
Elixir
5
star
29

omg-samples

OMG Network code samples
4
star
30

specs

OMG Network Specs, Integration, Performance, Stress Testing
Elixir
4
star
31

goban

Development environment bootstrapper for OmiseGO projects using Vagrant and Ansible.
Shell
4
star
32

omg-js-samples

Code samples for omg-js library
JavaScript
3
star
33

omgx_wallet

web wallet for OMGX
JavaScript
3
star
34

omg-block-explorer

a mysterious place where you can see transactions data.
JavaScript
3
star
35

pos-client-ios

Swift
3
star
36

pos-merchant-ios

Swift
3
star
37

roadmap

2
star
38

quasar-services

JavaScript
1
star
39

boba-mainnet-addresses

[Boba Network]Mainnet Contract Addresses
1
star
40

omg-quasar-js

JavaScript
1
star
41

safe-gnosis

A full service docker compose setup and container building repo
Shell
1
star
42

omg-js-testrunner

Dockerfile
1
star
43

omgx_contracts

OMGX smart contracts
TypeScript
1
star
44

xomg-vagrant

Vagrant setup for elixir-omg
Shell
1
star
45

omgnetwork.github.io

Developer Portal for OMG Network
HTML
1
star
46

e2e

Acceptance Tests for eWallet.
RobotFramework
1
star
47

contractexchanger

Python
1
star
48

mobile-wallet

JavaScript
1
star
49

omgx_contracts-analyzer

ARCHIVED - see /omgnetwork/optimism/packages/omgx for the active repo. Sushi on OMGX - An example of contract changes needed to run a non-trivial system on OMGX
Solidity
1
star