DEV Community

Will Morgan
Will Morgan

Posted on

1

Layer 2 / Plasma watcher to protect against invalid exits and malicious behavior

Plasma service

The goal of this project is for a plasma user (or a plasma service provider) to be able to run a watcher on a server or their own computer that listens for any issues on the Plasma chain and immediately react and exit the Plasma chain or challenge invalid data

Workflows

Based on https://github.com/omisego/elixir-omg/blob/master/docs/api_specs/status_events_specs.md#byzantine-events

Event Task Implementation
invalid_exit challengeStandardExit invalid-exit.yml
unchallenged_exit startInFlightExit TODO
invalid_block startInFlightExit TODO
block_withholding startInFlightExit TODO
noncanonical_ife challengeInFlightExitNotCanonical TODO
invalid_ife_challenge respondToNonCanonicalChallenge TODO

Architecture

   +-------------------+               +-------------------+
   |                   |               |                   |
   |   Plasma Watcher  |               |  Plasma Contract  |
   |                   |               |                   |
   +-------------------+               +-------------------+
                |                                ^
                |                                |
           invalid_exit                  challengeStandardExit
                |                                |
                |                                |
                |    +------------------+        |
                +--->|                  |--------+
                     |  Plasma Process  |
                     |                  |
                     +------------------+
                     | PRIVATE_KEY      |
                     +------------------+

Start the Plasma Guard

If you don't already have MESG you should install and run it with:

npm i -g mesg-cli
mesg-cli daemon:start

more information

mesg-cli process:dev ./invalid-exit.yml \
     --env PRIVATE_KEY=$ALICE_PRIVATE_KEY \
     --env PROVIDER_ENDPOINT=$PROVIDER_ENDPOINT \
     --env PLASMA_ADDRESS=$PLASMA_ADDRESS \
     --env PLASMA_ABI="$(curl -s https://raw.githubusercontent.com/omisego/omg-js/v2.0.0-v0.2/packages/omg-js-rootchain/src/contracts/RootChain.json | jq .abi)"

Create an invalid exit

Check how to create an invalid exit

SurveyJS custom survey software

JavaScript UI Libraries for Surveys and Forms

SurveyJS lets you build a JSON-based form management system that integrates with any backend, giving you full control over your data and no user limits. Includes support for custom question types, skip logic, integrated CCS editor, PDF export, real-time analytics & more.

Learn more

Top comments (0)

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs