Skip to main content

Crate chainrpc_core

Crate chainrpc_core 

Source
Expand description

chainrpc-core — foundation traits and types for ChainRPC.

§Overview

ChainRPC provides a production-grade, multi-provider RPC transport layer for EVM (and other) blockchains. The core crate defines:

Re-exports§

pub use chain_client::ChainBlock;
pub use chain_client::ChainClient;
pub use chain_client::EvmChainClient;
pub use chain_client::SolanaChainClient;
pub use error::TransportError;
pub use pool::ProviderPool;
pub use pool::ProviderPoolConfig;
pub use request::JsonRpcRequest;
pub use request::JsonRpcResponse;
pub use request::RpcId;
pub use request::RpcParam;
pub use transport::HealthStatus;
pub use transport::RpcTransport;

Modules§

aptos
Aptos RPC support — REST-to-JSON-RPC adapter, method safety, and transport.
backpressure
Backpressure transport wrapper — limits concurrent in-flight requests.
batch
Transport-agnostic auto-batching engine.
bitcoin
Bitcoin RPC support — method safety, CU costs, and transport.
cache
Response caching layer for RPC transports.
cancellation
Cooperative cancellation tokens for RPC operations.
chain_client
Unified ChainClient trait — a high-level typed abstraction over any blockchain’s RPC interface.
cosmos
Cosmos (Tendermint/CometBFT) RPC support — method safety, CU costs, and transport.
cu_tracker
Compute unit (CU) budget tracking per provider.
dedup
Request deduplication — coalesces identical in-flight RPC requests.
error
Transport-level error types.
gas
EIP-1559 gas estimation utilities.
gas_bumper
Gas bumping and transaction replacement.
geo_routing
Geographic-aware RPC routing.
health_checker
Background health checker — periodically probes providers.
hedging
Request hedging — send to backup provider if primary is slow.
method_safety
Method safety classification — prevents retrying unsafe (write) methods.
metrics
Metrics and observability for RPC providers.
mev
MEV protection — route transactions through private relays.
multi_chain
Multi-chain router — route requests to the correct chain’s provider pool.
pending_pool
Pending transaction pool monitoring.
policy
Policy engine — composable middleware for RPC reliability.
pool
Multi-provider failover pool with round-robin selection and health tracking.
rate_limit_headers
Parse rate limit information from HTTP response headers.
reorg
Chain reorganization detection at the RPC transport layer.
request
JSON-RPC 2.0 wire types.
routing
Provider capability routing — route requests to capable providers.
selection
Provider selection strategies for the pool.
shutdown
Graceful shutdown — drain in-flight requests on SIGTERM/SIGINT.
solana
Solana RPC support — method safety, commitment levels, and transport helpers.
substrate
Substrate (Polkadot/Kusama) RPC support — method safety, CU costs, and transport.
sui
Sui RPC support — method safety, CU costs, and transport.
transport
The RpcTransport trait — the core abstraction for all RPC providers.
tx
Transaction lifecycle management — tracking, confirmation monitoring, nonce management, and stuck transaction detection for EVM-compatible blockchains.
tx_lifecycle
Transaction lifecycle management wired into RpcTransport.