SeismicElementsFiller
Encryption elements generation and calldata encryption filler
SeismicElementsFiller is the core filler responsible for preparing Seismic shielded transactions. It generates encryption elements, fetches the TEE public key, encrypts calldata, and attaches all necessary metadata to the transaction request.
Overview
When a Seismic transaction (type 0x4A) passes through the filler pipeline, SeismicElementsFiller performs the following:
Fetches the TEE public key from the Seismic node (cached after first call)
Fetches the latest block number to calculate the transaction expiration
Generates an encryption nonce using ECDH between the provider secret key and the TEE public key
Encrypts the calldata using AES-GCM
Attaches
TxSeismicElements(nonce, provider public key, expiration block) to the transaction request
For non-Seismic transactions, the filler is a no-op.
Definition
pub struct SeismicElementsFiller {
tee_pubkey: Option<PublicKey>,
blocks_window: Option<u64>,
provider_secret_key: SecretKey,
signed_read: bool,
}tee_pubkey
Option<PublicKey>
Cached TEE public key (fetched lazily if None)
blocks_window
Option<u64>
Custom expiration window in blocks (default: 100)
provider_secret_key
SecretKey
Randomly generated provider-scoped key for ECDH
signed_read
bool
Whether to enable signed read mode
Constructors
new
Create a new filler with default settings. The TEE public key will be fetched lazily on the first transaction.
Returns: A new SeismicElementsFiller with:
No cached TEE public key (will be fetched from the node)
Default blocks window (100)
A freshly generated provider secret key
Signed read disabled
with_tee_pubkey
Create a filler with a pre-cached TEE public key. This avoids the initial RPC call to fetch the key.
tee_pubkey
PublicKey
Yes
The TEE public key to cache
Returns: A SeismicElementsFiller with the given TEE public key pre-cached.
Configuration Methods
with_signed_read
Set the signed read flag. When enabled, the filler includes additional data for signed read operations.
signed_read
bool
Yes
Whether to enable signed read mode
Returns: Self (builder pattern).
with_blocks_window
Set a custom expiration window. The transaction will expire after current_block + blocks_window.
blocks_window
u64
Yes
Number of blocks until transaction expires
Returns: Self (builder pattern).
provider_secret_key
Access the provider secret key generated at construction time.
Returns: &SecretKey — Reference to the provider secret key.
Two-Phase Design
SeismicElementsFiller implements Alloy's TxFiller<N> trait, which defines two phases:
Prepare Phase
The prepare phase is async. It fetches external data needed for encryption:
TEE public key — Fetched from the node via
seismic_getTeePublicKeyRPC call (or uses cached value)Latest block number — Fetched to calculate the expiration block
These values are returned as a "fillable" that is passed to the fill phase.
Fill Phase
The fill phase is synchronous. It uses the prepared data to:
Calculate the expiration block:
latest_block + blocks_windowGenerate the encryption nonce via ECDH between the provider secret key and the TEE public key
Encrypt the calldata using AES-GCM with the derived shared secret
Create
TxSeismicElementscontaining the nonce, provider public key, and expirationCall
N::set_seismic_elements()to attach elements to the requestCall
N::set_request_input()to replace plaintext calldata with encrypted calldata
Encryption Flow
The node's TEE can reverse this process because it holds the private key corresponding to tee_public_key. It uses the provider's public key (included in TxSeismicElements) to derive the same shared secret.
Constants
BLOCKS_WINDOW
100
Default number of blocks before transaction expires
Usage
Default Configuration
In most cases, you do not interact with SeismicElementsFiller directly. It is automatically included in the provider's filler pipeline:
With Pre-Cached TEE Key
If you already know the TEE public key (e.g., from a previous session):
With Custom Expiration Window
With Signed Reads
Notes
The provider secret key is generated once at construction and reused for all transactions through this filler instance
The TEE public key is fetched lazily and cached — only one RPC call is made per filler instance
For non-Seismic transactions, the filler does nothing (no encryption, no elements)
The encryption uses
seismic-enclaveunder the hood for ECDH and AES-GCM operationsIf the TEE public key changes (e.g., node rotation), you need a new filler or provider instance
See Also
Fillers Overview - How fillers compose in the pipeline
SeismicGasFiller - Gas estimation filler (runs after this one)
Encryption - Detailed encryption documentation
SeismicNetwork Trait - Methods called by this filler
SeismicSignedProvider - Provider that uses this filler
Last updated

