Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

License

NotificationsYou must be signed in to change notification settings

nickemmons/plasma-mvp

 
 

Repository files navigation

We're implementing theMinimum Viable Plasma

Current repo includes:

  1. Root chain smart contracts
  2. Building blocks for child chain

Install dependencies with

python setup.py install

The MVP requires Solidity 0.4.18.

The rest of the child chain and client will pushed up after an internal audit.

To deploy root chain smart contracts start testrpc on port 8545 and run:make root-chain

To run tests:make test

client

client is a simple Python wrapper of the RPC API exposed bychild_chain, similar toWeb3.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 usesclient to interact withchild_chain, via the command line. A detailed documentation ofcli is availablehere.

Getting Started

Dependencies

This project has a few pre-installation dependencies.

Mac:

$ brew install leveldb

Linux:

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

Windows:

First, installvcpkg. Then,

> vcpkg install leveldb

Mac:

$ brew unlink solidity$ brew install https://raw.githubusercontent.com/ethereum/homebrew-ethereum/2aea171d7d6901b97d5f1f71bd07dd88ed5dfb42/solidity.rb

Linux:

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

Windows:

Followthis guide.

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

Installation

Note: we optionally recommend using something likevirtualenv 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 port8545. We recommend usingganache-cli to accomplish this when running tests.

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

$ make test

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

$ make lint

Starting Plasma

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

$ 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> <newowner1> <amount1> <newowner2> <amount2> <fee> <key1> [<key2>]

Example

send_tx 1 0 0 0 0 0 0xfd02ecee62797e75d86bcff1642eb0844afb28c7 50 0x4b3ec6c9dc67079e82152d6d55d8dd96a8e6aa26 45 5 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 0xfd02ecee62797e75d86bcff1642eb0844afb28c7 1 100

CLI Example

Let's play around a bit:

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

  2. Start by depositing:

omg deposit 100 0xfd02ecee62797e75d86bcff1642eb0844afb28c7
  1. Send a transaction:
omg sendtx 1 0 0 0 0 0 0xfd02ecee62797e75d86bcff1642eb0844afb28c7 50 0x4b3ec6c9dc67079e82152d6d55d8dd96a8e6aa26 45 5 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.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python98.5%
  • Makefile1.5%

[8]ページ先頭

©2009-2025 Movatter.jp