For the complete documentation index, see llms.txt. This page is also available as Markdown.

Rust — seismic-alloy

Rust SDK for Seismic, built on Alloy

Rust SDK for Seismic, built on Alloy (v1.1.0). Requires Rust 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"
# ... plus the [patch.crates-io] block documented in Installation

See Installation for the full Cargo.toml, including the required [patch.crates-io] block.

Quick Example

use seismic_prelude::client::*;
use seismic_alloy_network::reth::SeismicReth;
use alloy_provider::Provider;

sol! {
    #[sol(rpc)]
    contract SeismicCounter {
        function setNumber(suint256 newNumber) public;
        function isOdd() public view returns (bool);
    }
}

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let signer: PrivateKeySigner = "0xYOUR_PRIVATE_KEY".parse()?;
    let wallet = SeismicWallet::<SeismicReth>::from(signer);
    let url: reqwest::Url = "https://testnet-1.seismictest.net/rpc".parse()?;

    let provider = SeismicProviderBuilder::new()
        .wallet(wallet)
        .connect_http(url)
        .await?;

    let contract_address: Address = "0xYourContractAddress".parse()?;
    let contract = SeismicCounter::new(contract_address, &provider);

    // Shielded read (encrypted call + response decryption)
    let is_odd = contract.isOdd().seismic().call().await?;

    // Shielded write (encrypted transaction)
    // setNumber has a shielded param (suint256), so it auto-encrypts — no .seismic() needed
    contract.setNumber(alloy_primitives::aliases::SUInt(U256::from(42)))
        .send()
        .await?
        .get_receipt()
        .await?;

    Ok(())
}

Documentation Navigation

Getting Started

Section
Description

Cargo setup, git dependencies, and feature flags

Signed and unsigned provider types

Provider Reference

Section
Description

Full-featured provider with wallet, encryption, and response decryption

Read-only provider for public operations

TEE key exchange, ECDH, AES-GCM calldata encryption

Workspace Layout

The provider wraps Alloy's provider with a filler pipeline that handles seismic-specific fields and calldata encryption. See Provider for the full filler chain and per-trait API.

Network Types

The SDK defines two network configurations:

Network
Type
Description

SeismicReth

Production

Seismic devnet/testnet/mainnet

SeismicFoundry

Development

Local Seismic Foundry (sanvil) instances

Both implement the SeismicNetwork trait and can be used as the generic parameter N in provider types.

Guides & Examples

Section
Description

Step-by-step tutorials for shielded writes and reads

Encrypted transaction lifecycle and security parameters

Encrypted eth_call with identity proof

Complete, runnable code examples

Provider creation and connection verification

Full lifecycle: deploy, write, read, inspect receipt

Comparing encrypted and transparent reads

Deploy, verify, interact, and subscribe to events

Next Steps

  1. Install seismic-alloy — Add the crate to your project

  2. Create a signed provider — Connect with full capabilities

  3. Understand encryption — Learn how calldata encryption works

  4. Explore unsigned providers — Read-only access

  5. Follow a guide — Step-by-step shielded write or signed read tutorial

  6. Run an example — Complete, runnable code examples

Last updated