keep-starknet-strange / beerus

Beerus is a trustless StarkNet Light Client ⚡blazing fast ⚡ and powered by Rust 🦀

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

CI Action Status License: MIT Check Workflow Status

Beerus

Beerus is a Starknet Light Client inspired by and using helios.

See the Beerus Book for more info.

Getting Started

cargo build --release

# insert valid api keys
./target/release/beerus -c examples/conf/beerus.json

# wait for server to start
hurl examples/rpc/starknet_getStateRoot.hurl

Config

Beerus relies on TWO untrusted RPC endpoints. As these are untrusted they will typically not be nodes run on your local host or your local network. These untrusted RPC providers must adhere to both the l1 eth_getProof endpoint as well as the l2 pathfinder_getProof endpoint. For this we recommend using Alchemy as your untrusted L2 node provider.

NOTE: we rely on helios for both valid checkpoint values and consensus rpc urls

field example description
network MAINNET or GOERLI network to query
eth_execution_rpc https://eth-mainnet.g.alchemy.com/v2/YOURAPIKEY untrusted l1 node provider url
starknet_rpc https://starknet-mainnet.g.alchemy.com/v2/YOURAPIKEY untrusted l2 node provider url
data_dir tmp OPTIONAL location to store both l1 and l2 data
poll_secs 5 OPTIONAL seconds to wait for querying sn state
rpc_addr 127.0.0.1:3030 OPTIONAL local address to listen for rpc reqs
fee_token_addr 0x049d36...e004dc7 OPTIONAL fee token to check for getBalance

Development

Build

cargo build --all --release

Test

cargo test --all

Docker

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

Examples (currently broken on Helios deps)

cd examples/core
cargo run --example basic
cargo run --example call
Beerus JS(wasm demo)

Dependencies:

  • npm
  • CORS bypass
  • local pathfinder node at http://localhost:9545
  • execution env var - ETH_EXECUTION_RPC
cd examples/wasm

# install node deps
npm i

# build webpack & wasm modules
npm run build

# run example
./run.sh

# navigate browser to http://localhost:8080
# open developer console

Endpoint support

Starknet endpoints (in compliance with Starknet specs):

Endpoint Supported
starknet_getBlockWithTxHashes
starknet_getBlockWithTxs
starknet_getStateUpdate
starknet_getStorageAt
starknet_getTransactionByHash
starknet_getTransactionByBlockIdAndIndex
starknet_getTransactionReceipt
starknet_getClass
starknet_getClassHashAt
starknet_getClassAt
starknet_getBlockTransactionCount
starknet_call
starknet_estimateFee
starknet_estimateFeeSingle
starknet_blockNumber
starknet_blockHashAndNumber
starknet_chainId
starknet_pendingTransactions
starknet_syncing
starknet_syncing
starknet_getEvents(not validated)
starknet_getNonce
starknet_addDeclareTransaction
starknet_addDeployAccountTransaction
starknet_addInvokeTransaction
starknet_getProof
starknet_getBalance
starknet_getStateRoot

Support

Reach out to the maintainer at one of the following places:

Security

Beerus follows good practices of security, but 100% security cannot be assured. Beerus is provided "as is" without any warranty. Use at your own risk.

_For more information and to report security issues, please refer to our security documentation.

Acknowledgements

  • Huge props to A16z for their work on helios.

Contributors ✨

The contributors page.

Thanks goes to these wonderful people (emoji key):

Abdel @ StarkWare
Abdel @ StarkWare

⚠️ 💻
Lucas @ StarkWare
Lucas @ StarkWare

💻
danilowhk
danilowhk

💻
Clément Walter
Clément Walter

💻
Elias Tazartes
Elias Tazartes

💻
drspacemn
drspacemn

💻
Mathieu
Mathieu

💻
TurcFort07
TurcFort07

📖
Florian Bellotti
Florian Bellotti

💻
Tom Brand
Tom Brand

💻
ftupas
ftupas

💻
pscott
pscott

💻
Robin Straub
Robin Straub

💻
Francisco Krause Arnim
Francisco Krause Arnim

📖
joshualyguessennd
joshualyguessennd

📖
Santiago Galván (Dub)
Santiago Galván (Dub)

💻
chirag-bgh
chirag-bgh

💻
greged93
greged93

💻
bigherc18
bigherc18

💻
Lakhdar Slaim
Lakhdar Slaim

💻
Lance N. Davis
Lance N. Davis

💻
Tino Huynh
Tino Huynh

💻
Iris
Iris

💻
Alex Ponce
Alex Ponce

💻
glihm
glihm

💻
Paul-Henry Kajfasz
Paul-Henry Kajfasz

💻
Damián Piñones
Damián Piñones

💻
Betacodd
Betacodd

💻
Godspower-Eze
Godspower-eze

💻
somthn0somthn
somthn0somthn

💻
tonypony220
tonypony220

💻
Add your contributions

This project follows the all-contributors specification. Contributions of any kind welcome!

About

Beerus is a trustless StarkNet Light Client ⚡blazing fast ⚡ and powered by Rust 🦀

License:MIT License


Languages

Language:Rust 75.0%Language:Handlebars 21.9%Language:Shell 2.0%Language:Dockerfile 1.0%Language:CSS 0.1%