3 releases (breaking)

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

#19 in #historical

Download history 15/week @ 2024-01-08 67/week @ 2024-01-15 46/week @ 2024-01-22 42/week @ 2024-01-29 28/week @ 2024-02-05 25/week @ 2024-02-19 29/week @ 2024-02-26 20/week @ 2024-03-04 67/week @ 2024-03-11 17/week @ 2024-03-18 13/week @ 2024-03-25 76/week @ 2024-04-01

175 downloads per month

Custom license

3.5K SLoC

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.


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.



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

# 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" }


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



The library is licensed under Apache-2.0.


~757K SLoC