الخطة المجانية تغطي المشاريع الشخصية. الدفع حسب الاستخدام يتوسع دون بطاقة.
Rust
rust-web3 is the primary crate for interacting with Base from Rust, giving you type-safe access to the chain's EVM JSON-RPC. Base is an OP Stack rollup that is EVM-equivalent and uses ETH for gas, so rust-web3 connects to https://base.therpc.io/YOUR_API_KEY at chain ID 8453 with no special handling. It is fully async and built on Tokio, so add both to Cargo.toml: tokio with version = "1" and features = ["full"], and web3 = "0.19".
rust-web3 relies on Tokio for its async runtime, so every Base call happens inside a Tokio context. Declare both dependencies in Cargo.toml: tokio = { version = "1", features = ["full"] } and web3 = "0.19".
Web3-rs
Build the connection in two steps: create an HTTP transport with web3::transports::Http::new("https://base.therpc.io/YOUR_API_KEY"), then wrap it in Web3::new(transport). Every network method returns a Result, so propagate failures with ? inside your async functions — a dropped Base request surfaces as an Err you can handle rather than a panic.
Key features: async-first design, type-safe interfaces, contract interactions on Base, transaction management, ENS support, and WebSocket transports for subscriptions
Contract Integration
To use a contract on Base, load its ABI with Contract::from_json and bind it to the on-chain address — for a verified Base contract you can copy both from https://basescan.org. Call read-only view methods with contract.query(...), which return data for free, and send state-changing transactions with contract.call(...), which spend ETH for gas on Base.
Use thiserror to derive a typed error enum that wraps web3::Error along with your own variants for invalid addresses and failed transactions, so callers match on a clear set of Base-specific failures. Build safe_get_balance / safe_send wrappers that convert raw U256 wei into f64 ether for display — keep the U256 for any on-chain math, since f64 loses precision past Base's 18-decimal wei values.
subscribe_new_heads returns a Stream of Base block headers, but live subscriptions need a WebSocket transport — the HTTP endpoint cannot push events, so swap Http for a wss:// transport here. Pull in futures::StreamExt and consume the stream with a while let Some(block) = stream.next().await loop; with Base producing a block about every 2 seconds, you'll get a steady flow of new heads.
Mark async test functions with #[tokio::test] so they run on the Tokio runtime. Point tests at a local node (http://localhost:8545) or a forked Base environment rather than the production endpoint — this keeps tests fast, deterministic, and free of request-quota usage, and lets you fund test accounts without spending real ETH.