Rust — seismic-alloy
Rust SDK for Seismic, built on Alloy
[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 InstallationQuick 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
Provider Reference
Section
Description
Workspace Layout
Network Types
Network
Type
Description
Guides & Examples
Section
Description
Next Steps
Last updated

