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

Contract Interaction

Interacting with Seismic contracts using seismic-alloy

Patterns for calling and transacting with smart contracts on Seismic using the Rust SDK.

Overview

seismic-alloy uses Alloy's sol! macro with #[sol(rpc)] to define contract interfaces and generate type-safe call builders. Functions with shielded parameters (e.g., suint256, saddress, sbool) auto-encrypt via ShieldedCallBuilder — you can call .send() or .call() directly without .seismic(). For non-shielded functions that still need encryption, use .seismic() to opt in. Omit .seismic() entirely for transparent (unencrypted) operations.

Key Concepts

  • sol! macro with #[sol(rpc)] — Define contract interfaces with Solidity syntax, generate call builders and deploy methods

  • Auto-encryption for shielded params — Functions with shielded types in their arguments return a ShieldedCallBuilder automatically; call .send() or .call() directly

  • .seismic() call builder — For non-shielded functions that need encryption; converts a SolCallBuilder into a ShieldedCallBuilder

  • Two traitsSeismicCallExt adds .seismic() to SolCallBuilder; ShieldedCallExt adds .call(), .send(), and builder methods to ShieldedCallBuilder

  • SecurityParams — Per-call overrides for expiration, block hash, and encryption nonce

  • EIP-712.eip712() on ShieldedCallBuilder for browser wallet compatibility

Shielded vs. Transparent Operations

Operation
When
Pattern
Provider Required

Shielded Read

Function has shielded params

contract.method().call().await?

SeismicSignedProvider

Shielded Read

Function has no shielded params

contract.method().seismic().call().await?

SeismicSignedProvider

Shielded Write

Function has shielded params

contract.method().send().await?

SeismicSignedProvider

Shielded Write

Function has no shielded params

contract.method().seismic().send().await?

SeismicSignedProvider

Transparent Read

Any

contract.method().call().await?

Any provider

Transparent Write

Any

contract.method().send().await?

SeismicSignedProvider

Contract deployment (Create transactions) cannot be seismic. Deploy your contract with a standard transaction, then interact with it using shielded calls.

Defining Contract Interfaces

Use Alloy's sol! macro with #[sol(rpc)] to define your contract's interface. This generates type-safe call builders with .call() and .send() methods:

To also include deployment, add the bytecode attribute:

Quick Example

Page
Description

Encrypted writes and signed reads using auto-encryption and .seismic()

Standard Ethereum calls without encryption

See Also

Last updated