Commit-Boost / commit-boost-client

Commit-Boost allows Ethereum validators to safely run MEV-Boost and community-built commitment protocols
https://commit-boost.github.io/commit-boost-client/
Apache License 2.0
80 stars 33 forks source link

Commit-Boost

A new Ethereum validator sidecar focused on standardizing the last mile of communication between validators and third-party protocols.

Docs | X (Twitter)

Overview

Commit-Boost is a modular sidecar that allows Ethereum validators to opt-in to different commitment protocols

For node operators

For more information on how to run Commit-Boost, check out our docs.

For developers

For more information on how to develop a module on Commit-Boost, check out our docs.

Example

NOTE: The code is unaudited and NOT ready for production. All APIs are subject to change

A basic commit module with Commit-Boost.

Add the commit-boost crate to your Cargo.toml:

commit-boost = { git = "https://github.com/Commit-Boost/commit-boost-client", rev = "..." }

Then in main.rs:

use commit_boost::prelude::*;

#[derive(Debug, TreeHash)]
struct Datagram {
    data: u64,
}

#[tokio::main]
async fn main() {
    let config = load_commit_module_config::<()>().unwrap();
    let pubkeys = config.signer_client.get_pubkeys().await.unwrap().keys;

    let pubkey = *pubkeys.consensus.first().unwrap().consensus;

    let datagram = Datagram { data: 42 };
    let request = SignConsensusRequest::builder(pubkey).with_msg(&datagram);
    let signature = config
        .signer_client
        .request_consensus_signature(&request)
        .await
        .unwrap();

    println!("Data: {datagram:?} - Commitment: {signature}");
}

Finally, create a Docker image with your binary, e.g. my_commit_module, and add it to the cb-config.toml file:

[[modules]]
id = "MY_MODULE"
docker_image = "my_commit_module"

For a more detailed example check out here and our docs on how to setup Commit-Boost for development.

Acknowledgements

License

MIT + Apache-2.0