bro is a bot that distributes rewards for blocks proposed by a Berachain validator.
On Berachain, each block proposal is rewarded with a certain amount of BGT tokens, to be distributed to reward vaults based on the block proposer's reward allocation settings. However, these rewards are not automatically distributed - they must be manually claimed by calling the rewards contract, which is a permissionless process. This is critical for validators to ensure that the BGT rewards they generate are not lost, particularly as the claim window is limited to the most recent 8191 blocks.
The Berachain Rewards Operator (bro) is a keeper service that automates the process of monitoring new blocks and distributing rewards in relevant blocks proposed by the validator to reward vaults. It is a Rust implementation of the base script provided by the Berachain team to illustrate the mechanics of the rewards distribution process.
Learn more about the rewards distribution process on Berachain: https://docs.berachain.com/nodes/guides/distribute-block-rewards
- Rust (1.84.0)
- Execution client (EL) RPC URL
- Consensus client (CL) RPC URL with the Beaconkit node API enabled
- A private key for a wallet with some BERA funds (needed to call
distributeForon the rewards contract)
Copy the .env.example file to .env and fill in the values. You can also set the environment variables directly.
cp .env.example .envRun the bot:
cargo runCreate a release:
cargo build --releaseRun the newly built release:
./target/release/bro