Updated docs for cardinal release

This commit is contained in:
philip-morlier 2022-02-10 15:18:33 -08:00
parent 60db12bbe7
commit 1c6482a233
9 changed files with 95 additions and 56 deletions

View File

@ -6,12 +6,10 @@ Build and Deploy
.. contents:: :local: .. contents:: :local:
If you are ready to start building your own plugins go ahead and start here.
Setting up the environment Setting up the environment
************************** **************************
.. NOTE:: 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`_. .. NOTE:: 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. PluGeth is an application built in three seperate repositories.
@ -19,7 +17,7 @@ PluGeth is an application built in three seperate repositories.
* `PluGeth-Utils`_ * `PluGeth-Utils`_
* `PluGeth-Plugins`_ * `PluGeth-Plugins`_
For our purposed 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 geth though the PluGeth project. Navigate to ``plugeth/cmd/geth`` and run: 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:
.. code-block:: shell .. code-block:: shell
@ -30,8 +28,7 @@ This will download all dependencies needed for the project. This process will ta
.. code-block:: shell .. code-block:: shell
$ go build $ go build
Once this is complete you should see a ``.ethereum`` folder in your home directory.
At this point you are ready to start downloading local ethereum nodes. In order to do so, from ``plugeth/cmd/geth`` run: At this point you are ready to start downloading local ethereum nodes. In order to do so, from ``plugeth/cmd/geth`` run:
@ -39,11 +36,9 @@ At this point you are ready to start downloading local ethereum nodes. In order
$ ./geth $ ./geth
.. NOTE:: ``./geth`` is the primary command to build a *Mainnet* node. Building a mainnet node requires at least 8 GB RAM, 2 CPUs, and 350 GB of SSD disks. However, dozens of available flags will change the behavior of whichever network you choose to connect to. ``--help`` is your friend.
Build your first plugin
Build a 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: 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:
@ -53,6 +48,8 @@ For the sake of this tutorial we will be building the Hello plugin. Navigate to
This will compile the plugin and produce a ``hello.so`` file. Move ``hello.so`` into ``~/.ethereum/plugins`` . In order to use this plugin geth will need to be started with a ``http.api=mymamespace`` flag. Additionally you will need to include a ``--http`` flag in order to access the standard json rpc methods. This will compile the plugin and produce a ``hello.so`` file. Move ``hello.so`` into ``~/.ethereum/plugins`` . In order to use this plugin geth will need to be started with a ``http.api=mymamespace`` flag. Additionally you will need to include a ``--http`` flag in order to access the standard json rpc methods.
.. note:: 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: 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:
.. code-block:: shell .. code-block:: shell
@ -65,7 +62,7 @@ You should see that the network has responded with:
``{"jsonrpc":"2.0","id":0,"result":"Hello world"}`` ``{"jsonrpc":"2.0","id":0,"result":"Hello world"}``
Congradulations. 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. 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.
.. NOTE:: Each plugin will vary in terms of the requirements to deploy. Refer to the documentation of the plugin itself in order to assure .. NOTE:: 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. that you know how to use it.

View File

@ -18,7 +18,7 @@
# -- Project information ----------------------------------------------------- # -- Project information -----------------------------------------------------
project = 'Plugeth' project = 'Plugeth'
copyright = '2021, Philip Morlier' copyright = '2021, Austin Roberts, Sam Johnston, Philip Morlier'
author = 'Philip Morlier, Austin Roberts' author = 'Philip Morlier, Austin Roberts'
# The full version, including alpha/beta/rc tags # The full version, including alpha/beta/rc tags

View File

@ -1,9 +1,9 @@
.. _custom: .. _custom:
======================== =======================
Building a Custom Plugin Writing a Custom Plugin
======================== =======================
.. toctree:: .. toctree::
:hidden: :hidden:
@ -13,24 +13,24 @@ Building a Custom Plugin
tracer tracer
Before setting out to build a plugin it will be helpful to be familiar with the :ref:`types`. deifferent plugins will require different implimentation. Before setting out to build a plugin it will be helpful to be familiar with the :ref:`types`. Different plugins will require different implementation.
Basic Implementation Basic Implementation
==================== ====================
In general, no matter which type of plugin you intend to build, all will share some common aspects. All plugins will share some common aspects.
Package Package
------- -------
Any plugin will need its own package located in the Plugeth-Plugins packages directory. The package will need to include a main.go from which the .so file will be built. The package and main file should share the same name and the name should be a word that describes the basic functionality of the plugin. Any plugin will need its own package located in ``plugeth-plugins/packages``. The package will need to include a ``main.go`` from which the ``.so`` file will be built. The package and main file should share the same name and the name should be a word that describes the basic functionality of the plugin.
Initialize Initialize
---------- ----------
Most plugins will need to be initialized with an Initialize function. The initialize function will need to be passed at least three arguments: a cli.Context, core.PluginLoader, and a core.Logger. Most plugins will need to be initialized with a ``func Initialize``. The initialize function will need to be passed at least three arguments: ``cli.Context``, ``core.PluginLoader``, ``core.Logger``.
And so, all plugins could have an intial template that looks something like this: All plugins could have an intial template that looks something like this:
.. code-block:: Go .. code-block:: Go
@ -51,7 +51,7 @@ And so, all plugins could have an intial template that looks something like this
InitializeNode InitializeNode
-------------- --------------
Many plugins will make use of the InitializeNode function. Implimentation will look like so: Many plugins will make use of ``func InitializeNode``.
.. code-block:: Go .. code-block:: Go
@ -61,7 +61,7 @@ Many plugins will make use of the InitializeNode function. Implimentation will l
} }
This is called as soon as the Geth node is initialized. The core.Node object represents the running node with p2p and RPC capabilities, while the Backend gives you access to blocks and other data you may need to access. ``InitializeNode`` is called as soon as the Geth node is initialized. The ``core.Node`` object represents the running node with P2P and RPC capabilities, while the ``core.Backend`` gives you access to blocks and other data you may need to access.
Specialization Specialization
============== ==============
@ -79,5 +79,7 @@ From this point implimentation becomes more specialized to the particular plugin
.. _blockupdates: https://github.com/openrelayxyz/plugeth-plugins/blob/master/packages/blockupdates/main.go .. _blockupdates: https://github.com/openrelayxyz/plugeth-plugins/blob/master/packages/blockupdates/main.go
.. _hello: https://github.com/openrelayxyz/plugeth-plugins/blob/master/packages/hello/main.go .. _hello: https://github.com/openrelayxyz/plugeth-plugins/blob/master/packages/hello/main.go

View File

@ -4,17 +4,41 @@
Existing Pluings Existing Pluings
================ ================
isSynced
========
The isSynced plugin was designed as an extention of the ``eth_syncing`` available on statdard Geth. ``plugeth_isSynced`` was desinged to return a status object such that a status report could be given as to the current state of the node as opposed to ``eth_syncing`` which returns the status object only if the node is actively syncing and a simple false if frozen or fully synced. The isSynced plugin was designed as an extention of the ``eth_syncing`` available on statdard Geth. ``plugeth_isSynced`` was desinged to return a status object such that a status report could be given as to the current state of the node as opposed to ``eth_syncing`` which returns the status object only if the node is actively syncing and a simple false if frozen or fully synced.
Usage Usage
====== -----
As with all ``rpc`` methods, isSynced is available by ``curl`` or the `javascript console`_. As with all ``rpc`` methods, isSynced is available by ``curl`` or the `javascript console`_.
From the command line: From the command line using the ``curl`` command:
``{"method": "plugeth_isSynced", "params": []}`` ``{"method": "plugeth_isSynced", "params": []}``
Which will return:
`` "activePeers": true,
"currentBlock": "0x60e880",
"healedBytecodeBytes": "0x0",
"healedBytecodes": "0x0",
"healedTrienodeBytes": "0x0",
"healedTrienodes": "0x0",
"healingBytecode": "0x0",
"healingTrienodes": "0x0",
"highestBlock": "0x60e880",
"nodeIsSynced": true,
"startingBlock": "0x0",
"syncedAccountBytes": "0x0",
"syncedAccounts": "0x0",
"syncedBytecodeBytes": "0x0",
"syncedBytecodes": "0x0",
"syncedStorage": "0x0",
"syncedStorageBytes": "0x0"
``
``Lookup(name string, validate func(interface{}) bool) []interface{}`` ``Lookup(name string, validate func(interface{}) bool) []interface{}``

View File

@ -2,29 +2,25 @@
PluGeth PluGeth
======= =======
**The Geth fork to end all Forks.**
PluGeth is a fork of the Go Ethereum Client, `Geth`_, that implements a plugin architecture allowing developers to extend Geth's capabilities in a number of different ways using plugins rather than having to create additional new forks. PluGeth is a fork of the Go Ethereum Client, `Geth`_, that implements a plugin architecture allowing developers to extend Geth's capabilities in a number of different ways using plugins rather than having to create additional new forks.
From Here: PluGeth aims to provide a secure and versitile tool for users running their own Geth nodes, developers running custom Geth nodes, or projects using Geth as a basis for other chains.
----------
- Ready for an overview of the project and some context? :ref:`project` All dependencies and updates are handled by the PluGeth project, and so, PluGeth enables developers to focus on their projects without having to maintian upstream code.
- If your goal is to run existing plugns without sourcecode: :ref:`install`
- If your goal is to build and deploy existing plugins or make custom plugins: :ref:`build`
- If your goal is to build cutsom plugins: :ref:`custom`
.. warning:: Right now PluGeth is in early development. We are
still settling on some of the plugin APIs, and are
not yet making official releases. From an operational
perspective, PluGeth should be as stable as upstream Geth less whatever instability is added by plugins you might run. But if you plan to run PluGeth today, be aware that furture updates will likely break your plugins.
Table of Contents
*****************
- :ref:`project`
- :ref:`install`
- :ref:`build`
- :ref:`custom`
.. toctree:: .. toctree::
:maxdepth: 1 :maxdepth: 1
:caption: Overview :caption: Overview
:hidden:
project project
types types
@ -33,6 +29,7 @@ Table of Contents
.. toctree:: .. toctree::
:maxdepth: 1 :maxdepth: 1
:caption: Tutorials :caption: Tutorials
:hidden:
install install
build build
@ -42,6 +39,7 @@ Table of Contents
.. toctree:: .. toctree::
:maxdepth: 1 :maxdepth: 1
:caption: Reference :caption: Reference
:hidden:
existing existing
system_req system_req
@ -55,9 +53,15 @@ Table of Contents
.. toctree:: .. toctree::
:maxdepth: 1 :maxdepth: 1
:caption: Contact :caption: Contact
:hidden:
contact contact
.. _Geth: https://geth.ethereum.org/ .. _Geth: https://geth.ethereum.org/

View File

@ -4,15 +4,20 @@
Install Install
======= =======
PluGeth provides a pre-built PluGeth-Geth node as well as pre-built plugins available for download. .. note:: Prior to install make sure to be familiar with :ref:`system requirements<system_req>`.
First download the latest PluGeth `binary release`_. PluGeth can be installed in two ways. The repositories can be cloned and compiled from the source code. Alternatively PluGeth provides binaries of a PluGeth node as well as plugins.
In order to run PluGeth without the source code, download the latest `release`_ here.
Our curated list of plugin builds can be found `here`_ The curated list of plugin builds can be found `here`_
After downloading, move the .so files into the ~/.ethereum/plugins directory. .. note:: Make sure versions of PluGeth and plugins are compatable see: :ref:`version control<version>`.
After downloading plugins, move the ``.so`` files into the ``~/.ethereum/plugins`` directory.
.. note:: The above location may change when changing ``--datadir``.
@ -21,7 +26,5 @@ After downloading, move the .so files into the ~/.ethereum/plugins directory.
.. _release: https://github.com/openrelayxyz/plugeth/releases
.. _binary release: https://github.com/openrelayxyz/plugeth/releases
.. _here: https://github.com/openrelayxyz/plugeth-plugins/releases .. _here: https://github.com/openrelayxyz/plugeth-plugins/releases

View File

@ -7,7 +7,7 @@ Project Design
Design Goals Design Goals
============ ============
Upstream Geth exists primarily to serve as a client for the Ethereum mainnet, though it also supports a number of popular testnets. Supporting the Ethereum mainnet is a big enough challenge in its own right that the Geth team generally avoids changes to support other networks, or to provide features only a small handful of users would be interested in. Upstream Geth exists primarily to serve as a client for the Ethereum mainnet, though it also supports a number of popular testnets. The Geth team generally avoids changes to support other networks, or to provide features only a small handful of users would be interested in.
The result is that many projects have forked Geth. Some implement their own consensus protocols or alter the behavior of the EVM to support other networks. Others are designed to extract information from the Ethereum mainnet in ways the standard Geth client does not support. The result is that many projects have forked Geth. Some implement their own consensus protocols or alter the behavior of the EVM to support other networks. Others are designed to extract information from the Ethereum mainnet in ways the standard Geth client does not support.
@ -16,14 +16,14 @@ Creating numerous different forks to fill a variety of different needs comes wit
PluGeth aims to provide a single Geth fork that developers can choose to extend rather than forking the Geth project. Out of the box, PluGeth behaves exactly like upstream Geth, but by installing plugins written in Golang, developers can extend its functionality in a wide variety of ways. PluGeth aims to provide a single Geth fork that developers can choose to extend rather than forking the Geth project. Out of the box, PluGeth behaves exactly like upstream Geth, but by installing plugins written in Golang, developers can extend its functionality in a wide variety of ways.
Three Repositories Three Repositories
================== ------------------
PluGeth is an application built in three repositories: **PluGeth is an application built in three repositories:**
`PluGeth`_ `PluGeth`_
---------- ----------
The largest of the three Repositories, PluGeth is a fork of Geth which has been modified to enable a plugin architecture. The Plugin loader, wrappers, and hooks all reside in this repository. The largest of the three, PluGeth is a fork of Geth which has been modified to enable a plugin architecture. The Plugin loader, wrappers, and hooks all reside in this repository.
`PluGeth-Utils`_ `PluGeth-Utils`_
---------------- ----------------
@ -38,7 +38,7 @@ The packages from which plugins are buile are stored here. This repository conta
Version Control Version Control
***************** *****************
In order to ensure that the the project can compile and is up to date see: :ref:`version`; to be familiar with dependencies and requirements. Before using Plugeth users are enocuraged to familiarize themselves with the :ref:`version control<version>` scheme of the project.

View File

@ -4,6 +4,15 @@
System Requirements System Requirements
=================== ===================
System requirements will vary depending on which network you are connecting to. On the Ethereum mainnet, you should have at least 8 GB RAM, 2 CPUs, and 350 GB of SSD disks. If compiling from source code Plugeth requires that the user have `Go`_ version 1.17 or later.
PluGeth relies on Golang's Plugin implementation, which is only supported on Linux, FreeBSD, and macOS. Windows support is unlikely to be added in the foreseeable future. Our provided release binaries require `Glibc`_ 2.29.
.. note:: System requirements vary depending on the network being run. For detailed requirements Refer to `Geth`_ documentation.
.. warning:: PluGeth relies on Golang's Plugin implementation, which is only supported on Linux, FreeBSD, and macOS. Windows support is unlikely to be added in the foreseeable future.
.. _Go: https://go.dev/dl/
.. _Glibc: https://pkgs.org/download/glibc
.. _Geth: https://ethereum.org/en/developers/docs/nodes-and-clients/#requirements

View File

@ -1,8 +1,8 @@
.. _version: .. _version:
======= ===============
Version Version Control
======= ===============
PluGeth is separated into three packages in order to minimize dependency conflicts. Golang plugins cannot include different versions of the same packages as the program loading the plugin. If plugins had to import packages from PluGeth itself, a plugin build could only be loaded by that same version of PluGeth. By separating out the PluGeth-utils package, both PluGeth and the plugins must rely on the same version of PluGeth-utils, but plugins can be compatible with any version of PluGeth compiled with the same version of PluGeth-utils. PluGeth is separated into three packages in order to minimize dependency conflicts. Golang plugins cannot include different versions of the same packages as the program loading the plugin. If plugins had to import packages from PluGeth itself, a plugin build could only be loaded by that same version of PluGeth. By separating out the PluGeth-utils package, both PluGeth and the plugins must rely on the same version of PluGeth-utils, but plugins can be compatible with any version of PluGeth compiled with the same version of PluGeth-utils.