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:
RpcTransport— the central async trait every transport implementsJsonRpcRequest/JsonRpcResponse— wire typesTransportError— structured error typeHealthStatus— provider liveness checkpolicymodule — retry, circuit breaker, rate limiterpoolmodule — multi-provider failover pool
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
ChainClienttrait — 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
RpcTransporttrait — 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.