• This repository has been archived on 13/Jun/2019
  • Stars
    star
    122
  • Rank 292,031 (Top 6 %)
  • Language
    Python
  • Created over 6 years ago
  • Updated almost 6 years ago

Reviews

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

Repository Details

plasma-cash

codecov

Dependency Prerequisite

Mac:

$ brew install leveldb

Linux:

LevelDB should be installed along with plyvel once you make the project later on.

Windows:

First, install vcpkg. Then,

> vcpkg install leveldb

Mac:

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

Linux:

$ wget https://github.com/ethereum/solidity/releases/download/v0.4.24/solc-static-linux
$ chmod +x ./solc-static-linux
$ sudo mv solc-static-linux /usr/bin/solc

Windows:

Follow this guide.

It's also recommended to run ganache-cli when developing, testing, or playing around. This will allow you to receive near instant feedback.

Mac:

$ brew install node
$ npm install -g ganache-cli

Linux:

Install Node.js. Then,

$ npm install -g ganache-cli

Develop

Install requirements:

pip install -r requirements.txt

Ganache-cli command:

ganache-cli -m=plasma_cash

Deploy contract:

python deployment.py

Run child chain Server:

python -m plasma_cash.child_chain

Run operator cron jobs: (TODO: the following commands does not support running with cron job yet)

python -m plasma_cash.operator_cron_job

Client:

python
>>> from web3.auto import w3
>>> from plasma_cash.client.client import Client
>>> from plasma_cash.dependency_config import container
>>> operator_key = '0xa18969817c2cefadf52b93eb20f917dce760ce13b2ac9025e0361ad1e7a1d448'
>>> userA_key = '0xe4807cf08191b310fe1821e6e5397727ee6bc694e92e25115eca40114e3a4e6b'
>>> userB_key = '0xee092298d0c0db61969cc4466d57571cf3ca36ca62db94273d5c1513312aeb30'
>>> operator = Client(container.get_root_chain(), container.get_child_chain_client(), operator_key)
>>> userA = Client(container.get_root_chain(), container.get_child_chain_client(), userA_key)
>>> userB = Client(container.get_root_chain(), container.get_child_chain_client(), userB_key)
>>> userA.deposit(10, '0x0000000000000000000000000000000000000000')
>>> operator.submit_block()
>>> userA.send_transaction(1, 1693390459388381052156419331572168595237271043726428428352746834777341368960, 10, '0x08d92dca9038ea9433254996a2d4f08d43be8227')
>>> operator.submit_block()
>>> userB.start_exit(1693390459388381052156419331572168595237271043726428428352746834777341368960, 1, 2)
>>> w3.providers[0].make_request('evm_increaseTime', 60 * 60 * 24 * 14)  # force ganache to increase time for two week
>>> userB.finalize_exit(1693390459388381052156419331572168595237271043726428428352746834777341368960)

(Challenge spent coin)

python
>>> from plasma_cash.client.client import Client
>>> from plasma_cash.dependency_config import container
>>> operator_key = '0xa18969817c2cefadf52b93eb20f917dce760ce13b2ac9025e0361ad1e7a1d448'
>>> userA_key = '0xe4807cf08191b310fe1821e6e5397727ee6bc694e92e25115eca40114e3a4e6b'
>>> userB_key = '0xee092298d0c0db61969cc4466d57571cf3ca36ca62db94273d5c1513312aeb30'
>>> userC_key = '0x8af3051eb765261b245d586a88700e606431b199f2cce4c825d2b1921086b35c'
>>> operator = Client(container.get_root_chain(), container.get_child_chain_client(), operator_key)
>>> userA = Client(container.get_root_chain(), container.get_child_chain_client(), userA_key)
>>> userB = Client(container.get_root_chain(), container.get_child_chain_client(), userB_key)
>>> userC = Client(container.get_root_chain(), container.get_child_chain_client(), userC_key)
>>> userA.deposit(10, '0x0000000000000000000000000000000000000000')
>>> operator.submit_block()
>>> userA.send_transaction(1, 1693390459388381052156419331572168595237271043726428428352746834777341368960, 10, '0x08d92dca9038ea9433254996a2d4f08d43be8227')
>>> operator.submit_block()
>>> userB.send_transaction(2, 1693390459388381052156419331572168595237271043726428428352746834777341368960, 10, '0xdf29cfbd5d793fa5b22d5c730a8e8450740c6f8f')
>>> operator.submit_block()
>>> userB.start_exit(1693390459388381052156419331572168595237271043726428428352746834777341368960, 1, 2)
>>> operator.submit_block()
>>> userC.challenge_exit(1693390459388381052156419331572168595237271043726428428352746834777341368960, 3)

(Challenge history and respond)

python
>>> from plasma_cash.client.client import Client
>>> from plasma_cash.dependency_config import container
>>> operator_key = '0xa18969817c2cefadf52b93eb20f917dce760ce13b2ac9025e0361ad1e7a1d448'
>>> userA_key = '0xe4807cf08191b310fe1821e6e5397727ee6bc694e92e25115eca40114e3a4e6b'
>>> userB_key = '0xee092298d0c0db61969cc4466d57571cf3ca36ca62db94273d5c1513312aeb30'
>>> userC_key = '0x8af3051eb765261b245d586a88700e606431b199f2cce4c825d2b1921086b35c'
>>> userD_key = '0x4d4c362239f610305b1c05ef91928c893d9a631e08149b7d66286fcf3dfa8553'
>>> operator = Client(container.get_root_chain(), container.get_child_chain_client(), operator_key)
>>> userA = Client(container.get_root_chain(), container.get_child_chain_client(), userA_key)
>>> userB = Client(container.get_root_chain(), container.get_child_chain_client(), userB_key)
>>> userC = Client(container.get_root_chain(), container.get_child_chain_client(), userC_key)
>>> userD = Client(container.get_root_chain(), container.get_child_chain_client(), userD_key)
>>> userA.deposit(10, '0x0000000000000000000000000000000000000000')
>>> operator.submit_block()
>>> userA.send_transaction(1, 1693390459388381052156419331572168595237271043726428428352746834777341368960, 10, '0x08d92dca9038ea9433254996a2d4f08d43be8227')
>>> operator.submit_block()
>>> userB.send_transaction(2, 1693390459388381052156419331572168595237271043726428428352746834777341368960, 10, '0xdf29cfbd5d793fa5b22d5c730a8e8450740c6f8f')
>>> operator.submit_block()
>>> userC.send_transaction(3, 1693390459388381052156419331572168595237271043726428428352746834777341368960, 10, '0xc5016a1dc1f2556fd237abba2681d221edf31a20')
>>> operator.submit_block()
>>> userD.start_exit(1693390459388381052156419331572168595237271043726428428352746834777341368960, 3, 4)
>>> userC.challenge_exit(1693390459388381052156419331572168595237271043726428428352746834777341368960, 1)
>>> userD.respond_challenge_exit(b'\xf8{\x80\xa0\x03\xbel\xcf\x13%K@a\xd1\x86\xa8v\\\xd2\xe0Iw\x8c|g\xd0\xe3\x02&\x8d\x15^"W\x1a\x80\n\x94\xb8>#$X\xa0\x92ik\xe9qpE\xd9\xa6\x05\xfb\x0f\xec+\xb8A\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00', 1693390459388381052156419331572168595237271043726428428352746834777341368960, 2)

Run unit tests:

pytest unit_tests

Run integration tests:

behave integration_tests/features/

Run linter:

flake8 plasma_cash/
flake8 unit_tests/
flake8 integration_tests/

More Repositories

1

plasma-mvp

OmiseGO's research implementation of Minimal Viable Plasma
Python
564
star
2

ewallet

eWallet Backend for the OmiseGO SDKs.
Elixir
323
star
3

elixir-omg

OMG-Network repository of Watcher and Watcher Info
Elixir
210
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