playBasic 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.

Prerequisites

# Install Rust 1.82+
rustup update stable

# Set environment variables
export PRIVATE_KEY="0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80"
export RPC_URL="https://gcp-1.seismictest.net/rpc"

Cargo.toml:

[package]
name = "basic-setup"
version = "0.1.0"
edition = "2021"
rust-version = "1.82"

[dependencies]
seismic-alloy = { git = "https://github.com/SeismicSystems/seismic-alloy" }
alloy-signer-local = "1.1"
alloy-primitives = "1.1"
tokio = { version = "1", features = ["full"] }

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.

Using Convenience Constructors

The SDK provides shorthand functions that select the correct network type automatically:

Local Development with Sanvil

For local testing using Sanvil (Seismic Anvil):

circle-info

Anvil::at("sanvil") requires sanvil to be installed and available on your PATH. See the Seismic Foundry documentation for installation instructions.

Error Handling

Expected Output

Next Steps

See Also

Last updated