Giter Club home page Giter Club logo

plasma-cash's Introduction

plasma-cash

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:

python -m plasma_cash.child_chain

Client:

python
>>> from plasma_cash.dependency_config import container
>>> c = container.get_client()
>>> c.deposit(10, '0xb83e232458a092696be9717045d9a605fb0fec2b', '0x0000000000000000000000000000000000000000')
>>> c.submit_block('0xa18969817c2cefadf52b93eb20f917dce760ce13b2ac9025e0361ad1e7a1d448')
>>> c.send_transaction(1, 1693390459388381052156419331572168595237271043726428428352746834777341368960, 10, '0x08d92dca9038ea9433254996a2d4f08d43be8227', '0xe4807cf08191b310fe1821e6e5397727ee6bc694e92e25115eca40114e3a4e6b')
>>> c.submit_block('0xa18969817c2cefadf52b93eb20f917dce760ce13b2ac9025e0361ad1e7a1d448')
>>> c.start_exit('0x08d92dca9038ea9433254996a2d4f08d43be8227', 1693390459388381052156419331572168595237271043726428428352746834777341368960, 1, 2)

(Challenge spent coin)

python
>>> from plasma_cash.dependency_config import container
>>> c = container.get_client()
>>> c.deposit(10, '0xb83e232458a092696be9717045d9a605fb0fec2b', '0x0000000000000000000000000000000000000000')
>>> c.submit_block('0xa18969817c2cefadf52b93eb20f917dce760ce13b2ac9025e0361ad1e7a1d448')
>>> c.send_transaction(1, 1693390459388381052156419331572168595237271043726428428352746834777341368960, 10, '0x08d92dca9038ea9433254996a2d4f08d43be8227', '0xe4807cf08191b310fe1821e6e5397727ee6bc694e92e25115eca40114e3a4e6b')
>>> c.submit_block('0xa18969817c2cefadf52b93eb20f917dce760ce13b2ac9025e0361ad1e7a1d448')
>>> c.send_transaction(2, 1693390459388381052156419331572168595237271043726428428352746834777341368960, 10, '0xdf29cfbd5d793fa5b22d5c730a8e8450740c6f8f', '0xee092298d0c0db61969cc4466d57571cf3ca36ca62db94273d5c1513312aeb30')
>>> c.start_exit('0x08d92dca9038ea9433254996a2d4f08d43be8227', 1693390459388381052156419331572168595237271043726428428352746834777341368960, 1, 2)
>>> c.submit_block('0xa18969817c2cefadf52b93eb20f917dce760ce13b2ac9025e0361ad1e7a1d448')
>>> c.challenge_exit('0xdf29cfbd5d793fa5b22d5c730a8e8450740c6f8f', 1693390459388381052156419331572168595237271043726428428352746834777341368960, 3)

(Challenge history and respond)

>>> from plasma_cash.dependency_config import container
>>> c = container.get_client()
>>> c.deposit(10, '0xb83e232458a092696be9717045d9a605fb0fec2b', '0x0000000000000000000000000000000000000000')
>>> c.submit_block('0xa18969817c2cefadf52b93eb20f917dce760ce13b2ac9025e0361ad1e7a1d448')
>>> c.send_transaction(1, 1693390459388381052156419331572168595237271043726428428352746834777341368960, 10, '0x08d92dca9038ea9433254996a2d4f08d43be8227', '0xe4807cf08191b310fe1821e6e5397727ee6bc694e92e25115eca40114e3a4e6b')
>>> c.submit_block('0xa18969817c2cefadf52b93eb20f917dce760ce13b2ac9025e0361ad1e7a1d448')
>>> c.send_transaction(2, 1693390459388381052156419331572168595237271043726428428352746834777341368960, 10, '0xdf29cfbd5d793fa5b22d5c730a8e8450740c6f8f', '0xee092298d0c0db61969cc4466d57571cf3ca36ca62db94273d5c1513312aeb30')
>>> c.submit_block('0xa18969817c2cefadf52b93eb20f917dce760ce13b2ac9025e0361ad1e7a1d448')
>>> c.send_transaction(3, 1693390459388381052156419331572168595237271043726428428352746834777341368960, 10, '0xc5016a1dc1f2556fd237abba2681d221edf31a20', '0x8af3051eb765261b245d586a88700e606431b199f2cce4c825d2b1921086b35c')
>>> c.submit_block('0xa18969817c2cefadf52b93eb20f917dce760ce13b2ac9025e0361ad1e7a1d448')
>>> c.start_exit('0xc5016a1dc1f2556fd237abba2681d221edf31a20', 1693390459388381052156419331572168595237271043726428428352746834777341368960, 3, 4)
>>> c.challenge_exit('0xdf29cfbd5d793fa5b22d5c730a8e8450740c6f8f', 1693390459388381052156419331572168595237271043726428428352746834777341368960, 1)
>>> c.respond_challenge_exit('0xc5016a1dc1f2556fd237abba2681d221edf31a20', 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/

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.