4 releases (2 breaking)

0.9.0 Sep 15, 2023
0.8.0 Sep 11, 2023
0.7.1 Aug 11, 2023
0.7.0 Aug 11, 2023

#15 in #fold

Download history 23/week @ 2024-01-08 74/week @ 2024-01-15 50/week @ 2024-01-22 49/week @ 2024-01-29 33/week @ 2024-02-05 4/week @ 2024-02-12 41/week @ 2024-02-19 35/week @ 2024-02-26 24/week @ 2024-03-04 75/week @ 2024-03-11 25/week @ 2024-03-18 7/week @ 2024-03-25 37/week @ 2024-04-01

147 downloads per month
Used in 2 crates

Custom license

38KB
738 lines

State Fold Picture

State Fold

A collection of libraries with GRPC server and client for reading custom-defined state at any position on the Ethereum blockchain accessed via any Ethereum JSON-RPC API provider.

Description

Whether you want to reach for historical blocks / states or subscribe to get the latest blocks / states as they are added to the network, both of these use-cases were considered when designing State Fold.

State Fold Server Library has methods to read state and analogous ones to read blocks. You can read in bulk and way back in the history, but also subscribe to receive new states, or analogously blocks, as they get added on the blockchain.

The structural definition of state is up to the developer that is using this library. The type definition propagates all the way up to the server and client libraries, i.e. to the API schema. Design of this approach uses DRY attitude. That means we just want you to write the type once and make everything generic so that you get the server for no extra effort.

Developer also defines the behavior of syncing and folding to read state, where sync means calculating state based on hard-coded initial state and fold means calculating state based on previous state.

Requirements

Installation

Add one or more State Fold crates into your Cargo.toml like so:

[dependencies]
# Common crate for all other crates
eth-state-fold-types = { version = "0.7" }

# Libraries for state-fold core logic
eth-block-history = { version = "0.7" }
eth-state-fold = { version = "0.7" }

# Common crate for server/client
eth-state-server-common = { version = "0.7", features = ["server"] }

# Libraries for state-fold GRPC interfaces
eth-state-server-lib = { version = "0.7" }
eth-state-client-lib = { version = "0.7" }

Usage

Local development environment

Build all targets of all crates:

cargo build --all-targets --all-features

Run all tests:

cargo test

Format code:

cargo fmt --all

Documentation

License

The library is licensed under Apache-2.0.

Dependencies

~10MB
~176K SLoC