Build and Deploy

Setting up the environment


PluGeth is built on a fork of Geth and as such requires familiarity with Go and a funtional environment in which to build Go projects. Thankfully for everyone Go provides a compact and useful tutorial as well as a space for practice.

PluGeth is an application built in three seperate repositories.

For the purposes here you will only need to clone PluGeth and PluGeth-Plugins. Once you have them cloned you are ready to begin. First we need to build PluGeth though the PluGeth project. Navigate to plugeth/cmd/geth and run:

$ go get

This will download all dependencies needed for the project. This process will take a moment or two the first time through. Next run:

$ go build

At this point you are ready to start downloading local ethereum nodes. In order to do so, from plugeth/cmd/geth run:

$ ./geth

Build your first plugin

For the sake of this tutorial we will be building the Hello plugin. Navigate to plugethPlugins/packages/hello. Inside you will see a main.go file. From this location run:

$ go build -buildmode=plugin

This will compile the plugin and produce a file. Move into ~/.ethereum/plugins . In order to use this plugin geth will need to be started with a http.api=mynamespace flag. Additionally you will need to include a --http flag in order to access the standard json rpc methods.


The above location may change when changing --datadir.

Once geth has started you should see that the first INFO log reads: initialized hello . A new json rpc method, called hello, has been been appended to the list of available json rpc methods. In order to access this method you will need to curl into the network with this command:

$ curl -H "Content-Type: application/json" --data '{"jsonrpc":"2.0","method":"mynamespace_hello","params":[],"id":0}'

You should see that the network has responded with:

``{"jsonrpc":"2.0","id":0,"result":"Hello world"}``

You have just built and run your first Plugeth plugin. From here you can follow the steps above to build any of the plugins you choose.


Each plugin will vary in terms of the requirements to deploy. Refer to the documentation of the plugin itself in order to assure that you know how to use it.