Crates.io | eth-state-client-lib |
lib.rs | eth-state-client-lib |
version | 0.9.0 |
source | src |
created_at | 2023-08-11 04:49:01.108554 |
updated_at | 2023-09-15 21:03:33.673932 |
description | An Ethereum reader library |
homepage | https://github.com/cartesi/state-fold |
repository | https://github.com/cartesi/state-fold |
max_upload_size | |
id | 941579 |
size | 28,360 |
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:
[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" }
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.