Le niveau gratuit couvre les projets personnels. Le paiement à l'usage évolue sans carte bancaire.
Rust
rust-web3 is the primary crate for interacting with the Avalanche C-Chain from Rust, giving you typed, async access to the EVM at chain ID 43114 with AVAX as the native value. It is built on async and needs the Tokio runtime, so add both to your Cargo.toml: tokio = { version = "1", features = ["full"] } and web3 = "0.19". With those in place, your client can connect to https://avalanche.therpc.io/YOUR_API_KEY.
rust-web3 relies on Tokio for its async support, so a Tokio runtime must be present to drive C-Chain calls. Add tokio = { version = "1", features = ["full"] } and web3 = "0.19" to your Cargo.toml before building against the Avalanche endpoint.
Web3-rs
Set up the client in two steps: create an HTTP transport with web3::transports::Http::new("https://avalanche.therpc.io/YOUR_API_KEY"), then wrap it in Web3::new(transport). Every network method returns a Result, so propagate failures with the ? operator inside your async functions — a clean way to bubble up an RPC error or a connection problem on the C-Chain without panicking.
Key features: async support on Tokio, type-safe interfaces, contract interactions on the Avalanche C-Chain, transaction management, ENS resolution, and WebSocket transport for subscriptions
Contract Integration
To work with a C-Chain contract, load its ABI and bind it to the deployed address with Contract::from_json(web3.eth(), address, abi). Read-only view methods go through contract.query(), which returns decoded values without spending AVAX; state-changing methods go through contract.call(), which submits a transaction and pays gas. This pattern works the same for your own contract or an Avalanche protocol like Aave or GMX.
For ergonomic error handling, derive a typed error enum with thiserror that wraps web3::Error along with your own variants for invalid addresses and contract failures. Then expose convenience methods like safe_get_balance and safe_send that handle the conversion from raw U256 wei to an f64 AVAX value for display — keeping the lossy float conversion in one place and out of your core C-Chain logic.
subscribe_new_heads returns a Stream of block headers, but streaming requires a WebSocket transport — the HTTP endpoint cannot push events, so dial the WebSocket variant of the C-Chain endpoint for live monitoring. Bring futures::StreamExt into scope and consume the stream in a while let Some(...) = stream.next().await loop. Given Avalanche's 1–2 second finality, new headers arrive promptly, making this a responsive way to track the chain tip.
Mark async test functions with #[tokio::test] so each one runs on its own Tokio runtime. Point those tests at a local node (http://localhost:8545) or a forked C-Chain environment rather than the production Avalanche endpoint — this keeps tests fast and deterministic, avoids consuming your API quota, and lets you fund test accounts freely without touching real AVAX.