Skip to content
You are reading Hyperledger Besu development version documentation and some displayed features may not be available in the stable release. You can switch to stable version using the version box at screen bottom.
Date of last update: August 8, 2022

Permissioning plugin

You can define complex permissioning solutions by building a plugin that extends Hyperledger Besu functionality.

The plugin API provides a PermissioningService interface that currently supports connection permissioning and message permissioning.

Connection permissioning

Use connection permissioning when deciding whether to restrict node access to known participants only.

Message permissioning

Use message permissioning to propagate different types of devP2P messages to particular nodes. For example, this can be used to prevent pending transactions from being forwarded to other nodes.

Register your plugin

To enable permissioning in your plugin, implement the PermissioningService interface and register your providers.

@AutoService(BesuPlugin.class)
public class TestPermissioningPlugin implements BesuPlugin {
    PermissioningService service;

    @Override
    public void register(final BesuContext context) {
        service = context.getService(PermissioningService.class).get();
    }

    @Override
    public void start() {
        service.registerNodePermissioningProvider((sourceEnode, destinationEnode) -> {
            // perform logic for node permissioning
            return true;
        });

        service.registerNodeMessagePermissioningProvider((destinationEnode, code) -> {
            // perform logic for message permissioning
            return true;
        });
    }

    @Override
    public void stop() {}
}