Beerus

Beerus Beerus

Beerus is a Starknet Light Client inspired by and using helios. It is designed to be simple, modular, and fast, supporting the Starknet v0.6.0 OpenRPC spec.

Getting Started

Running Beerus for the First Time

Copy the configuration file from etc/conf/beerus.toml and set up the RPC provider URLs in the copy. Make sure that providers are compatible. Read more about providers here.

Run the following command to start Beerus:

cargo run --release -- -c ./path/to/config.toml

To verify that Beerus is up and running, try this request:

curl -H 'Content-type: application/json' -d '{
    "jsonrpc": "2.0",
    "method": "starknet_getStateRoot",
    "params": [],
    "id": 1
}' http://127.0.0.1:3030
{
  "jsonrpc": "2.0",
  "result": "0x539895aff28be4958188c1d4e8e68ee6772bdd49dd9362a4fbb189e61c54ff1",
  "id": 1
}

Configuration

FieldExampleDescription
networkMAINNET or SEPOLIANetwork to query
eth_execution_rpchttps://eth-mainnet.g.alchemy.com/v2/{YOUR_API_KEY}Untrusted L1 node provider URL
starknet_rpchttps://starknet-mainnet.g.alchemy.com/starknet/version/rpc/v0.6/{YOUR_API_KEY}Untrusted L2 node provider URL
data_dirtmpOPTIONAL: Location to store both L1 and L2 data
poll_secs5OPTIONAL: Seconds to wait for querying SN state (min: 1, max: 3600)
rpc_addr127.0.0.1:3030OPTIONAL: Local address to listen for RPC requests
fee_token_addr0x049d36...e004dc7OPTIONAL: Fee token to check for getBalance

Ensure that eth_execution_rpc and starknet_rpc URLs correspond to the selected network (MAINNET or SEPOLIA).

RPC Providers

Beerus relies on two untrusted RPC endpoints:

  • Starknet RPC endpoint: Requires v0.6.0 of the Starknet OpenRPC specs and support for Pathfinder's extension API.
  • Ethereum RPC endpoint: No special requirements; must support Ethereum JSON-RPC Specification.

Development

Build

cargo build --all --release

Test

cargo test --all

Docker

Build the Docker image:

docker build . -t beerus

Run the Docker container:

docker run -e NETWORK=<arg> -e ETH_EXECUTION_RPC=<arg> -e STARKNET_RPC=<arg> -it beerus

Examples

Run examples with:

ALCHEMY_API_KEY='YOURAPIKEY' cargo run --example basic
ALCHEMY_API_KEY='YOURAPIKEY' cargo run --example call

Similar Projects

Rustfinity.com

Links

  1. Home
  2. Learn Rust
  3. Get Started
  4. Practice Rust
  5. Challenges
  6. Tutorials
  7. Blog
  8. Open source
  9. Learn Gleam

Socials

  1. GitHub
  2. X

Legal

  1. Privacy Policy
  2. Terms of Service