> For the complete documentation index, see [llms.txt](https://docs.seismic.systems/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.seismic.systems/clients/alloy/fillers.md).

# Fillers

Fillers are Alloy's middleware pattern for preparing transactions before they are sent. Each filler in the pipeline examines a transaction request, optionally fetches data (e.g., nonce, gas price, TEE public key), and fills in missing fields. The Seismic SDK adds two custom fillers to handle shielded transaction preparation.

## Overview

When you call a method that sends a transaction through `SeismicSignedProvider`, the transaction request passes through a chain of fillers before it reaches the network. Each filler has two phases:

1. **Prepare** — Check what data is needed and fetch it (async). For example, fetch the TEE public key from the node.
2. **Fill** — Apply the prepared data to the transaction request. For example, encrypt the calldata and attach seismic elements.

The full filler chain for `SeismicSignedProvider` is:

```
WalletFiller (signing)
  -> NonceFiller + ChainIdFiller (standard Alloy fillers)
  -> SeismicElementsFiller (encryption elements + calldata encryption)
  -> SeismicGasFiller (gas estimation, deferred for seismic txs)
```

{% hint style="info" %}
Execution order matters. `SeismicGasFiller` must run after `SeismicElementsFiller` because gas estimation for shielded transactions must happen on the encrypted calldata, not the plaintext.
{% endhint %}

## Seismic Fillers

| Filler                                                                       | Description                                                                                                                     |
| ---------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------- |
| [`SeismicElementsFiller`](/clients/alloy/fillers/seismic-elements-filler.md) | Generates encryption nonce, fetches TEE public key, encrypts calldata, and attaches seismic elements to the transaction request |
| [`SeismicGasFiller`](/clients/alloy/fillers/seismic-gas-filler.md)           | Estimates gas for transactions. Defers estimation for seismic transactions until after encryption.                              |

## How the Pipeline Works

### For Seismic Transactions (type `0x4A`)

1. **NonceFiller** fetches and fills the sender's nonce
2. **ChainIdFiller** fills the chain ID
3. **SeismicElementsFiller**:
   * Fetches the TEE public key from the node (cached after first fetch)
   * Fetches the latest block number for expiration calculation
   * Generates an encryption nonce using ECDH with the provider secret key
   * Encrypts the calldata using AES-GCM
   * Attaches `TxSeismicElements` to the transaction request
4. **SeismicGasFiller** estimates gas on the now-encrypted transaction
5. **WalletFiller** signs the complete transaction

### For Standard Transactions (legacy, EIP-1559, etc.)

1. **NonceFiller** and **ChainIdFiller** work as usual
2. **SeismicElementsFiller** skips (no seismic elements needed)
3. **SeismicGasFiller** delegates to the standard `GasFiller`
4. **WalletFiller** signs as normal

## Configuration

Both fillers are automatically configured when you create a `SeismicSignedProvider`. You do not need to instantiate them manually in most cases.

```rust
use seismic_prelude::client::*;
use seismic_alloy_network::reth::SeismicReth;

let signer: PrivateKeySigner = "0xYOUR_PRIVATE_KEY".parse()?;
let wallet = SeismicWallet::<SeismicReth>::from(signer);
let url = "https://testnet-1.seismictest.net/rpc".parse()?;

// Fillers are set up automatically
let provider = SeismicProviderBuilder::new()
    .wallet(wallet)
    .connect_http(url)
    .await?;
```

### Custom Configuration

If you need to customize filler behavior, you can construct them manually:

```rust
use seismic_alloy_provider::fillers::{SeismicElementsFiller, SeismicGasFiller};

// Custom elements filler with cached TEE pubkey
let elements_filler = SeismicElementsFiller::with_tee_pubkey(tee_pubkey);

// Custom elements filler with signed reads enabled
let elements_filler = SeismicElementsFiller::new()
    .with_signed_read(true);

// Custom elements filler with a different expiration window
let elements_filler = SeismicElementsFiller::new()
    .with_blocks_window(200);

// Custom gas filler that signs the tx before eth_estimateGas
let gas_filler = SeismicGasFiller::<SeismicReth>::new(rpc_url, wallet);
```

## Pages

| Page                                                                       | Description                                                   |
| -------------------------------------------------------------------------- | ------------------------------------------------------------- |
| [SeismicElementsFiller](/clients/alloy/fillers/seismic-elements-filler.md) | Encryption elements generation and calldata encryption        |
| [SeismicGasFiller](/clients/alloy/fillers/seismic-gas-filler.md)           | Gas estimation with deferred support for seismic transactions |

## See Also

* [Provider Overview](/clients/alloy/provider.md) - How fillers fit into the provider architecture
* [SeismicSignedProvider](/clients/alloy/provider/seismic-signed-provider.md) - Provider that uses the filler pipeline
* [Network Overview](/clients/alloy/network.md) - Network types that fillers operate on
* [Encryption](/clients/alloy/provider/encryption.md) - Detailed encryption documentation


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.seismic.systems/clients/alloy/fillers.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
