diff --git a/documentation/_build/doctrees/anatomy.doctree b/documentation/_build/doctrees/anatomy.doctree
index 104446d..51bb4a3 100644
Binary files a/documentation/_build/doctrees/anatomy.doctree and b/documentation/_build/doctrees/anatomy.doctree differ
diff --git a/documentation/_build/doctrees/api.doctree b/documentation/_build/doctrees/api.doctree
index e629ad5..9ff3d2e 100644
Binary files a/documentation/_build/doctrees/api.doctree and b/documentation/_build/doctrees/api.doctree differ
diff --git a/documentation/_build/doctrees/environment.pickle b/documentation/_build/doctrees/environment.pickle
index 707ce2b..3817f71 100644
Binary files a/documentation/_build/doctrees/environment.pickle and b/documentation/_build/doctrees/environment.pickle differ
diff --git a/documentation/_build/doctrees/hooks.doctree b/documentation/_build/doctrees/hooks.doctree
index 40190bb..6fb2806 100644
Binary files a/documentation/_build/doctrees/hooks.doctree and b/documentation/_build/doctrees/hooks.doctree differ
diff --git a/documentation/_build/doctrees/index.doctree b/documentation/_build/doctrees/index.doctree
index 1c460c2..f5c617f 100644
Binary files a/documentation/_build/doctrees/index.doctree and b/documentation/_build/doctrees/index.doctree differ
diff --git a/documentation/_build/html/_sources/anatomy.rst.txt b/documentation/_build/html/_sources/anatomy.rst.txt
index 4a94f1d..d583eaa 100644
--- a/documentation/_build/html/_sources/anatomy.rst.txt
+++ b/documentation/_build/html/_sources/anatomy.rst.txt
@@ -4,4 +4,40 @@
Plugin Anatomy
==============
-.. todo:: fill in disections of archetypal plugins
\ No newline at end of file
+.. todo:: fill in disections of archetypal plugins
+
+.. code-block:: go
+
+ package main
+
+import (
+ "github.com/openrelayxyz/plugeth-utils/core"
+ "gopkg.in/urfave/cli.v1"
+)
+
+var (
+ log core.Logger
+)
+
+type myservice struct{}
+
+func (*myservice) Hello() string {
+ return "Hello world"
+}
+
+func Initialize(ctx *cli.Context, loader core.PluginLoader, logger core.Logger) {
+ log = logger
+ log.Info("Initialized hello")
+}
+
+func GetAPIs(node core.Node, backend core.Backend) []core.API {
+ defer log.Info("APIs Initialized")
+ return []core.API{
+ {
+ Namespace: "mynamespace",
+ Version: "1.0",
+ Service: &myservice{},
+ Public: true,
+ },
+ }
+}``
diff --git a/documentation/_build/html/_sources/api.rst.txt b/documentation/_build/html/_sources/api.rst.txt
index ef3ee53..4f22e54 100644
--- a/documentation/_build/html/_sources/api.rst.txt
+++ b/documentation/_build/html/_sources/api.rst.txt
@@ -46,7 +46,7 @@ Tracers
.. code-block:: go
- ``// CaptureStart is called at the start of each transaction
+ // CaptureStart is called at the start of each transaction
CaptureStart(env core.EVM, from core.Address, to core.Address, create bool, input []byte, gas uint64, value *big.Int) {}
// CaptureState is called for each opcode
CaptureState(env core.EVM, pc uint64, op core.OpCode, gas, cost uint64, scope *vm.ScopeContext, rData []byte, depth int, err error) {}
@@ -55,12 +55,78 @@ Tracers
// CaptureEnd is called at the end of each transaction
CaptureEnd(output []byte, gasUsed uint64, t time.Duration, err error) {}
// GetResult should return a JSON serializable result object to respond to the trace call
- GetResult() (interface{}, error) {}``
+ GetResult() (interface{}, error) {}
.. warning:: Modifying the values passed into tracer functions can
alter the
- results of the EVM execution in unpredictable ways. Additonally, some objects may be reused acress calls, so data you wish to capture should be copied rather than retianed by reference.
+ results of the EVM execution in unpredictable ways. Additopackage main
+
+import (
+ "github.com/openrelayxyz/plugeth-utils/core"
+ "gopkg.in/urfave/cli.v1"
+)
+
+var (
+ log core.Logger
+)
+
+type myservice struct{}
+
+func (*myservice) Hello() string {
+ return "Hello world"
+}
+
+func Initialize(ctx *cli.Context, loader core.PluginLoader, logger core.Logger) {
+ log = logger
+ log.Info("Initialized hello")
+}
+
+func GetAPIs(node core.Node, backend core.Backend) []core.API {
+ defer log.Info("APIs Initialized")
+ return []core.API{
+ {
+ Namespace: "mynamespace",
+ Version: "1.0",
+ Service: &myservice{},
+ Public: true,
+ },
+ }
+}
+package main
+
+import (
+ "github.com/openrelayxyz/plugeth-utils/core"
+ "gopkg.in/urfave/cli.v1"
+)
+
+var (
+ log core.Logger
+)
+
+type myservice struct{}
+
+func (*myservice) Hello() string {
+ return "Hello world"
+}
+
+func Initialize(ctx *cli.Context, loader core.PluginLoader, logger core.Logger) {
+ log = logger
+ log.Info("Initialized hello")
+}
+
+func GetAPIs(node core.Node, backend core.Backend) []core.API {
+ defer log.Info("APIs Initialized")
+ return []core.API{
+ {
+ Namespace: "mynamespace",
+ Version: "1.0",
+ Service: &myservice{},
+ Public: true,
+ },
+ }
+}
+nally, some objects may be reused acress calls, so data you wish to capture should be copied rather than retianed by reference.
LiveTracer
----------
diff --git a/documentation/_build/html/_sources/hooks.rst.txt b/documentation/_build/html/_sources/hooks.rst.txt
index b7940ee..bbfb876 100644
--- a/documentation/_build/html/_sources/hooks.rst.txt
+++ b/documentation/_build/html/_sources/hooks.rst.txt
@@ -4,4 +4,61 @@
Plugin Hooks
============
-.. todo:: discussion of plugin hooks
+The key to understanding a plugin is understanding its corresponding hook. Broadly, plugin hooks can be thought of as functions which deliver a function signiture to the **plugin loader**. The signature matches that of the function(s) called by the plugin and describes the data that is being captured and how the plugin will deliver said data upon invocation.
+
+The public plugin hook function should follow the naming convention ``Plugin$HookName``. The first argument should be a `` core.PluginLoader``, followed by any arguments required by the functions to be provided by any plugins implementing this hook.
+
+**Public and Private Hook Functions**
+
+Each hook provides both a Public and private version. The private plugin hook function should bear the same name as the public plugin hook function, but with a lower case first letter. The signature should match the public plugin hook function, except that the first argument referencing the PluginLoader should be removed. It should invoke the public plugin hook function on plugins.DefaultPluginLoader. It should always verify that the DefaultPluginLoader is non-nil, log warning and return if the DefaultPluginLoader has not been initialized.
+
+**Invocation**
+
+the private plugin hook function should be invoked, with the appropriate arguments, in a single line within the Geth codebase inorder to minimize unexpected conflicts merging upstream Geth into plugeth.
+
+Selected Hooks
+--------------
+
+
+`StateUpdate`_
+************
+
+`Invocation`_
+
+The state update plugin provides a snapshot of the state subsystem in the form of a a stateUpdate object. The stateUpdate object contains all information transformed by a transaction but not the transaction itself.
+
+Invoked for each new block, StateUpdate provides the changes to the blockchain state. root corresponds to the state root of the new block. parentRoot corresponds to the state root of the parent block. destructs serves as a set of accounts that self-destructed in this block. accounts maps the hash of each account address to the SlimRLP encoding of the account data. storage maps the hash of each account to a map of that account's stored data.
+
+.. warning:: StateUpdate is only called if Geth is running with
+ ``-snapshots=true``. This is the default behavior for Geth, but if you are explicitly running with ``--snapshot=false`` this function will not be invoked.
+
+
+`AppendAncient`_
+*************
+
+Invoked when the freezer moves a block from LevelDB to the ancients database. ``number`` is the number of the block. ``hash`` is the 32 byte hash of the block as a raw ``[]byte``. ``header``, ``body``, and ``receipts`` are the RLP encoded versions of their respective block elements. ``td`` is the byte encoded total difficulty of the block.
+
+`NewHead`_
+**********
+
+Invoked when a new block becomes the canonical latest block. Note that if several blocks are processed in a group (such as during a reorg) this may not be called for each block. You should track the prior latest head if you need to process intermediate blocks.
+
+`GetRPCCalls`_
+************
+
+Invoked when the RPC handler registers a method call. returns the call ``id``, method ``name``, and any ``params`` that may have been passed in.
+
+
+
+**I am struggling all of assudden with if this is really this best course of action. Giving all of this reference, seems to beg the -utils vs plugeth conversation and I am not sure that is a smart thing to get into.**
+
+
+
+
+
+
+.. _StateUpdate: https://github.com/openrelayxyz/plugeth/blob/develop/core/state/plugin_hooks.go
+.. _Invocation: https://github.com/openrelayxyz/plugeth/blob/develop/core/state/statedb.go#L955
+.. _AppendAncient: https://github.com/openrelayxyz/plugeth/blob/develop/core/rawdb/plugin_hooks.go
+.. _GetRPCCalls: https://github.com/openrelayxyz/plugeth/blob/develop/rpc/plugin_hooks.go
+.. _NewHead: https://github.com/openrelayxyz/plugeth/blob/develop/core/plugin_hooks.go#L108
diff --git a/documentation/_build/html/_sources/index.rst.txt b/documentation/_build/html/_sources/index.rst.txt
index ab2fd8a..ac126ce 100644
--- a/documentation/_build/html/_sources/index.rst.txt
+++ b/documentation/_build/html/_sources/index.rst.txt
@@ -25,7 +25,6 @@ Table of Contents
project
types
- hooks
anatomy
@@ -41,7 +40,7 @@ Table of Contents
system_req
plugin_loader
- plugin_hooks
+ hooks
core_restricted
api
diff --git a/documentation/_build/html/anatomy.html b/documentation/_build/html/anatomy.html
index 371a82a..74dbaec 100644
--- a/documentation/_build/html/anatomy.html
+++ b/documentation/_build/html/anatomy.html
@@ -16,7 +16,7 @@
-
+
@@ -38,7 +38,6 @@
Tutorials
@@ -49,7 +48,7 @@
@@ -88,13 +87,56 @@
Todo
fill in disections of archetypal plugins
+
+
+import ( “github.com/openrelayxyz/plugeth-utils/core”
+“gopkg.in/urfave/cli.v1”
+
+
+)
+
+var ( log core.Logger
+
+
+)
+type myservice struct{}
+
+func (* myservice) Hello() string { return “Hello world”
+
+
+}
+
+func Initialize(ctx * cli.Context, loader core.PluginLoader, logger core.Logger) { log = logger
+log.Info(“Initialized hello”)
+
+
+}
+
+func GetAPIs(node core.Node, backend core.Backend) []core.API { defer log.Info(“APIs Initialized”)
+return []core.API{
+
+
+{ Namespace: “mynamespace”,
+Version: “1.0”,
+Service: &myservice{},
+Public: true,
+
+
+
},
+
+}
+
+
+}``
diff --git a/documentation/_build/html/api.html b/documentation/_build/html/api.html
index 4831ab2..2a6abf7 100644
--- a/documentation/_build/html/api.html
+++ b/documentation/_build/html/api.html
@@ -38,7 +38,6 @@
Tutorials
@@ -49,7 +48,7 @@
System Requirements
Plugin Loader
-Plugin Hooks
+Plugin Hooks
Core vs Restricted packages in Plugeth-utils
API
Flags
@@ -138,7 +137,7 @@ restricted.backend
Type: map[string]TracerResult
Behavior: When calling debug.traceX functions (such as debug_traceCall
and debug_traceTransaction
) the tracer can be specified as a key to this map and the tracer used will be the TracerResult specified here. TracerResult objects must match the interface:
-`` // CaptureStart is called at the start of each transaction
+// CaptureStart is called at the start of each transaction
CaptureStart ( env core . EVM , from core . Address , to core . Address , create bool , input [] byte , gas uint64 , value * big . Int ) {}
// CaptureState is called for each opcode
CaptureState ( env core . EVM , pc uint64 , op core . OpCode , gas , cost uint64 , scope * vm . ScopeContext , rData [] byte , depth int , err error ) {}
@@ -147,15 +146,97 @@ restricted.backend
// CaptureEnd is called at the end of each transaction
CaptureEnd ( output [] byte , gasUsed uint64 , t time . Duration , err error ) {}
// GetResult should return a JSON serializable result object to respond to the trace call
-GetResult () ( interface {}, error ) {} ``
+GetResult () ( interface {}, error ) {}
Warning
Modifying the values passed into tracer functions can
alter the
-results of the EVM execution in unpredictable ways. Additonally, some objects may be reused acress calls, so data you wish to capture should be copied rather than retianed by reference.
+results of the EVM execution in unpredictable ways. Additopackage main
+
+import ( “github.com/openrelayxyz/plugeth-utils/core”
+“gopkg.in/urfave/cli.v1”
+
+
+
)
+
+var ( log core.Logger
+
+
+
)
+
type myservice struct{}
+
+func (* myservice) Hello() string { return “Hello world”
+
+
+
}
+
+func Initialize(ctx * cli.Context, loader core.PluginLoader, logger core.Logger) { log = logger
+log.Info(“Initialized hello”)
+
+
+
}
+
+func GetAPIs(node core.Node, backend core.Backend) []core.API { defer log.Info(“APIs Initialized”)
+return []core.API{
+
+
+{ Namespace: “mynamespace”,
+Version: “1.0”,
+Service: &myservice{},
+Public: true,
+
+
+
},
+
+}
+
+
+
}
+package main
+
+import ( “github.com/openrelayxyz/plugeth-utils/core”
+“gopkg.in/urfave/cli.v1”
+
+
+
)
+
+var ( log core.Logger
+
+
+
)
+
type myservice struct{}
+
+func (* myservice) Hello() string { return “Hello world”
+
+
+
}
+
+func Initialize(ctx * cli.Context, loader core.PluginLoader, logger core.Logger) { log = logger
+log.Info(“Initialized hello”)
+
+
+
}
+
+func GetAPIs(node core.Node, backend core.Backend) []core.API { defer log.Info(“APIs Initialized”)
+return []core.API{
+
+
+{ Namespace: “mynamespace”,
+Version: “1.0”,
+Service: &myservice{},
+Public: true,
+
+
+
},
+
+}
+
+
+
}
+nally, some objects may be reused acress calls, so data you wish to capture should be copied rather than retianed by reference.
LiveTracer
diff --git a/documentation/_build/html/build.html b/documentation/_build/html/build.html
index a905eb8..35b8e8c 100644
--- a/documentation/_build/html/build.html
+++ b/documentation/_build/html/build.html
@@ -38,7 +38,6 @@
Tutorials
@@ -53,7 +52,7 @@
diff --git a/documentation/_build/html/contact.html b/documentation/_build/html/contact.html
index a2410a7..6f3d51c 100644
--- a/documentation/_build/html/contact.html
+++ b/documentation/_build/html/contact.html
@@ -37,7 +37,6 @@
Tutorials
@@ -48,7 +47,7 @@
diff --git a/documentation/_build/html/core_restricted.html b/documentation/_build/html/core_restricted.html
index b044711..668d13c 100644
--- a/documentation/_build/html/core_restricted.html
+++ b/documentation/_build/html/core_restricted.html
@@ -16,7 +16,7 @@
-
+
@@ -38,7 +38,6 @@
Tutorials
@@ -49,7 +48,7 @@
@@ -94,7 +93,7 @@
diff --git a/documentation/_build/html/genindex.html b/documentation/_build/html/genindex.html
index 004d2b8..e7e4c3e 100644
--- a/documentation/_build/html/genindex.html
+++ b/documentation/_build/html/genindex.html
@@ -36,7 +36,6 @@
Tutorials
@@ -47,7 +46,7 @@
diff --git a/documentation/_build/html/hooks.html b/documentation/_build/html/hooks.html
index 0e6d762..5e3e24c 100644
--- a/documentation/_build/html/hooks.html
+++ b/documentation/_build/html/hooks.html
@@ -15,8 +15,8 @@
-
-
+
+
@@ -35,10 +35,9 @@
diff --git a/documentation/_build/html/index.html b/documentation/_build/html/index.html
index f4c8609..45c4278 100644
--- a/documentation/_build/html/index.html
+++ b/documentation/_build/html/index.html
@@ -37,7 +37,6 @@
Tutorials
@@ -48,7 +47,7 @@
@@ -98,7 +97,6 @@ perspective, PluGeth should be as stable as upstream Geth less whatever isstabil
@@ -113,7 +111,7 @@ perspective, PluGeth should be as stable as upstream Geth less whatever isstabil
diff --git a/documentation/_build/html/plugeth.html b/documentation/_build/html/plugeth.html
index 2752e01..bf25298 100644
--- a/documentation/_build/html/plugeth.html
+++ b/documentation/_build/html/plugeth.html
@@ -36,7 +36,6 @@
Tutorials
@@ -47,7 +46,7 @@
diff --git a/documentation/_build/html/plugin_hooks.html b/documentation/_build/html/plugin_hooks.html
index dbfb293..f7f3e83 100644
--- a/documentation/_build/html/plugin_hooks.html
+++ b/documentation/_build/html/plugin_hooks.html
@@ -14,9 +14,7 @@
-
-
-
+
@@ -38,7 +36,6 @@
Tutorials
@@ -46,10 +43,10 @@
Build and Deploy
Reference
-
+
@@ -93,10 +90,7 @@
-
+
diff --git a/documentation/_build/html/plugin_loader.html b/documentation/_build/html/plugin_loader.html
index 9e35e0e..7c514dc 100644
--- a/documentation/_build/html/plugin_loader.html
+++ b/documentation/_build/html/plugin_loader.html
@@ -15,7 +15,7 @@
-
+
@@ -38,7 +38,6 @@
Tutorials
@@ -49,7 +48,7 @@
@@ -95,7 +94,7 @@
diff --git a/documentation/_build/html/plugins.html b/documentation/_build/html/plugins.html
index 63f01a4..bee41b8 100644
--- a/documentation/_build/html/plugins.html
+++ b/documentation/_build/html/plugins.html
@@ -36,7 +36,6 @@
Tutorials
@@ -47,7 +46,7 @@
diff --git a/documentation/_build/html/project.html b/documentation/_build/html/project.html
index e9a6838..2ecf92b 100644
--- a/documentation/_build/html/project.html
+++ b/documentation/_build/html/project.html
@@ -47,7 +47,6 @@
Basic Types of Plugins
-Plugin Hooks
Plugin Anatomy
Tutorials
@@ -58,7 +57,7 @@
diff --git a/documentation/_build/html/search.html b/documentation/_build/html/search.html
index 9bcc5bb..165c99f 100644
--- a/documentation/_build/html/search.html
+++ b/documentation/_build/html/search.html
@@ -39,7 +39,6 @@
Tutorials
@@ -50,7 +49,7 @@
diff --git a/documentation/_build/html/searchindex.js b/documentation/_build/html/searchindex.js
index f81bb50..c689145 100644
--- a/documentation/_build/html/searchindex.js
+++ b/documentation/_build/html/searchindex.js
@@ -1 +1 @@
-Search.setIndex({docnames:["anatomy","api","build","contact","core_restricted","hooks","index","plugeth","plugin_hooks","plugin_loader","plugins","project","system_req","types","utils"],envversion:{"sphinx.domains.c":2,"sphinx.domains.changeset":1,"sphinx.domains.citation":1,"sphinx.domains.cpp":3,"sphinx.domains.index":1,"sphinx.domains.javascript":2,"sphinx.domains.math":2,"sphinx.domains.python":2,"sphinx.domains.rst":2,"sphinx.domains.std":1,"sphinx.ext.intersphinx":1,"sphinx.ext.todo":2,sphinx:56},filenames:["anatomy.rst","api.rst","build.rst","contact.rst","core_restricted.rst","hooks.rst","index.rst","plugeth.rst","plugin_hooks.rst","plugin_loader.rst","plugins.rst","project.rst","system_req.rst","types.rst","utils.rst"],objects:{},objnames:{},objtypes:{},terms:{"127":2,"350":[2,12],"8545":2,"break":6,"byte":1,"export":1,"final":1,"function":[1,4,9,11,13],"int":1,"long":11,"new":[1,2,6,11,13],"public":1,"return":[1,13],"true":1,"while":[1,11],And:1,But:[6,11],For:[1,11],The:[1,3,11],These:1,abl:1,abov:[1,13],access:[1,2],acress:1,added:[6,12],addit:6,addition:2,additon:1,address:1,against:1,ago:11,aim:11,all:[2,11],allow:[1,6],also:[11,13],alter:[1,11],analysi:11,anatomi:6,ani:[1,3],anxiou:3,apart:11,api:[2,6,13],append:[2,13],applic:[2,11],arbitrari:1,archetyp:0,architectur:[6,11],archtyp:13,arg:[1,13],argument:[1,13],arrai:1,avail:[2,13],avoid:[1,11],awar:6,backend:[1,13],basic:6,been:[2,11],begin:2,behav:11,behavior:[1,2,11,13],best:3,big:[1,11],binari:1,block:1,bool:1,box:11,breakdown:9,brief:1,build:[1,6],buildmod:2,built:[2,11],bulk:1,call:[1,2],can:[1,11,13],cannot:13,capabl:[1,6],captur:1,captureend:1,capturefault:1,capturest:1,capturestart:1,care:1,certain:1,challeng:11,chang:[2,11],channel:13,check:1,choos:[2,11],cli:1,client:[1,6,11],clone:2,cmd:2,come:11,command:[1,2,13],compact:2,compil:2,complet:2,concur:13,congradul:2,connect:[2,12,13],consensu:11,contact:6,contain:11,contant:13,content:2,context:[1,13],control:13,copi:[1,10,14],core:[1,6],correspond:1,cost:1,could:[1,11,13],cpu:[2,12],creat:[1,6,11],createsubscript:1,ctx:1,curl:2,custom:[11,13],data:[1,2,13],databas:1,debug:1,debug_tracecal:1,debug_tracetransact:1,decod:1,depend:[2,12],deploi:6,depth:1,design:6,detail:11,develop:[6,11],differ:[1,6,11],direct:11,directori:2,disabl:1,discord:3,discuss:[5,7],disect:0,disk:[2,12],doe:[1,11],don:1,download:2,dozen:2,drawback:11,drift:11,drop:3,due:1,durat:1,dure:1,each:[1,11],earli:6,easili:11,either:1,elabor:11,enabl:11,encod:1,end:1,enough:11,env:1,err:1,error:[1,13],especi:11,ethereum:[2,6,11,12],everyon:2,evm:[1,11],exactli:11,execut:1,exist:11,explain:1,explin:4,extend:[6,11],extract:11,fail:1,fairli:1,familiar:2,featur:11,file:2,fill:[0,11],first:[1,2],flag:[2,13],flagset:1,folder:2,follow:1,forese:12,fork:[2,6,11],framework:1,freebsd:12,friend:2,from:[1,2,3,6,11],func:1,funtion:2,furtur:6,futur:12,gas:1,gasus:1,gener:[1,11,13],get:[2,6],getapi:13,geth:[1,2,6,11,13],getresult:1,give:1,given:11,goal:11,golang:[1,11,12],guid:8,hand:11,has:[2,11],have:[1,2,3,6,11,12],hear:3,hello:[1,2,3],helloworld:1,help:[2,3],here:[1,11],histor:13,home:2,hook:[6,11],how:4,howev:2,http:[2,13],hybrid:13,idea:3,implement:[1,6,11,12],includ:2,info:2,inform:[11,13],initi:[2,13],input:1,insid:2,instal:11,intend:1,interest:11,interfac:1,invok:1,ipc:1,isstabl:6,its:[11,13],itself:1,json:[1,2,13],jsonrpc:[2,13],just:2,kei:1,largest:11,least:[2,12],less:6,like:[1,6,11],limit:13,line:[1,13],link:3,linux:12,list:2,livetrac:13,load:1,loader:[1,6,11,13],local:2,locat:[2,11],log:[1,2],logger:13,look:1,lot:13,maco:12,made:13,mai:[1,3],main:2,mainnet:[2,11,12],maintain:11,make:[6,11],mani:11,manipul:1,map:1,marshal:1,match:1,matter:11,mean:11,merg:11,method:[1,2],might:[1,6],miss:11,modifi:[1,11],modul:1,moment:2,more:[11,13],move:[2,11],must:[1,13],mymamespac:2,mynamespac:1,mynamespace_hello:2,mynamespace_helloworld:1,myservic:1,name:[1,13],namespac:1,namespace_subscrib:13,nativ:1,navig:2,need:[1,2,4,11,13],network:[2,11,12],next:2,nil:1,node:[1,2,13],non:1,note:1,notifi:1,now:6,number:[1,6,11],numer:11,object:1,obscur:11,occur:1,offici:6,onc:2,onli:[11,12],opcod:1,oper:[1,6,13],opportun:1,optim:11,option:1,order:[2,13],other:11,our:3,out:11,output:1,overview:6,own:[2,11,13],p2p:1,packag:[2,6,11],page:13,param:[2,13],pars:1,pass:[1,13],perspect:6,plan:6,plugeth:[1,2,3,12],plugethplugin:2,plugethutil:2,plugin:[1,6,12],pluginload:1,point:[1,2],popular:11,practic:2,premad:11,primari:2,primarili:11,problem:3,process:[1,2,11],produc:2,project:[2,6],properli:11,protocol:11,prove:11,provid:[1,2,11,13],quit:11,ram:[2,12],rather:[1,6,11],rdata:1,reach:3,read:2,readi:2,reason:11,reciev:13,redifin:13,refer:[1,6],regist:1,releas:6,reli:[12,13],repo:10,repositori:[2,7],repres:1,requir:[1,2,6,13],requirr:13,resid:11,respond:[1,2],respons:1,restirct:4,restrict:[1,6],result:[1,2,11],retian:1,reus:1,right:[6,11],rpc:[1,2],rpcsub:1,rule:11,run:[1,2,6,13],sai:3,scope:1,scopecontext:1,secur:11,see:[2,11],sens:11,sent:1,separ:1,seper:2,serializ:1,serv:[1,11],server:3,servic:[1,13],settl:6,should:[1,2,6,12],signatur:1,similar:1,simpl:1,singl:[1,11],singular:13,small:11,some:[1,6,11],someth:1,soon:1,space:2,specif:1,specifi:1,ssd:[2,12],stabl:[6,13],stack:1,stand:13,standard:[2,11],start:[1,2,13],still:6,stop:11,store:11,straight:1,string:1,struct:1,subscrib:1,subscript:1,subscriptionnam:13,support:[1,11,12],sure:1,system:[1,6,13],take:[1,2,13],team:[3,11],tend:11,testnet:11,than:[1,6,11],thankfulli:2,thei:[1,13],thi:[1,2,11,13],those:11,though:[2,11],three:2,through:[2,3],time:[1,2],todai:6,todo:[3,10,13,14],total:13,touch:6,trace:1,tracerresult:1,tracex:1,transact:1,tutori:[2,6],two:[1,2],type:[1,2,6],uint64:1,unexpect:1,unlik:12,unpredict:1,updat:[6,11],upon:13,upstream:[6,11],use:[1,2],used:[1,11],useful:[1,2],user:11,using:[1,6],util:6,valid:1,valu:1,vari:12,variabl:1,varieti:11,veri:1,verif:13,version:1,wai:[1,3,6,11,13],want:3,websocket:[1,13],well:[2,11],what:4,whatev:6,when:[1,11],wherea:13,which:[2,11,12,13],whichev:2,why:4,wide:[1,11],window:12,wish:1,within:1,without:[1,11],work:[3,13],world:[1,2],would:11,wrapper:11,write:8,written:11,yet:6,you:[1,2,3,6,12],your:[1,2,3,13],your_command:1},titles:["Plugin Anatomy","API","Build and Deploy","Get in touch with us","Core vs Restricted packages in Plugeth-utils","Plugin Hooks","PluGeth","PluGeth","Plugin Hooks","Plugin Loader","PluGeth Plugins","Project Design","System Requirements","Basic Types of Plugins","PluGeth Utils"],titleterms:{anatomi:0,api:1,basic:13,build:2,content:6,core:4,depend:11,deploi:2,design:11,environ:2,flag:1,get:3,getapi:1,hook:[5,8],initi:1,initializenod:1,livetrac:1,loader:9,method:13,packag:4,plugeth:[4,6,7,10,11,14],plugin:[0,2,5,8,9,10,11,13],project:11,repositori:11,requir:12,restrict:4,rpc:13,scheme:11,set:2,subcommand:[1,13],subscript:13,system:12,tabl:6,three:11,todo:[0,1,4,5,8,9,11],touch:3,tracer:[1,13],type:13,util:[4,11,14]}})
\ No newline at end of file
+Search.setIndex({docnames:["anatomy","api","build","contact","core_restricted","hooks","index","plugeth","plugin_hooks","plugin_loader","plugins","project","system_req","types","utils"],envversion:{"sphinx.domains.c":2,"sphinx.domains.changeset":1,"sphinx.domains.citation":1,"sphinx.domains.cpp":3,"sphinx.domains.index":1,"sphinx.domains.javascript":2,"sphinx.domains.math":2,"sphinx.domains.python":2,"sphinx.domains.rst":2,"sphinx.domains.std":1,"sphinx.ext.intersphinx":1,"sphinx.ext.todo":2,sphinx:56},filenames:["anatomy.rst","api.rst","build.rst","contact.rst","core_restricted.rst","hooks.rst","index.rst","plugeth.rst","plugin_hooks.rst","plugin_loader.rst","plugins.rst","project.rst","system_req.rst","types.rst","utils.rst"],objects:{},objnames:{},objtypes:{},terms:{"127":2,"350":[2,12],"8545":2,"break":6,"byte":[1,5],"case":5,"default":5,"export":1,"final":1,"function":[1,4,5,9,11,13],"import":[0,1],"int":1,"long":11,"new":[1,2,5,6,11,13],"public":[0,1,5],"return":[0,1,5,13],"true":[0,1,5],"var":[0,1],"while":[1,11],And:1,But:[6,11],For:[1,11],The:[1,3,5,11],These:1,abl:1,abov:[1,13],access:[1,2],account:5,acress:1,action:5,added:[6,12],addit:6,addition:2,additopackag:1,address:[1,5],against:1,ago:11,aim:11,all:[2,5,11],allow:[1,6],also:[11,13],alter:[1,11],alwai:5,analysi:11,anatomi:6,ancient:5,ani:[1,3,5],anxiou:3,apart:11,api:[0,2,6,13],append:[2,13],applic:[2,11],appropri:5,arbitrari:1,archetyp:0,architectur:[6,11],archtyp:13,arg:[1,13],argument:[1,5,13],arrai:1,assudden:5,avail:[2,13],avoid:[1,11],awar:6,backend:[0,1,13],basic:6,bear:5,becom:5,been:[2,5,11],beg:5,begin:2,behav:11,behavior:[1,2,5,11,13],being:5,best:[3,5],big:[1,11],binari:1,block:[1,5],blockchain:5,bodi:5,bool:1,both:5,box:11,breakdown:9,brief:1,broadli:5,build:[1,6],buildmod:2,built:[2,11],bulk:1,call:[1,2,5],can:[1,5,11,13],cannot:13,canon:5,capabl:[1,6],captur:[1,5],captureend:1,capturefault:1,capturest:1,capturestart:1,care:1,certain:1,challeng:11,chang:[2,5,11],channel:13,check:1,choos:[2,11],cli:[0,1],client:[1,6,11],clone:2,cmd:2,codebas:5,com:[0,1],come:11,command:[1,2,13],compact:2,compil:2,complet:2,concur:13,conflict:5,congradul:2,connect:[2,12,13],consensu:11,contact:6,contain:[5,11],contant:13,content:2,context:[0,1,13],control:13,convent:5,convers:5,copi:[1,10,14],core:[0,1,5,6],correspond:[1,5],cost:1,could:[1,11,13],cours:5,cpu:[2,12],creat:[1,6,11],createsubscript:1,ctx:[0,1],curl:2,custom:[11,13],data:[1,2,5,13],databas:[1,5],debug:1,debug_tracecal:1,debug_tracetransact:1,decod:1,defaultpluginload:5,defer:[0,1],deliv:5,depend:[2,12],deploi:6,depth:1,describ:5,design:6,destruct:5,detail:11,develop:[6,11],differ:[1,6,11],difficulti:5,direct:11,directori:2,disabl:1,discord:3,discuss:7,disect:0,disk:[2,12],doe:[1,11],don:1,download:2,dozen:2,drawback:11,drift:11,drop:3,due:1,durat:1,dure:[1,5],each:[1,5,11],earli:6,easili:11,either:1,elabor:11,element:5,enabl:11,encod:[1,5],end:1,enough:11,env:1,err:1,error:[1,13],especi:11,ethereum:[2,6,11,12],everyon:2,evm:[1,11],exactli:11,except:5,execut:1,exist:11,explain:1,explicitli:5,explin:4,extend:[6,11],extract:11,fail:1,fairli:1,fals:5,familiar:2,featur:11,file:2,fill:[0,11],first:[1,2,5],flag:[2,13],flagset:1,folder:2,follow:[1,5],forese:12,fork:[2,6,11],form:5,framework:1,freebsd:12,freezer:5,friend:2,from:[1,2,3,5,6,11],func:[0,1],funtion:2,furtur:6,futur:12,gas:1,gasus:1,gener:[1,11,13],get:[2,5,6],getapi:[0,13],geth:[1,2,5,6,11,13],getresult:1,github:[0,1],give:[1,5],given:11,goal:11,golang:[1,11,12],gopkg:[0,1],group:5,guid:8,hand:11,handler:5,has:[2,5,11],hash:5,have:[1,2,3,5,6,11,12],head:5,header:5,hear:3,hello:[0,1,2,3],helloworld:1,help:[2,3],here:[1,11],histor:13,home:2,hook:[6,11],hooknam:5,how:[4,5],howev:2,http:[2,13],hybrid:13,idea:3,implement:[1,5,6,11,12],includ:2,info:[0,1,2],inform:[5,11,13],initi:[0,2,5,13],inord:5,input:1,insid:2,instal:11,intend:1,interest:11,interfac:1,intermedi:5,invoc:5,invok:[1,5],ipc:1,isstabl:6,its:[5,11,13],itself:[1,5],json:[1,2,13],jsonrpc:[2,13],just:2,kei:[1,5],largest:11,latest:5,least:[2,12],less:6,letter:5,leveldb:5,like:[1,6,11],limit:13,line:[1,5,13],link:3,linux:12,list:2,livetrac:13,load:1,loader:[0,1,5,6,11,13],local:2,locat:[2,11],log:[0,1,2,5],logger:[0,1,13],look:1,lot:13,lower:5,maco:12,made:13,mai:[1,3,5],main:[0,1,2],mainnet:[2,11,12],maintain:11,make:[6,11],mani:11,manipul:1,map:[1,5],marshal:1,match:[1,5],matter:11,mean:11,merg:[5,11],method:[1,2,5],might:[1,6],minim:5,miss:11,modifi:[1,11],modul:1,moment:2,more:[11,13],move:[2,5,11],must:[1,13],mymamespac:2,mynamespac:[0,1],mynamespace_hello:2,mynamespace_helloworld:1,myservic:[0,1],nalli:1,name:[1,5,13],namespac:[0,1],namespace_subscrib:13,nativ:1,navig:2,need:[1,2,4,5,11,13],network:[2,11,12],next:2,nil:[1,5],node:[0,1,2,13],non:[1,5],note:[1,5],notifi:1,now:6,number:[1,5,6,11],numer:11,object:[1,5],obscur:11,occur:1,offici:6,onc:2,onli:[5,11,12],opcod:1,openrelayxyz:[0,1],oper:[1,6,13],opportun:1,optim:11,option:1,order:[2,13],other:11,our:3,out:11,output:1,overview:6,own:[2,11,13],p2p:1,packag:[0,1,2,6,11],page:13,param:[2,5,13],parent:5,parentroot:5,pars:1,pass:[1,5,13],perspect:6,plan:6,plugeth:[0,1,2,3,5,12],plugethplugin:2,plugethutil:2,plugin:[1,6,12],pluginload:[0,1,5],point:[1,2],popular:11,practic:2,premad:11,primari:2,primarili:11,prior:5,privat:5,problem:3,process:[1,2,5,11],produc:2,project:[2,6],properli:11,protocol:11,prove:11,provid:[1,2,5,11,13],quit:11,ram:[2,12],rather:[1,6,11],raw:5,rdata:1,reach:3,read:2,readi:2,realli:5,reason:11,receipt:5,reciev:13,redifin:13,refer:[1,5,6],referenc:5,regist:[1,5],releas:6,reli:[12,13],remov:5,reorg:5,repo:10,repositori:[2,7],repres:1,requir:[1,2,5,6,13],requirr:13,resid:11,respect:5,respond:[1,2],respons:1,restirct:4,restrict:[1,6],result:[1,2,11],retian:1,reus:1,right:[6,11],rlp:5,root:5,rpc:[1,2,5],rpcsub:1,rule:11,run:[1,2,5,6,13],sai:3,said:5,same:5,scope:1,scopecontext:1,secur:11,see:[2,11],seem:5,self:5,sens:11,sent:1,separ:1,seper:2,serializ:1,serv:[1,5,11],server:3,servic:[0,1,13],set:5,settl:6,sever:5,should:[1,2,5,6,12],signatur:[1,5],signitur:5,similar:1,simpl:1,singl:[1,5,11],singular:13,slimrlp:5,small:11,smart:5,snapshot:5,some:[1,6,11],someth:1,soon:1,space:2,specif:1,specifi:1,ssd:[2,12],stabl:[6,13],stack:1,stand:13,standard:[2,11],start:[1,2,13],state:5,still:6,stop:11,storag:5,store:[5,11],straight:1,string:[0,1],struct:[0,1],struggl:5,subscrib:1,subscript:1,subscriptionnam:13,subsystem:5,support:[1,11,12],sure:[1,5],system:[1,6,13],take:[1,2,13],team:[3,11],tend:11,testnet:11,than:[1,6,11],thankfulli:2,thei:[1,13],thi:[1,2,5,11,13],thing:5,those:11,though:[2,11],thought:5,three:2,through:[2,3],time:[1,2],todai:6,todo:[3,10,13,14],total:[5,13],touch:6,trace:1,tracerresult:1,tracex:1,track:5,transact:[1,5],transform:5,tutori:[2,6],two:[1,2],type:[0,1,2,6],uint64:1,understand:5,unexpect:[1,5],unlik:12,unpredict:1,updat:[5,6,11],upon:[5,13],upstream:[5,6,11],urfav:[0,1],use:[1,2],used:[1,11],useful:[1,2],user:11,using:[1,6],util:[0,1,5,6],valid:1,valu:1,vari:12,variabl:1,varieti:11,veri:1,verif:13,verifi:5,version:[0,1,5],wai:[1,3,6,11,13],want:3,warn:5,websocket:[1,13],well:[2,11],what:4,whatev:6,when:[1,5,11],wherea:13,which:[2,5,11,12,13],whichev:2,why:4,wide:[1,11],window:12,wish:1,within:[1,5],without:[1,11],work:[3,13],world:[0,1,2],would:11,wrapper:11,write:8,written:11,yet:6,you:[1,2,3,5,6,12],your:[1,2,3,13],your_command:1},titles:["Plugin Anatomy","API","Build and Deploy","Get in touch with us","Core vs Restricted packages in Plugeth-utils","Plugin Hooks","PluGeth","PluGeth","Plugin Hooks","Plugin Loader","PluGeth Plugins","Project Design","System Requirements","Basic Types of Plugins","PluGeth Utils"],titleterms:{anatomi:0,api:1,appendanci:5,basic:13,build:2,content:6,core:4,depend:11,deploi:2,design:11,environ:2,flag:1,get:3,getapi:1,getrpccal:5,hook:[5,8],initi:1,initializenod:1,livetrac:1,loader:9,method:13,newhead:5,packag:4,plugeth:[4,6,7,10,11,14],plugin:[0,2,5,8,9,10,11,13],project:11,repositori:11,requir:12,restrict:4,rpc:13,scheme:11,select:5,set:2,stateupd:5,subcommand:[1,13],subscript:13,system:12,tabl:6,three:11,todo:[0,1,4,8,9,11],touch:3,tracer:[1,13],type:13,util:[4,11,14]}})
\ No newline at end of file
diff --git a/documentation/_build/html/system_req.html b/documentation/_build/html/system_req.html
index 6d1f377..e18ab93 100644
--- a/documentation/_build/html/system_req.html
+++ b/documentation/_build/html/system_req.html
@@ -38,7 +38,6 @@
Tutorials
@@ -49,7 +48,7 @@
diff --git a/documentation/_build/html/types.html b/documentation/_build/html/types.html
index ea39434..0da3ebc 100644
--- a/documentation/_build/html/types.html
+++ b/documentation/_build/html/types.html
@@ -15,7 +15,7 @@
-
+
@@ -44,7 +44,6 @@
Subscriptions
-Plugin Hooks
Plugin Anatomy
Tutorials
@@ -55,7 +54,7 @@
@@ -123,7 +122,7 @@
diff --git a/documentation/_build/html/utils.html b/documentation/_build/html/utils.html
index d547ac5..3e167ba 100644
--- a/documentation/_build/html/utils.html
+++ b/documentation/_build/html/utils.html
@@ -36,7 +36,6 @@
Tutorials
@@ -47,7 +46,7 @@
diff --git a/documentation/api.rst b/documentation/api.rst
index ef3ee53..4f22e54 100644
--- a/documentation/api.rst
+++ b/documentation/api.rst
@@ -46,7 +46,7 @@ Tracers
.. code-block:: go
- ``// CaptureStart is called at the start of each transaction
+ // CaptureStart is called at the start of each transaction
CaptureStart(env core.EVM, from core.Address, to core.Address, create bool, input []byte, gas uint64, value *big.Int) {}
// CaptureState is called for each opcode
CaptureState(env core.EVM, pc uint64, op core.OpCode, gas, cost uint64, scope *vm.ScopeContext, rData []byte, depth int, err error) {}
@@ -55,12 +55,78 @@ Tracers
// CaptureEnd is called at the end of each transaction
CaptureEnd(output []byte, gasUsed uint64, t time.Duration, err error) {}
// GetResult should return a JSON serializable result object to respond to the trace call
- GetResult() (interface{}, error) {}``
+ GetResult() (interface{}, error) {}
.. warning:: Modifying the values passed into tracer functions can
alter the
- results of the EVM execution in unpredictable ways. Additonally, some objects may be reused acress calls, so data you wish to capture should be copied rather than retianed by reference.
+ results of the EVM execution in unpredictable ways. Additopackage main
+
+import (
+ "github.com/openrelayxyz/plugeth-utils/core"
+ "gopkg.in/urfave/cli.v1"
+)
+
+var (
+ log core.Logger
+)
+
+type myservice struct{}
+
+func (*myservice) Hello() string {
+ return "Hello world"
+}
+
+func Initialize(ctx *cli.Context, loader core.PluginLoader, logger core.Logger) {
+ log = logger
+ log.Info("Initialized hello")
+}
+
+func GetAPIs(node core.Node, backend core.Backend) []core.API {
+ defer log.Info("APIs Initialized")
+ return []core.API{
+ {
+ Namespace: "mynamespace",
+ Version: "1.0",
+ Service: &myservice{},
+ Public: true,
+ },
+ }
+}
+package main
+
+import (
+ "github.com/openrelayxyz/plugeth-utils/core"
+ "gopkg.in/urfave/cli.v1"
+)
+
+var (
+ log core.Logger
+)
+
+type myservice struct{}
+
+func (*myservice) Hello() string {
+ return "Hello world"
+}
+
+func Initialize(ctx *cli.Context, loader core.PluginLoader, logger core.Logger) {
+ log = logger
+ log.Info("Initialized hello")
+}
+
+func GetAPIs(node core.Node, backend core.Backend) []core.API {
+ defer log.Info("APIs Initialized")
+ return []core.API{
+ {
+ Namespace: "mynamespace",
+ Version: "1.0",
+ Service: &myservice{},
+ Public: true,
+ },
+ }
+}
+nally, some objects may be reused acress calls, so data you wish to capture should be copied rather than retianed by reference.
LiveTracer
----------
diff --git a/documentation/hooks.rst b/documentation/hooks.rst
index b7940ee..bbfb876 100644
--- a/documentation/hooks.rst
+++ b/documentation/hooks.rst
@@ -4,4 +4,61 @@
Plugin Hooks
============
-.. todo:: discussion of plugin hooks
+The key to understanding a plugin is understanding its corresponding hook. Broadly, plugin hooks can be thought of as functions which deliver a function signiture to the **plugin loader**. The signature matches that of the function(s) called by the plugin and describes the data that is being captured and how the plugin will deliver said data upon invocation.
+
+The public plugin hook function should follow the naming convention ``Plugin$HookName``. The first argument should be a `` core.PluginLoader``, followed by any arguments required by the functions to be provided by any plugins implementing this hook.
+
+**Public and Private Hook Functions**
+
+Each hook provides both a Public and private version. The private plugin hook function should bear the same name as the public plugin hook function, but with a lower case first letter. The signature should match the public plugin hook function, except that the first argument referencing the PluginLoader should be removed. It should invoke the public plugin hook function on plugins.DefaultPluginLoader. It should always verify that the DefaultPluginLoader is non-nil, log warning and return if the DefaultPluginLoader has not been initialized.
+
+**Invocation**
+
+the private plugin hook function should be invoked, with the appropriate arguments, in a single line within the Geth codebase inorder to minimize unexpected conflicts merging upstream Geth into plugeth.
+
+Selected Hooks
+--------------
+
+
+`StateUpdate`_
+************
+
+`Invocation`_
+
+The state update plugin provides a snapshot of the state subsystem in the form of a a stateUpdate object. The stateUpdate object contains all information transformed by a transaction but not the transaction itself.
+
+Invoked for each new block, StateUpdate provides the changes to the blockchain state. root corresponds to the state root of the new block. parentRoot corresponds to the state root of the parent block. destructs serves as a set of accounts that self-destructed in this block. accounts maps the hash of each account address to the SlimRLP encoding of the account data. storage maps the hash of each account to a map of that account's stored data.
+
+.. warning:: StateUpdate is only called if Geth is running with
+ ``-snapshots=true``. This is the default behavior for Geth, but if you are explicitly running with ``--snapshot=false`` this function will not be invoked.
+
+
+`AppendAncient`_
+*************
+
+Invoked when the freezer moves a block from LevelDB to the ancients database. ``number`` is the number of the block. ``hash`` is the 32 byte hash of the block as a raw ``[]byte``. ``header``, ``body``, and ``receipts`` are the RLP encoded versions of their respective block elements. ``td`` is the byte encoded total difficulty of the block.
+
+`NewHead`_
+**********
+
+Invoked when a new block becomes the canonical latest block. Note that if several blocks are processed in a group (such as during a reorg) this may not be called for each block. You should track the prior latest head if you need to process intermediate blocks.
+
+`GetRPCCalls`_
+************
+
+Invoked when the RPC handler registers a method call. returns the call ``id``, method ``name``, and any ``params`` that may have been passed in.
+
+
+
+**I am struggling all of assudden with if this is really this best course of action. Giving all of this reference, seems to beg the -utils vs plugeth conversation and I am not sure that is a smart thing to get into.**
+
+
+
+
+
+
+.. _StateUpdate: https://github.com/openrelayxyz/plugeth/blob/develop/core/state/plugin_hooks.go
+.. _Invocation: https://github.com/openrelayxyz/plugeth/blob/develop/core/state/statedb.go#L955
+.. _AppendAncient: https://github.com/openrelayxyz/plugeth/blob/develop/core/rawdb/plugin_hooks.go
+.. _GetRPCCalls: https://github.com/openrelayxyz/plugeth/blob/develop/rpc/plugin_hooks.go
+.. _NewHead: https://github.com/openrelayxyz/plugeth/blob/develop/core/plugin_hooks.go#L108
diff --git a/documentation/index.rst b/documentation/index.rst
index ab2fd8a..ac126ce 100644
--- a/documentation/index.rst
+++ b/documentation/index.rst
@@ -25,7 +25,6 @@ Table of Contents
project
types
- hooks
anatomy
@@ -41,7 +40,7 @@ Table of Contents
system_req
plugin_loader
- plugin_hooks
+ hooks
core_restricted
api