lockSeismicSignedProvider

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

Full-featured provider with wallet integration, automatic calldata encryption, and response decryption.

Overview

SeismicSignedProvider<N: SeismicNetwork> is the primary provider type for interacting with Seismic nodes. It wraps an Alloy provider with a filler chain that automatically:

  1. Signs transactions with the attached wallet

  2. Populates nonce, chain ID, and Seismic-specific fields

  3. Encrypts calldata using AES-GCM with an ECDH shared secret

  4. Decrypts seismic_call responses using the same shared secret

At creation time, the provider generates an ephemeral secp256k1 keypair, fetches the TEE public key from the node, and caches it for all subsequent operations.

Type Signature

pub struct SeismicSignedProvider<N: SeismicNetwork> {
    // inner provider with filler chain
    // ephemeral_secret_key: secp256k1 secret key
    // tee_pubkey: cached TEE public key
}

The generic parameter N determines the network type:

  • SeismicReth -- for Seismic devnet/testnet/mainnet

  • SeismicFoundry -- for local sfoundry instances

Constructors

new()

Create a signed provider by fetching the TEE public key from the node.

Parameters

Parameter
Type
Required
Description

wallet

impl Into<SeismicWallet<N>>

Yes

Wallet for signing transactions. Accepts any type that converts into SeismicWallet (e.g., PrivateKeySigner)

url

reqwest::Url

Yes

HTTP URL of the Seismic node RPC endpoint

Returns

Type
Description

TransportResult<Self>

The constructed provider, or a transport error if the TEE pubkey fetch fails

Example

circle-info

new() is async because it makes an RPC call to seismic_getTeePublicKey to fetch and cache the node's TEE public key. If you already have the TEE pubkey, use new_with_tee_pubkey() for synchronous construction.

new_with_tee_pubkey()

Create a signed provider with a pre-fetched TEE public key (synchronous).

Parameters

Parameter
Type
Required
Description

wallet

impl Into<SeismicWallet<N>>

Yes

Wallet for signing transactions

url

reqwest::Url

Yes

HTTP URL of the Seismic node RPC endpoint

tee_pubkey

PublicKey

Yes

Pre-fetched TEE public key (secp256k1)

Returns

Type
Description

Self

The constructed provider

Example

Convenience Functions

These functions pre-fill the network generic parameter for common network types:

sreth_signed_provider()

For Seismic devnet, testnet, or mainnet.

sfoundry_signed_provider()

For local sfoundry development instances.

Methods

SeismicSignedProvider implements Deref to the inner Alloy provider, so all standard Provider<N> methods are available directly. It also implements SeismicProviderExt<N> for Seismic-specific operations.

Via SeismicProviderExt

seismic_call()

Fill, encrypt, send, and decrypt a call request. This is the primary method for signed reads.

Parameter
Type
Required
Description

tx

SendableTx<N>

Yes

Transaction to send as a call. Calldata will be encrypted automatically

Returns
Description

TransportResult<Bytes>

Decrypted response bytes, or a transport error

get_tee_pubkey()

Fetch the TEE public key from the node.

Returns
Description

TransportResult<PublicKey>

The node's TEE secp256k1 public key

circle-info

For SeismicSignedProvider, the TEE pubkey is fetched once at construction and cached. This method is still available but typically not needed -- the cached key is used automatically for all encryption operations.

should_encrypt_input()

Check whether a transaction's calldata should be encrypted.

Parameter
Type
Required
Description

tx

&B (where B: TransactionBuilder<N>)

Yes

Transaction to check

Returns
Description

bool

true if the transaction has calldata that should be encrypted

call_conditionally_signed()

Send a call that is signed (since this is a signed provider).

Parameter
Type
Required
Description

tx

SendableTx<N>

Yes

Transaction to send

Returns
Description

TransportResult<Bytes>

Response bytes

Via Standard Alloy Provider

All standard Alloy provider methods are available through Deref:

Filler Chain

The signed provider assembles its filler chain in this order:

Order
Filler
Purpose

1

WalletFiller

Signs the transaction with the attached wallet

2

NonceFiller

Fetches and sets the transaction nonce

2

ChainIdFiller

Sets the chain ID from the connected node

3

SeismicElementsFiller

Populates Seismic-specific fields: encryption nonce, TEE pubkey reference, recent block hash, expiry block

4

SeismicGasFiller

Estimates and sets gas limit and gas price

After all fillers run, calldata is encrypted with AES-GCM before the transaction is sent to the node.

Examples

Shielded Write

Signed Read

Local Development with sfoundry

Pre-fetched TEE Pubkey

How It Works

  1. Construction -- Generates an ephemeral secp256k1 keypair and fetches (or accepts) the TEE public key. Computes the ECDH shared secret between the ephemeral key and the TEE pubkey.

  2. Transaction building -- The filler chain populates all transaction fields: nonce, chain ID, Seismic elements (encryption nonce, block hash, expiry), and gas.

  3. Encryption -- Before sending, calldata is encrypted using AES-GCM. The encryption key is derived from the ECDH shared secret. Additional Authenticated Data (AAD) binds the ciphertext to the transaction context.

  4. Sending -- The encrypted transaction is signed by the wallet and sent to the node.

  5. Response decryption -- For seismic_call() requests, the response is decrypted using the same ECDH shared secret.

Notes

  • The ephemeral keypair is generated once at provider creation and reused for all operations

  • The TEE public key is cached after the initial fetch

  • All standard Alloy Provider methods work unchanged -- only transactions with calldata are encrypted

  • SeismicSignedProvider implements Deref to the inner provider, so you can use it anywhere a Provider<N> is expected

  • HTTP transport only -- WebSocket is not supported for signed providers

See Also

Last updated