# Python — seismic-web3

Python SDK for [Seismic](https://seismic.systems), built on [web3.py](https://github.com/ethereum/web3.py). Requires **Python 3.10+**.

```bash
pip install seismic-web3
```

Or with [uv](https://docs.astral.sh/uv/):

```bash
uv add seismic-web3
```

## Quick Example

```python
import os
from seismic_web3 import SEISMIC_TESTNET, PrivateKey

pk = PrivateKey.from_hex_str(os.environ["PRIVATE_KEY"])

# Wallet client — full capabilities (requires private key)
w3 = SEISMIC_TESTNET.wallet_client(pk)

contract = w3.seismic.contract(address="0x...", abi=ABI)

# Shielded write — calldata is encrypted
tx_hash = contract.write.setNumber(42)
receipt = w3.eth.wait_for_transaction_receipt(tx_hash)

# Signed read — encrypted eth_call, proves your identity
result = contract.read.getNumber()
```

```python
# Public client — read-only (no private key needed)
public = SEISMIC_TESTNET.public_client()

contract = public.seismic.contract(address="0x...", abi=ABI)
result = contract.tread.getNumber()
```

## Documentation Navigation

### Getting Started

| Section                                     | Description                                    |
| ------------------------------------------- | ---------------------------------------------- |
| [**Client**](/clients/python/client.md)     | Create sync/async wallet and public clients    |
| [**Chains**](/clients/python/chains.md)     | Chain configuration (SEISMIC\_TESTNET, SANVIL) |
| [**Contract**](/clients/python/contract.md) | Interact with shielded and public contracts    |

### Guides

| Section                                 | Description                                  |
| --------------------------------------- | -------------------------------------------- |
| [**Guides**](/clients/python/guides.md) | Step-by-step tutorials and runnable examples |

### API Reference

| Section                                                                     | Description                                            |
| --------------------------------------------------------------------------- | ------------------------------------------------------ |
| [**API Reference**](/clients/python/api-reference.md)                       | Complete API documentation for all types and functions |
| [**Types**](/clients/python/api-reference/types.md)                         | Primitive types (Bytes32, PrivateKey, etc.)            |
| [**Transaction Types**](/clients/python/api-reference/transaction-types.md) | Seismic transaction dataclasses                        |
| [**EIP-712**](/clients/python/api-reference/eip712.md)                      | EIP-712 typed data signing functions                   |

### Advanced Features

| Section                                           | Description                                |
| ------------------------------------------------- | ------------------------------------------ |
| [**Namespaces**](/clients/python/namespaces.md)   | w3.seismic namespace methods               |
| [**Precompiles**](/clients/python/precompiles.md) | Privacy-preserving cryptographic functions |
| [**SRC20**](/clients/python/src20.md)             | SRC20 token standard support               |
| [**ABIs**](/clients/python/abis.md)               | Built-in contract ABIs and helpers         |

## Quick Links

### By Task

* **Send a shielded transaction** → [Shielded Write Guide](/clients/python/guides/shielded-write.md)
* **Execute a signed read** → [Signed Reads Guide](/clients/python/guides/signed-reads.md)
* **Work with SRC20 tokens** → [SRC20 Documentation](/clients/python/src20.md)
* **Use async client** → [Client Documentation](/clients/python/client/create-async-wallet-client.md)
* **Configure custom chain** → [Chains Documentation](/clients/python/chains/chain-config.md)

### By Component

* **Client factories** → [create\_wallet\_client](/clients/python/client/create-wallet-client.md), [create\_public\_client](/clients/python/client/create-public-client.md)
* **Contract wrappers** → [ShieldedContract](/clients/python/contract/shielded-contract.md), [PublicContract](/clients/python/contract/public-contract.md)
* **Encryption** → [EncryptionState](/clients/python/client/encryption-state.md), [Precompiles](/clients/python/precompiles.md)
* **Transaction types** → [UnsignedSeismicTx](/clients/python/api-reference/transaction-types/unsigned-seismic-tx.md), [SeismicElements](/clients/python/api-reference/transaction-types/seismic-elements.md)

## Features

* **🔒 Shielded Transactions** - Encrypt calldata with TEE public key
* **📝 Signed Reads** - Prove identity in eth\_call
* **🪙 SRC20 Support** - Built-in support for private tokens
* **⚡ Async/Await** - Full async support with AsyncWeb3
* **🔑 EIP-712** - Structured typed data signing
* **🛠️ Precompiles** - Access Mercury EVM cryptographic precompiles
* **🌐 Web3.py Compatible** - Standard Web3 instance with Seismic extensions

## Architecture

The SDK extends `web3.py` with a custom `w3.seismic` namespace:

```
Web3 (standard web3.py)
├── eth (standard)
├── net (standard)
└── seismic (Seismic-specific) ✨
    ├── send_shielded_transaction()
    ├── signed_call()
    ├── get_tee_public_key()
    ├── deposit()
    └── contract() → ShieldedContract
                     ├── .write (shielded)
                     ├── .read (signed)
                     ├── .twrite (transparent)
                     ├── .tread (transparent)
                     └── .dwrite (debug)
```

## Next Steps

1. [**Install and setup a client**](/clients/python/client.md) - Get connected to Seismic
2. [**Send your first shielded transaction**](/clients/python/guides/shielded-write.md) - Step-by-step guide
3. [**Explore the API reference**](/clients/python/api-reference.md) - Deep dive into all types and functions


---

# Agent Instructions: 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:

```
GET https://docs.seismic.systems/clients/python.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
