Nether plugins add JSON-RPC methods without a client fork
Nether customization can add JSON-RPC methods through the Nethermind Ethereum client's plugin framework without maintaining a client fork. A plugin supplies client-side code, while an RPC module defines the callable methods that applications use. Registration and access settings control different parts of that relationship. The extension must match its target client release, and its namespace must be enabled on the listener that receives requests. Loading an assembly alone does not make its methods available.
In short: An unhandled exception in a plugin event handler can bring down the node that hosts the extension.
The plugin and the RPC module have different jobs
A plugin connects custom code to client internals, while an RPC module defines an interface that applications can call. Nethermind already groups its RPC methods into namespaces by purpose. Adding a custom module extends that query surface through the existing JSON-RPC service. The application addresses a method; the plugin connects its implementation to the node.
Existing methods may already provide the required operation, with configuration controlling their availability. A plugin becomes relevant when the required behavior needs additional code or an existing extension point. Keeping that code outside a client fork avoids maintaining a separate modified client codebase. Compatibility with later releases remains a separate concern.
Eight extension points place custom logic inside the client
The framework covers eight extension areas, so JSON-RPC is one part of a broader integration model. Their names describe different places where custom code meets the client:
- RPC and CLI extensions address application access and command interactions.
- Block tree visitors and state visitors inspect different views of chain data.
- devp2p extensions address peer communication, while transaction-pool extensions address pending-transaction behavior.
- Tracers inspect Ethereum Virtual Machine (EVM) execution, and configuration extensions expose settings for custom behavior.
The required operation determines the relevant interface. A new application method belongs at the RPC boundary. An analysis of execution details involves tracing.
RPC interfaces define method names and result types
A custom RPC module declares its callable methods through an interface derived from
IRpcModule
, with a class supplying the implementation.
Method contracts
The
RpcModule
attribute gives the module its configuration name. Method declarations define the RPC method names and their typed arguments. The namespace name used for configuration and the method name carried in a request serve related but different purposes. Keeping both explicit makes the exposed API easier to maintain.
Success and failure responses
Methods return
ResultWrapper<T>
, where
T
identifies the response data type. An asynchronous method returns
Task<ResultWrapper<T>>
. The wrapper supports success and failure results, allowing the implementation to report an invalid operation through its response contract. A handler still needs meaningful input rules; the wrapper supplies the response structure, not the rules themselves.
Registration uses the interface type
The module provider's
RegisterSingle<T>()
method expects
T
to be the RPC interface. Passing an implementation with its concrete class inferred as the type can produce a module-factory type error. Registering through the interface keeps discovery aligned with the declared RPC contract.
Initialization connects enabled plugins to client services
Nethermind loads plugin assemblies during startup, then uses activation and initialization mechanisms to connect their code to client services.
Assembly discovery and activation
Plugins are .NET assemblies stored as
.dll
files.
Only plugins whose
Enabled
property returns
true
proceed to initialization in Nethermind 2.0.0.
Discovery therefore establishes that the client found an extension, while activation determines whether its initialization runs.
Startup dependencies
The
INethermindPlugin
interface provides separate hooks for main initialization, networking and RPC modules. Its optional
Module
property supports Autofac service registration and initialization steps. Those steps can declare dependencies that control startup order. An extension that needs blockchain services must respect those dependencies rather than assume every service exists at the earliest hook.
RPC module registration belongs in
InitRpcModules()
. That hook connects the implementation to the module provider; listener configuration determines whether applications can reach it.
Plugin discovery and listener settings control RPC availability
Seven settings distinguish plugin discovery from RPC service availability and listener scope. The values below describe Nethermind 2.0.0 configuration defaults; explicit settings and selected configuration files can change the effective values.
| Parameter | Documented default | What the setting controls |
|---|---|---|
--plugins-dir
|
plugins
|
Directory containing plugin assemblies |
JsonRpc.Enabled
|
false
|
JSON-RPC service activation |
JsonRpc.EnabledModules
|
[Eth,Subscribe,Trace,TxPool,Web3,Proof,Net,Parity,Health,Rpc]
|
Namespaces available on the default listener |
JsonRpc.Host
|
127.0.0.1
|
Service binding to the local loopback interface |
JsonRpc.Port
|
8545
|
HTTP listener port |
JsonRpc.AdditionalRpcUrls
|
[]
|
Additional listeners with their own transports and namespace lists |
Init.WebSocketsEnabled
|
true
|
WebSocket startup on the default JSON-RPC port when HTTP is enabled |
| Combined scope | Plugin loading and RPC exposure have separate controls | Namespace access applies to the listener receiving the request |
The default namespace list does not automatically include a custom module. Changing the plugin directory also requires preserving the bundled plugins needed by the deployment.
Why does a registered RPC method return a disabled-namespace error?
A registered method can return error code
-32600
when its namespace is disabled on the listener receiving the request.
The accompanying message can identify a method that the server found while naming its disabled namespace. That observation differs from a failure to discover the assembly or register the method. Rebuilding a correctly registered handler does not address a listener that excludes its namespace.
The default listener uses
JsonRpc.EnabledModules
. Additional listeners use the transport and namespace lists in
JsonRpc.AdditionalRpcUrls
. Enabling a namespace for one endpoint does not establish access through every other endpoint.
HTTP, WebSocket and IPC provide different transports for RPC communication. Transport availability and namespace availability remain separate settings. Once a request reaches an enabled handler, the handler's own validation determines whether its arguments describe an allowed operation.
Historical RPC methods inherit the retained-data boundary
A custom handler that queries historical state depends on the history its node actually retains for the requested block. In Nethermind 2.0.0, state-history settings and block-and-receipt settings govern different data. Historical balance reads and historical log queries therefore have different storage dependencies. An RPC extension does not reconstruct missing history merely by exposing a new method name. Snap sync can capture history from its pivot onward, while pruning choices determine the history that remains available.
Historical
eth_getProof
support in Nethermind 2.0.0 requires unwindowed flat history.
The proof-building and proof-serving switches are independent, and the commitment layer must cover the requested height. Rolling and since-block retention do not support those historical-proof switches. Built-in historical queries outside their retained range or proof coverage return an error. A custom interface must preserve that failure condition instead of substituting live state for the historical answer.
Tracers and visitors inspect different parts of a node
Tracers examine transaction execution, while block tree and state visitors support analysis of different stored data.
A block tree visitor traverses the block tree, supporting calculations across its contents. A state visitor examines raw state, potentially covering the whole state or selected account storage. These extension points suit different data questions, even when an application eventually exposes their output through RPC.
Execution tracing follows the state changes produced by transactions. Ordinary archive replay respects transaction order because each transaction starts from the state left by preceding transactions. Nethermind 2.0.0 can accelerate supported traces with its optional per-transaction changeset index. The index supplies the required transaction-prefix state; it does not change the transactions' logical execution order. JavaScript tracers retain sequential replay.
Upstream releases can change plugin compatibility
Nethermind 2.0.0 includes breaking changes that matter to plugin authors, custom configurations and archive operators. Separating custom code from the client avoids maintaining a fork, while leaving the extension responsible for compatibility with its target release.
Nethermind.ReferenceAssemblies
provides the API references needed to compile a plugin. Its package version follows the client version, and the plugin guidance specifies a package version no higher than the target client. Referencing checked-out client projects offers another development route, though upgrades can expose assembly-version mismatches. Compilation references alone do not supply a running node or establish that every custom behavior remains compatible after an upgrade.
Failures in plugin code can affect the running node
Plugin event handlers run against client objects, so unhandled exceptions can affect the node rather than only one application request. Errors raised from hooks on core objects such as the block processor or block tree can bring the node down. Plugin authors must handle exceptions in those event handlers.
The
MustInitialize
property controls a separate startup condition. In Nethermind 2.0.0, it defaults to
false
; when it is
true
, plugin initialization failure prevents client startup. This setting does not protect a running node from every exception that custom code may raise later.
Before you start with Nether
Can a custom RPC plugin replace the Ethereum consensus client?
A custom RPC plugin does not replace the consensus client needed alongside Nethermind for an Ethereum node. The extension adds behavior within the execution client. The consensus client follows Ethereum's proof-of-stake chain and handles consensus duties, which remain separate from an application's custom RPC methods.
Does a configurable plugin require its own configuration file?
A configurable plugin can use Nethermind's configuration system without a separate configuration file. Plugin settings can map to command line options, environment variables and configuration-file entries. Their configuration interface follows the I{PluginName}Config naming convention, which lets the client map the settings to the corresponding plugin configuration.
Are custom RPC namespace names case-sensitive in the enabled-modules setting?
RPC namespace names are case-insensitive in the documented enabled-modules setting. That behavior concerns the namespace list used to permit RPC access. Keep the declared method names and typed parameters consistent with the module's interface; namespace configuration does not rename the methods that an application calls.
Which debugging approach suits an issue inside the client rather than the plugin?
Debugging the plugin alongside the Nethermind codebase allows inspection of client internals as well as extension code. Attaching a debugger to an installed process suits work focused on the plugin itself. The first approach requires the client source and a development setup that builds the relevant projects together.
How can a custom RPC interface remain accessible only on the same machine?
An IPC socket provides local RPC communication without exposing the interface to external network traffic. Nethermind also binds its HTTP RPC service to loopback by default. Retaining that binding limits direct network access, while the chosen transport still requires the appropriate RPC namespace configuration.
Updated on