Skip to main content

Plugin API interfaces

API interfaces in Besu allow users to build plugins to extend Besu functionality.

For more information about the available interfaces, see the Plugin API Javadoc.

Javadoc issue

The plugin API documentation is currently not being updated. We're working on a fix, but in the meantime, some links are temporarily pointing to wiki.hyperledger.org.

Core plugin classes

The following table lists the interfaces providing core plugin classes.

InterfaceDescription
BesuContextAllows plugins to access Besu services.
BesuPluginUsed to manage the plugin lifecycle.

Plugin services

The following table lists interfaces providing services you can retrieve.

InterfaceDescription
BesuEventsAllows plugins to attach to events during Besu operation.
BesuConfigurationProvides file system locations of Besu's storage.
IbftQueryServiceAllows query of the IBFT 2.0 aspects of the blockchain.
MetricCategoryRegistryAdds a new metrics category to the CLI.
MetricsSystemRegister metrics with the Prometheus endpoint.
PoaQueryServiceQuery the current state of Clique and IBFT 2.0 consensus protocols.
PicoCLIOptionsAdds CLI commands to the Besu command line.
SecurityModuleServiceAllows plugins to register a security module.
StorageServiceAllows plugins to register as a storage engine. For example, to connect to a hardware security module (HSM).
PermissioningServiceAllows for fine grain control of node connection and node messaging permissioning.
PrivacyPluginServiceProvides a way to define how privacy marker transactions are created, and what private genesis to use.
RpcEndpointServiceRegister custom RPC endpoints.

To use the interfaces in your plugin, ensure the Gradle build file contains the https://hyperledger.jfrog.io/hyperledger/besu-maven repository and the plugin-api dependency.

Known issue

As indicated in issue #406, plugins may need to access the parsed command line during registration, but the command line is not yet initialized at this stage.

It's in our roadmap to improve lifecycle steps and provide additional visibility for some data. A workaround is to create a supplier during the register step and store it in memory.

The start step can be ignored and your plugin module will be instantiated when the command line interface is parsed and available.