Skip to content

Cosmos sdk (Tendermint consensus) side-chain implementation for plasma

License

Notifications You must be signed in to change notification settings

RikaGoldberg/plasma-mvp-sidechain

 
 

Repository files navigation

Plasma MVP Sidechain

license

Branch Tests Coverage
develop Build Status codecov
master Build Status codecov

This is a tutorial version of the FourthState PlasmaMVP implementation. It is specifically intended to showcase how one can easily, robustly, and modularly build plasma functionality with the help of the Cosmos-SDK.

Not intended to be deployed in production

The unfinished tutorial can be found here for those that want to follow along during the workshop.

Install golang: https://golang.org/doc/install

Install dep: https://github.com/golang/dep#installation

Install truffle/ganache-cli: npm install -g [email protected] [email protected]

Note: This sidechain is being constructed to be compatible with our rootchain contract

Overview

As a layer 2 scaling solution, Plasma has two major components: verification and computation. Verification is handled by the rootchain contract which resolves any disputes and distributes funds accordingly.

Computation is handled separately by a sidechain. This sidechain leverages the Cosmos SDK to create a scalable and flexible blockchain, that can maintain it's security through reporting merkle roots to the root chain. We will be using Tendermint for consensus on this blockchain.

We are using a UTXO model for this blockchain. This allows us to do secure and compact proofs when interacting with the rootchain contract.

Starting a sidechain

In order to run a sidechain with tendermint consensus and a client to form transaction, a plasma node and light client will need to be initialized.

Note: The following assumes you have golang properly setup and all dependecies have already been installed. See Contribution Guidelines for more information.

Plasma Node:

  • Navigate to client/plasmad/ directory
  • Run go install via command line

The plasma node (plasmad) is now installed and can be called from any directory with plasmad

Run plasmad init via command line to start an instance of a plasma node with a connection to a tendermint validator.

Run plasmad start via command line to begin running the plasma node. You should see empty blocks being proposed and committed.

Plasma Light Client:

  • Navigate to client/plasmacli/ directory
  • Run go install via command line

Use plasmacli to run any of the commands for this light client

The light client uses the Ethereum keystore to create and store passphrase encrypted keys in $HOME/.plasmacli/keys/

dep ensure

When building the sidechain, go dep is used to manage dependencies. Running dep ensure followed by go build will result in the following output:

# github.com/AdityaSripal/plasma-mvp-sidechain/vendor/github.com/ethereum/go-ethereum/crypto/secp256k1
../vendor/github.com/ethereum/go-ethereum/crypto/secp256k1/curve.go:42:44: fatal error: libsecp256k1/include/secp256k1.h: No such file or directory

This is caused by a go dep issue outlined here. To fix this locally, add the following in Gopkg.lock under crypto/secp256k1 and above crypto/sha3:

"crypto/secp256k1/libsecp256k1",
"crypto/secp256k1/libsecp256k1/include",
"crypto/secp256k1/libsecp256k1/src",
"crypto/secp256k1/libsecp256k1/src/modules/recovery",

Run dep ensure -vendor-only

Your vendor folder should now contain all the necessary dependencies, there is no need to run dep ensure again.

Plasma Architecture

See our research repository for architectural explanations of our Plasma implementation.

Documentation

See our documentation

Contributing

See our contributing guidelines. Join our Discord Server.

About

Cosmos sdk (Tendermint consensus) side-chain implementation for plasma

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Go 65.0%
  • JavaScript 26.3%
  • Solidity 8.7%