Basic Setup
Complete provider setup with connection verification
This example demonstrates how to create Seismic providers in both signed and unsigned variants, verify the connection, and query basic chain state.
Balance RPC migration: On reth with PR #502,
provider.get_balance()returns a compatibility placeholder, not native or sUSDC holdings. This applies even to signed providers. See Balance RPCs for explicit native queries.
Prerequisites
# Install Rust 1.82+
rustup update stable
# Set environment variables
export PRIVATE_KEY="0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80"
export RPC_URL="https://testnet-1.seismictest.net/rpc"Cargo.toml — see Installation for the full template including the required [patch.crates-io] block:
[package]
name = "basic-setup"
version = "0.1.0"
edition = "2021"
rust-version = "1.82"
[dependencies]
seismic-prelude = { git = "https://github.com/SeismicSystems/seismic-alloy" }
seismic-alloy-network = { git = "https://github.com/SeismicSystems/seismic-alloy" }
seismic-alloy-provider = { git = "https://github.com/SeismicSystems/seismic-alloy" }
alloy-provider = "1.1"
alloy-signer-local = "1.1"
alloy-primitives = "1.1"
tokio = { version = "1", features = ["full"] }
reqwest = "0.12"
# [patch.crates-io] block required — see Installation.Signed Provider (Full Capabilities)
A signed provider can send shielded writes, perform signed reads, and execute all standard Alloy provider operations.
Unsigned Provider (Read-Only)
An unsigned provider does not require a private key. It can query chain state, read public data, and subscribe to events (via WebSocket), but cannot send transactions or perform signed reads.
Network Selection
The builder defaults to SeismicReth (production). Use .foundry() for local development:
Local Development with Sanvil
For local testing using Sanvil (Seismic Anvil):
Error Handling
Expected Output
Next Steps
Shielded Write Complete - Send encrypted transactions
Signed Read Pattern - Execute authenticated calls
Contract Deployment - Deploy and interact with contracts
See Also
SeismicSignedProvider - Full-featured provider API
SeismicUnsignedProvider - Read-only provider API
Installation - Cargo setup and dependencies
Provider Overview - Provider comparison and filler pipeline
Last updated

