Coder Social home page Coder Social logo

plasma's Introduction

Plasma MVP

Build Status

Install dependencies with

$ npm install

Run test cases:

# start test rpc server (which starts server on localhost:8545)
$ npm run testrpc

# run test cases
$ npm run test

Development

# start test rpc server or you can start `geth`/`parity` node
$ npm run testrpc

# deploy contracts
$ npm run deploy

# start authority's server
$ npm run authorized-dev

# start dev server
$ npm run dev

Production

# build server
$ npm run build

# start server
$ npm start

CLI

$ npm run testrpc # or use actual ethereum node (check configurations)
$ npm run authorized-node # or simple dev node => npm run dev


# start cli (`-p` option provides a way to accept sender's private key)
$ ./src/cli/index.js -p '9b28f36fbd67381120752d6172ecdcf10e06ab2d9a1367aac00cdcd6ac7855d3'
plasma > .help

Configurations

You can override default configurations by creating config.env file in root directory and adding following variables:

Variable Description Default
APP_NAME Name shown on UI Plasma chain
APP_PORT Server port 8080
CHAIN_DB Level db location ./db
CHAIN_BLOCK_PERIOD Plasma chain block period. After every block period, new plasma block will be created, if necessary. 6
CHAIN_WEB3_PROVIDER Web3 http provider URL http://localhost:8545
CHAIN_ROOT_CONTRACT Contract address for root contract 0xb4ee...a6a
CHAIN_AUTHORITY_ADDRESS Authority address for PoA 0x9fB2...791
CHAIN_AUTHORITY_PRIVATE_KEY Authority's private key for PoA 0x9b28...5d3
NETWORK_EXTERNAL_HOST Network's external host (for sync) 0.0.0.0
NETWORK_PORT Network's port (for sync) 8081
NETWORK_PEERS Pre-defined peers (for sync)

plasma's People

Contributors

federicobond avatar jdkanani avatar johannbarbie avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

plasma's Issues

TypeError: Cannot read property 'length' of undefined

Hi

While ruining the step npm run test I am getting this error.

` 1) Contract: Root chain - client Client transfer:
TypeError: Cannot read property 'length' of undefined
at Context._callee3$ (test/Client.js:115:38)
at tryCatch (node_modules/babel-polyfill/node_modules/regenerator-runtime/runtime.js:65:40)
at Generator.invoke [as _invoke] (node_modules/babel-polyfill/node_modules/regenerator-runtime/runtime.js:303:22)
at Generator.prototype.(anonymous function) [as next] (node_modules/babel-polyfill/node_modules/regenerator-runtime/runtime.js:117:21)
at step (test/Client.js:29:191)
at test/Client.js:29:361
at process._tickCallback (internal/process/next_tick.js:68:7)

  1. Contract: Root chain - client Client withdraw:
    TypeError: Cannot read property 'length' of undefined
    at Context._callee5$ (test/Client.js:165:38)
    at tryCatch (node_modules/babel-polyfill/node_modules/regenerator-runtime/runtime.js:65:40)
    at Generator.invoke [as _invoke] (node_modules/babel-polyfill/node_modules/regenerator-runtime/runtime.js:303:22)
    at Generator.prototype.(anonymous function) [as next] (node_modules/babel-polyfill/node_modules/regenerator-runtime/runtime.js:117:21)
    at step (test/Client.js:29:191)
    at test/Client.js:29:361
    at process._tickCallback (internal/process/next_tick.js:68:7)`

Can you please check :)

Implement plasma node

Overview

Implement simple plasma node which receives transactions, validates them and creates a block.

The node must follow following rules to validate a transaction:

  1. Should prevent double spends (spending already spent transaction output (TXO))
  2. Shouldn't create unspent transaction output (UTXO) without creating individual deposit block or using other UTXOs as input
  3. Should match the sum of the denominations of the inputs to the sum of the denominations of the outputs plus the fees
  4. Should reject transaction from an address with exit state
  5. Should reject transaction from an address which is already exited

The node must follow following rules to validate a block:

  1. Should contain only validate transactions
  2. Should include deposit transaction only once for deposit block
  3. Should include valid transaction only once
  4. Should submit the block to root chain

Specification

The specification will follow as we go ahead with the implementation.

API Interface

Implement an API interface (mostly with JSON RPC) to interact with the node. The interface must be open for all.

It must follow following features, APIs:

  1. Should allow retrieving current state, data and transaction history for plasma chain
  2. Should allow to submit transaction for validation

Add functional testing

First step: create a list with every scenario that a Plasma node should consider for testing.

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.