Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR outlines an idea for a new plugin system that allows 3rd parties to build plugins that hook into go-ethereum on a node level, compared to the tracing hooks that allow to hooking into the transaction processing level. The work is inspired by Peters work on ExEx style plugins.
A plugin must implement the following methods:
Which allows the node to trigger an update on the plugin whenever the state of the canonical chain changes. This way the plugin can react to new heads and reorgs. It also allows the plugin to install and un-install other hooks (right now only tracing.Hooks are supported, but this could be extended in the future to allow for other hooks).
The plugin needs to store the
Chain
object that is passed on startup and can use it to get information about the current state of the chain.The chain interface provides the following functionality which allows the plugin to read the chain:
The most important function is the
State(root common.Hash) State
which provides access to a state with a certain root. This object should not be long lived, as storing it will interfere with garbage collection. The State object provides access to data concerning a single state:With this object, the plugin can iterate over all accounts and retrieve specific accounts that its interested in. Again the accounts should not be long-lived as they hold references to the state. The account object provides access to all data belonging to a specific account: