A plugin that allows a leader to share the state with one or more followers.
Since the leader is trusted, the follower can operate in light mode and only contains the flat database, not the trie. The follower only needs to retrieve the trie logs from the leader and apply them to its database without having to validate or process the transactions.
Use the Gradle wrapper to build the plugin:
./gradlew build
Then, run the besu with leader mode:
/bin/besu --data-storage-format=BONSAI \
--plugin-fleet-node-role=LEADER \
--rpc-http-apis=FLEET,ETH \
--rpc-http-enabled \
--rpc-http-host=127.0.0.1
--rpc-http-port=8545
Or, run the besu with follower mode:
/bin/besu --data-storage-format=BONSAI \
--data-path="workdir/besu-follower/data" \
--Xbonsai-full-flat-db-enabled=true \
--plugin-fleet-node-role=FOLLOWER \
--p2p-port=40404 \
--rpc-http-apis=FLEET,ETH \
--rpc-http-enabled \
--rpc-http-host=127.0.0.1 \
--rpc-http-port=8888 \
--engine-rpc-port=8661 \
--Xchain-pruning-blocks-retained=512 \
--plugin-fleet-leader-http-host=127.0.0.1 \
--plugin-fleet-leader-http-port=8545
--plugin-fleet-follower-http-host=127.0.0.1 \
--plugin-fleet-follower-http-port=8888
The latest plugin release version is available on the releases page.
To use a release version, follow these steps:
- Download the plugin jar.
- Create a plugins/ folder in your Besu installation directory.
- Copy the plugin jar into the plugins/ directory.
- Start Besu with the Fleet-specific configurations listed below.
Besu will autodetect the presence of the plugin and load and configure it at startup. However some additional configuration is to ensure besu and fleet can communicate.
The plugin registers an additional RPC namespace FLEET for Fleet to query Besu for trielogs. Enable this namespace in Besu's configuration through the --rpc-http-api config option.
To build the plugin from source and run tests, use the following command:
./gradlew build
The resulting JAR file will be located in the build/libs directory.
After building from source, you can install the plugin on an existing Besu installation. Here's how to do that:
-
Create a plugins directory in your Besu installation directory, if one doesn't already exist:
mkdir -p /opt/besu/plugins -
Copy the built JAR file into the plugins directory: mkdir -p /opt/besu/plugins
cp build/libs/besu-fleet-plugin-0.1.0.jar /opt/besu/plugins
Here are the steps for releasing a new version of the plugin:
- Create a release from github. Select the branch you want and create the tag name there (click create new tag)
- GitHub Actions will automatically create the release artifacts and update the release notes
Note: Release tags (of the form v*) are protected and can only be pushed by organization and/or repository owners.