create_async_wallet_client
Create async Web3 instance with full Seismic wallet capabilities
Create an asynchronous AsyncWeb3 instance with full Seismic wallet capabilities.
Balance RPC migration: On reth with PR #502,
await w3.eth.get_balance()returns a compatibility placeholder, not native or sUSDC holdings. A signing wallet does not change this RPC's behavior. See Balance RPCs for explicit native queries.
Overview
create_async_wallet_client() is the async factory function for creating a client that can perform shielded writes, signed reads, and deposits. It supports both HTTP and WebSocket connections, fetches the TEE public key asynchronously, derives encryption state via ECDH, and attaches a fully-configured w3.seismic namespace.
The returned client works with all standard async web3.py APIs (await w3.eth.get_block(), etc.) plus the additional w3.seismic namespace for Seismic-specific operations.
Signature
async def create_async_wallet_client(
provider_url: str,
private_key: PrivateKey,
*,
encryption_sk: PrivateKey | None = None,
ws: bool = False,
) -> AsyncWeb3Parameters
provider_url
str
Yes
HTTP(S) or WS(S) URL of the Seismic node
encryption_sk
No
Optional 32-byte key for ECDH. If None, a random ephemeral key is generated
ws
bool
No
If True, uses WebSocketProvider (persistent connection, supports subscriptions). Otherwise uses AsyncHTTPProvider. Default: False. WebSocket is only available on async clients — sync clients are HTTP-only
Returns
AsyncWeb3
An AsyncWeb3 instance with w3.seismic namespace attached (AsyncSeismicNamespace)
Examples
Basic Usage (HTTP)
WebSocket Connection
Using Chain Configuration
Context Manager Pattern
Async Application
With Custom Encryption Key
How It Works
The function performs six steps:
Create provider
Create AsyncWeb3 instance
Fetch TEE public key (async RPC call)
Generate encryption keypair (if
encryption_skisNone, a random ephemeral key is created)Derive encryption state (ECDH + HKDF)
Attach Seismic namespace
Client Capabilities
The returned client provides:
Standard AsyncWeb3 Methods (e.g. w3.eth, w3.net)
await get_block(),await get_transaction(),await get_balance()await send_raw_transaction(),await wait_for_transaction_receipt()All other standard async
web3.pyfunctionality
Async Seismic Methods (w3.seismic)
await send_shielded_transaction()- Send shielded transactionsawait debug_send_shielded_transaction()- Debug shielded transactionsawait signed_call()- Execute signed readsawait deposit()- Deposit ETH/tokensawait get_tee_public_key()- Get TEE public keyawait get_deposit_root()- Query deposit merkle rootawait get_deposit_count()- Query deposit countcontract()- Create contract wrappers (methods are async)
HTTP vs WebSocket
Aspect
AsyncHTTPProvider (ws=False)
WebSocketProvider (ws=True)
Connection
New connection per request
Persistent connection
Latency
Higher per-request overhead
Lower latency
Subscriptions
Not supported
Supported (eth.subscribe)
Resource usage
Lower idle usage
Keeps connection open
Use case
One-off transactions
Real-time monitoring, subscriptions
Encryption
The client automatically:
Fetches the network's TEE public key asynchronously
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
The function is
asyncand must beawait-edMakes one asynchronous RPC call to fetch the TEE public key
If
encryption_skisNone, a random ephemeral key is generatedThe encryption key is separate from the transaction signing key
WebSocket connections should be properly closed when done
All
w3.seismicmethods are async and must beawait-edFor sync operations, use
create_wallet_client()
Warnings
Private key security - Never log or expose private keys. Use environment variables or secure key management
Connection cleanup - Close WebSocket connections properly to avoid resource leaks
Error handling - WebSocket connections can drop; implement reconnection logic for production
HTTPS/WSS recommended - Use secure protocols in production to prevent MITM attacks
See Also
create_wallet_client - Sync variant (HTTP only)
create_async_public_client - Async read-only client
EncryptionState - Encryption state class
get_encryption - Encryption derivation function
AsyncSeismicNamespace - The async
w3.seismicnamespaceChains Configuration - Pre-configured chain constants
Last updated

