A crate for working with Ethereum beacon chain light client protocol messages. `no_std` friendly!

Overview

eth-lightclient-rs

A crate for working with Ethereum beacon chain light client protocol messages. no_std friendly!

!! For hacking and experimentation only. This is NOT production ready code !!

This can be used to deserialize and inspect SSZ encoded SyncCommitteePeriodUpdate messages that are retrieved from a full node RPC. It can also be used to verify a transition between two adjacent sync period updates is valid using check_sync_committee_period_update.

Usage

SSZ encoded SyncCommitteePeriodUpdates can be deserialized using the try_from with a byte slice.

use eth_lightclient::SyncCommitteePeriodUpdate;

const BYTES: &[u8] = include_bytes!(
    "../tests/sync-updates/0xe4c2cee3a9455c2b7c0449152a8c7e1a7b811353e4ea2c1dbe1cbe0c790b45f7"
);

let update = SyncCommitteePeriodUpdate::try_from(BYTES);

Adjacent period updates can be verified given a chain validators root. This checks that:

  • The second update has enough signatures
  • The signatures are from the committee defined in the prior update
  • The next sync committee proof is valid with respect to the finalized block root
  • .. some other stuff

From a trusted finalized block root and committee in one sync period this allows proving that a new committee and finalized block root in the next sync period can also be trusted. This allows a light client to jump to a new trusted block root every sync period.

use eth_lightclient::{
    SyncCommitteePeriodUpdate, H256,
    check_sync_committee_period_update,
    constants::mainnet::VALIDATORS_ROOT,
};

const A: &[u8] = include_bytes!(
    "../tests/sync-updates/0xe4c2cee3a9455c2b7c0449152a8c7e1a7b811353e4ea2c1dbe1cbe0c790b45f7"
);
const B: &[u8] = include_bytes!(
    "../tests/sync-updates/0x78ae69239826edd5ac0abfe3a69e916e7479ad44e834e35a08e4df7601732a85"
);

check_sync_committee_period_update(
    SyncCommitteePeriodUpdate::try_from(A).unwrap(),
    SyncCommitteePeriodUpdate::try_from(B).unwrap(),
    H256(VALIDATORS_ROOT),
) // returns Ok(())

Authors

  • Willem Olding (ChainSafe Systems)
  • Eric Tu (ChainSafe Systems)
  • Cayman Nava (ChainSafe Systems)

Acknowledgements

This crate was developed as part of the EthBogota hackathon for the project Zipline. Zipline is a trustless Eth beacon chain to EVM bridge that uses the beacon chain protocol.

Credit to the original authors of the sync period verification - Snowfork. Their original implementation was tightly coupled to the Substrate ecosystem and not useable outside of that context hence the refactor.

You might also like...
MangoBOX is a fork and upgrade of fund-raising protocol Juicebox on Ethereum.

Mangoboxink MangoBOX is a fork and upgrade of fund-raising protocol Juicebox on Ethereum. It rewrites the logic and functions of Juicebox in the smart

Basilisk node - cross-chain liquidity protocol built on Substrate

Basilisk node Local Development Follow these steps to prepare a local Substrate development environment 🛠️ Simple Setup Install all the required depe

The protocol are designed and made for the future of cross-IP, cross-chain metaverse.

Avatar-protocol 化身协议 This project demonstrates how to use the Solana Javascript API to interact with programs on the Solana blockchain. The project co

An open source desktop wallet for nano and banano with end-to-end encrypted, on chain messaging using the dagchat protocol.
An open source desktop wallet for nano and banano with end-to-end encrypted, on chain messaging using the dagchat protocol.

An open source wallet with end-to-end encrypted, on chain messaging for nano and banano using the dagchat protocol.

Built for Perpetual Protocol v2 Curie on Optimism chain. This CLI tool was built with Rust.
Built for Perpetual Protocol v2 Curie on Optimism chain. This CLI tool was built with Rust.

