Giter Club home page Giter Club logo

beerus's Introduction


GitHub Workflow Status Project license Pull Requests welcome

Table of Contents

Roadmap

We have big plans for Beerus. Check out the Roadmap!

Beerus Roadmap

About

Beerus is a Starknet Light Client inspired by and using helios. The goal is to provide a simple and easy to use client to query Starknet state and interact with contracts.

Built With

Architecture

Here is a high level overview of the architecture of Beerus.

Beerus architecture

Simple usage overview

Here is a simple overview of how Beerus work. The example is for querying a storage value of a Starknet contract.

Beerus Query Contract Storage

Endpoint support

Here are all the endpoints supported by Beerus in tag v0.2.0

Starknet endpoints (20) (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_blockNumber βœ…
starknet_blockHashAndNumber βœ…
starknet_chainId βœ…
starknet_pendingTransactions βœ…
starknet_syncing βœ…
starknet_getEvents ❌
starknet_getNonce βœ…

Ethereum endpoints (21) (in compliance with Helios specs):

Endpoint Supported
eth_getBalance βœ…
eth_getTransactionCount βœ…
eth_getCode βœ…
eth_call ❌
eth_estimateGas βœ…
eth_getChainId βœ…
eth_gasPrice βœ…
eth_maxPriorityFeePerGas βœ…
eth_blockNumber βœ…
eth_getBlockByNumber βœ…
eth_getBlockByHash βœ…
eth_sendRawTransaction ❌
eth_getTransactionReceipt βœ…
eth_getLogs βœ…
eth_getStorageAt ❌
eth_getBlockTransactionCountByHash ❌
eth_getBlockTransactionCountByNumber βœ…
eth_coinbase βœ…
eth_syncing βœ…
eth_getTransactionByHash βœ…
eth_getTransactionByBlockHashAndIndex βœ…

Additional endpoints (8):

Endpoint Supported
starknet_l1_to_l2_messages βœ…
starknet_l1_to_l2_message_nonce βœ…
starknet_l1_to_l2_message_cancellations βœ…
starknet_l2_to_l1_messages βœ…
starknet_addDeclareTransaction ❌
starknet_addDeployAccountTransaction ❌
starknet_getContractStorageProof ❌
starknet_addInvokeTransaction ❌

Getting Started

Installation

Beerusup

To install with beerusup:

curl -sL https://raw.githubusercontent.com/keep-starknet-strange/beerus/main/beerusup | sh

Build

cargo build --all --release

Build beerus-core for WASM:

cargo build -p beerus-core --no-default-features --target wasm32-unknown-unknown --release

Test

cargo test --all

Config

The project requires an Ethereum node and a Starknet node. For Ethereum nodes you can use Alchemy (not Infura since it does not support getProof endpoint).

Ethereum execution layer RPC URL (must be an Ethereum provider that supports the eth_getProof endpoint).

Ethereum consensus layer RPC URL (must be a consensus node that supports the light client beacon chain api)

For Starknet node for the moment you can use Infura but soon verify proof will be implemented in Pathfinder nodes, and so will these nodes be working as well.

Env Var TOML Mainnet Goerli
ETHEREUM_NETWORK ethereum_network mainnet goerli(default)
ETHEREUM_EXECUTION_RPC_URL ethereum_consensus_rpc https://eth-mainnet.g.alchemy.com/v2/XXXXX https://eth-goerli.g.alchemy.com/v2/XXXXX
ETHEREUM_CONSENSUS_RPC_URL ethereum_execution_rpc https://www.lightclientdata.org http://testing.prater.beacon-api.nimbus.team
STARKNET_RPC_URL starknet_rpc https://starknet-mainnet.infura.io/v3/XXXXX https://starknet-goerli.infura.io/v3/XXXXX

To speed up the launch of the Ethereum client, it is recommended to set a more recent checkpoint. You can find one, for example, at this link: https://sync.invis.tools/.

Env Var TOML Mainnet
ETHEREUM_CHECKPOINT ethereum_checkpoint 0x419347336a423e0ad7ef3a1e8c0ca95f8b4f525122eea0178a11f1527ba38c0f
Config File

Beerus is configurable via a config toml. If you have set the env var BEERUS_CONFIG = path/to/config this will override all other environment variables and take configuration from values defined herein. Also the the cli can be directed via beerus --config <path/to/config>

goerli.toml

mainnet.toml

Environment Variables

Beerus is configurable through environment variables.

cp examples/.env.example .env
source .env

Examples

cargo run -p beerus-core --example basic

Using config from .toml file

BEERUS_CONFIG=path/to/config.toml cargo run -p beerus-core --example basic

Using Beerus as a Library

Beerus can be imported into any Rust project.

use beerus_core::{config::Config, lightclient::beerus::BeerusLightClient};
use env_logger::Env;
use eyre::Result;

#[tokio::main]
async fn main() -> Result<()> {
  env_logger::Builder::from_env(Env::default().default_filter_or("info")).init();
  let config = Config::from_env();

  let mut beerus = BeerusLightClient::new(config.clone()).await?;
  beerus.start().await?;

  let current_starknet_block = beerus.starknet_lightclient.block_number().await?;
  println!("{:?}", current_starknet_block);

  let current_ethereum_block = beerus
          .ethereum_lightclient
          .lock()
          .await
          .get_block_number()
          .await?;
  println!("{:?}", current_ethereum_block);
  Ok(())
}
Beerus RPC
cargo run --bin beerus-rpc
Beerus JS(wasm demo)

Dependencies:

  • npm
  • CORS bypass
  • local pathfinder node at http://localhost:9545
  • execution env var - ETHEREUM_EXECUTION_RPC_URL
cd crates/beerus-js

# 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

Work in progress

See the open issues for a list of proposed features (and known issues).

Support

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

Project assistance

If you want to say thank you or/and support active development of Beerus:

  • Add a GitHub Star to the project.
  • Tweet about the Beerus.
  • Write interesting articles about the project on Dev.to, Medium or your personal blog.

Together, we can make Beerus better!

Contributing

First off, thanks for taking the time to contribute! Contributions are what make the open-source community such an amazing place to learn, inspire, and create. Any contributions you make will benefit everybody else and are greatly appreciated.

Please read our contribution guidelines, and thank you for being involved!

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

πŸ’»
Add your contributions

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

beerus's People

Contributors

abdelstark avatar aragar199 avatar bigherc18 avatar clementwalter avatar danilowhk avatar dpinones avatar drspacemn avatar dubzn avatar eikix avatar enitrat avatar eytanlvy avatar fkrause98 avatar ftupas avatar glihm avatar godspower-eze avatar greged93 avatar irisdv avatar joshualyguessennd avatar kelvyne avatar lambdaclass-user avatar lancenonce avatar lucaslvy avatar ninja342 avatar phklive avatar pscott avatar robinstraub avatar somthn0somthn avatar tinoh9 avatar tonypony220 avatar zarboq avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.