walletcreate_wallet_client

Create sync Web3 instance with full Seismic wallet capabilities

Create a synchronous Web3 instance with full Seismic wallet capabilities.

Overview

create_wallet_client() is the primary factory function for creating a sync client that can perform shielded writes, signed reads, and deposits. It fetches the TEE public key, derives encryption state via ECDHarrow-up-right, and attaches a fully-configured w3.seismic namespace to a standard Web3 instance.

The returned client works with all standard web3.py APIs (w3.eth.get_block(), w3.eth.send_raw_transaction(), etc.) plus the additional w3.seismic namespace for Seismic-specific operations.

Signature

def create_wallet_client(
    rpc_url: str,
    private_key: PrivateKey,
    *,
    encryption_sk: PrivateKey | None = None,
) -> Web3

Parameters

Parameter
Type
Required
Description

rpc_url

str

Yes

HTTP(S) URL of the Seismic node (e.g., "https://gcp-1.seismictest.net/rpc"). WebSocket URLs are not supported — see note below

private_key

Yes

32-byte secp256k1 private key for signing transactions

encryption_sk

No

Optional 32-byte key for ECDH. If None, a random ephemeral key is generated

Returns

Type
Description

Web3

A Web3 instance with w3.seismic namespace attached (SeismicNamespace)

Examples

Basic Usage

Using Chain Configuration

With Custom Encryption Key

Standard Web3 Operations

How It Works

The function performs five steps:

  1. Create Web3 instance

  2. Fetch TEE public key (synchronous RPC call)

  3. Generate encryption keypair (if encryption_sk is None, a random ephemeral key is created)

  4. Derive encryption state (ECDH + HKDFarrow-up-right)

  5. Attach Seismic namespace

Client Capabilities

The returned client provides:

Standard Web3 Methods (e.g. w3.eth, w3.net)

  • get_block(), get_transaction(), get_balance()

  • send_raw_transaction(), wait_for_transaction_receipt()

  • All other standard web3.py functionality

Seismic Methods (w3.seismic)

Encryption

The client automatically:

  • Fetches the network's TEE public key

  • Performs ECDH key exchange using encryption_sk (or generates a random one)

  • Derives a shared AES-GCM key via HKDF

  • Uses this key to encrypt all shielded transaction calldata and signed reads

Access the encryption state at w3.seismic.encryption if needed for advanced use cases.

Notes

  • HTTP only — Sync clients use Web3 with HTTPProvider, which does not support WebSocket connections. This is a limitation of the underlying web3.py library (WebSocketProvider is async-only). If you need WebSocket support (persistent connections, subscriptions), use create_async_wallet_client() with ws=True

  • The function makes one synchronous RPC call to fetch the TEE public key

  • If encryption_sk is None, a random ephemeral key is generated

  • The encryption key is separate from the transaction signing key

  • The returned Web3 instance is fully compatible with all web3.py APIs

  • For async operations, use create_async_wallet_client()

Warnings

  • Private key security - Never log or expose private keys. Use environment variables or secure key management

  • RPC URL validation - Ensure the RPC URL is correct and accessible

  • Network connectivity - The function will fail if it cannot reach the RPC endpoint

  • HTTPS recommended - Use HTTPS URLs in production to prevent MITM attacks

See Also

Last updated