Perpetual Protocol CLI for Perp v2 Curie This tool is to provide a simple, fast and efficient way to interact Perpetual Protocol contracts from your t

Helpers crate to simplify ink! chain extension development

OpenBrush Chain Extension library The library provides tools and primitives to simplify the development of chain extensions for ink! and for the subst

`llm-chain` is a powerful rust crate for building chains in large language models allowing you to summarise text and complete complex tasks

llm-chain 🚀 llm-chain is a collection of Rust crates designed to help you work with Large Language Models (LLMs) more effectively. Our primary focus

Rust Ethereum 2.0 Client
Rust Ethereum 2.0 Client

Lighthouse: Ethereum 2.0 An open-source Ethereum 2.0 client, written in Rust and maintained by Sigma Prime. Documentation Overview Lighthouse is: Read

Rust client to Opensea's APIs and Ethereum smart contracts

opensea.rs Rust bindings & CLI to the Opensea API and Contracts CLI Usage Run cargo r -- --help to get the top level help menu: opensea-cli 0.1.0 Choo

Owner
Willem Olding
Willem Olding
The fast, light, and robust client for Ethereum-like networks.

The Fastest and most Advanced Ethereum Client. » Download the latest release « Table of Contents Description Technical Overview Building 3.1 Building

OpenEthereum 6.7k Dec 24, 2022
Cryptography-oriented big integer library with constant-time, stack-allocated (no_std-friendly) implementations of modern formulas

RustCrypto: Cryptographic Big Integers Pure Rust implementation of a big integer library which has been designed from the ground-up for use in cryptog

Rust Crypto 88 Dec 31, 2022
Rust project for working with ETH - Ethereum transactions with Rust on Ganache and also deploy smart contracts :)

Just a test project to work with Ethereum but using Rust. I'm using plain Rust here, not Foundry. In future we will use Foundry. Hope you're already f

Akhil Sharma 2 Dec 20, 2022
Next-generation implementation of Ethereum protocol ("client") written in Rust, based on Erigon architecture.

?? Martinez ?? Next-generation implementation of Ethereum protocol ("client") written in Rust, based on Erigon architecture. Why run Martinez? Look at

Arthur·Thomas 23 Jul 3, 2022
Substreams development kit for Ethereum chains, contains Firehose Block model and helpers as well as utilities for Ethereum ABI encoding/decoding.

Substreams Ethereum Substreams development kit for Ethereum chains, contains Rust Firehose Block model and helpers as well as utilities for Ethereum A

StreamingFast 15 Oct 25, 2022
Ethereum (and Ethereum like) indexer using P2P message to fetch blocks and transactions

Ethereum P2P indexer This project is an indexer for Ethereum and Ethereum forks. It takes advantage of the ETH (Ethereum Wire Protocol) to fetch block

null 5 Nov 10, 2023
The Light Protocol program verifies zkSNARK proofs to enable anonymous transactions on Solana.

Light Protocol DISCLAIMER: THIS SOFTWARE IS NOT AUDITED. Do not use in production! Tests cd ./program && cargo test-bpf deposit_should_succeed cd ./pr

null 36 Dec 17, 2022
Convenience crate for verifying crypto-signed messages

signature-verifier This crate provide an easy way to verify Solana and Ethereum wallet-signed messages. Installation Add the crate to your Cargo.toml

Tim Plotnikov 3 Apr 2, 2024
Zero Knowledge Light Client Implementation by Zpoken team.

zkp for chain state Prerecusites This project requires using the nightly Rust toolchain, which can be used by default in this way: rustup default nigh

Zpoken 40 Mar 6, 2023
Terabethia - A Bridge and Messaging Protocol between Ethereum and the Internet Computer.

Terabethia - A Bridge Between Ethereum & the Internet Computer Terabethia is a bridge between Ethereum & the Internet Computer that contracts in both

Psychedelic 36 Dec 26, 2022