Root Node Installation

Learn how to build, install, and run your own Plasma node.

Sections in this article

Binaries

Plasma consists of three binaries:

  1. plasmad, the Plasma node daemon itself.
  2. plasmacli, a CLI client for a querying plasmad.
  3. plasma-harness, a tool that simplifies local development by managing Ganache and Truffle processes.

You likely won’t need to run plasma-harness in production, so this guide will focus on building and installing plasmad and plasmacli.

Prerequisites

You’ll need to install the following dependencies in order to build Plasma:

  • Golang, at least version 1.10.
  • dep, version 0.5.0.
  • make and the GNU toolchain in order to run the build system.
  • abigen, which is a Go binary that exists as part of go-ethereum.
  • Node.js and NPM
  • Truffle, version 0.5.0 or above.

Building

Once you’ve installed the above prerequisites, building plasmad is handled primarily by the Makefile at the root of the project. Clone the repository into your $GOPATH, and run the following commands to create each binary:

cd $GOPATH/src/github.com/kyokan/plasma
make deps # installs git submodules, go dependencies, and node dependencies
make abigen # compiles smart contracts via Truffle and generates their go bindings via abigen
make build-plasmad # compiles plasmad
make build-plasmacli # compiles plasmacli

You should now have both plasmad and plasmacli in a target directory at the root of the repository. You can install these anywhere you’d like, however we recommend somewhere on your $PATH to make things easier.

Configuring plasmad

plasmad is configured via a YAML file or command line flags. For production configurations, we recommend configuring Plasma via file rather than via CLI. See below for an example configuration file and what each configuration directive does:

# the URL to a running Geth, Parity, Infura, or other Ethereum node
node-url: "http://localhost:8545"
# the address of the Plasma smart contract
contract-addr: "0xF12b5dd4EAD5F743C6BaA640B0216200e89B60Da"
# the private key of the Ethereum account that currently owns the Plasma smart contract
private-key: "c87509a1c067bbde78beb793e6fa76530b6382a4c0241e5e4a9ec0a0f44dc0d3"
# a log level. can be one of the following: error, warn, debug, trace
log-level: "debug"

Once you’ve placed your configuration file somewhere safe on disk and set the appropriate permissions, you can start your Plasma node by running plasmad –config start-root.

By default, Plasma will listen for incoming gRPC connections on port 6545. You can change this by providing the rpc-port directive in either the configuration file or via the CLI.

Daemonizing plasmad

Now that plasmad is running, you’ll likely want to daemonize the process for easier logging and automatic restarts in case of crashes. plasmad logs to stderr in an effort to be as unopinionated as possible about how it is deployed. We have successfully run plasmad via supervisor for extended period with no issues; we expect the same to be true for any process management tool you choose. plasmad will cleanly shut down after receiving a SIGINT signal.