create_async_public_client
Create async Web3 instance with public (read-only) Seismic access
Create an asynchronous AsyncWeb3 instance with public (read-only) Seismic access.
Balance RPC migration: On reth with PR #502,
await w3.eth.get_balance()returns a compatibility placeholder, not native or sUSDC holdings. See Balance RPCs for explicit native queries.
Overview
create_async_public_client() creates an async client for read-only operations on the Seismic network. No private key is required. The w3.seismic namespace provides only public read operations: get_tee_public_key(), get_deposit_root(), get_deposit_count(), and contract() (with .tread only).
Supports both HTTP and WebSocket connections for efficient async queries and real-time monitoring.
Signature
def create_async_public_client(
provider_url: str,
*,
ws: bool = False,
) -> AsyncWeb3Parameters
provider_url
str
Yes
HTTP(S) or WS(S) URL of the Seismic node
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 (AsyncSeismicPublicNamespace)
Examples
Basic Usage (HTTP)
WebSocket Connection
Using Chain Configuration
Async Application
Read-Only Contract Access
Monitoring Pattern
Parallel Queries
Context Manager Pattern
How It Works
The function performs three steps:
Create provider
Create AsyncWeb3 instance
Attach public Seismic namespace
No TEE public key fetching or encryption setup is performed since the client cannot perform shielded operations.
Client Capabilities
Standard AsyncWeb3 Methods (e.g. w3.eth, w3.net)
await get_block(),await get_transaction(),await get_balance()await call(),await estimate_gas()All other standard read-only async
web3.pyfunctionality
Public Seismic Methods (w3.seismic)
await get_tee_public_key()- Get TEE public keyawait get_deposit_root()- Query deposit merkle rootawait get_deposit_count()- Query deposit countcontract()- Create contract wrappers (.treadmethods are async)
NOT Available
send_shielded_transaction()- Requires private keydebug_send_shielded_transaction()- Requires private keysigned_call()- Requires private key and encryptiondeposit()- Requires private keyContract
.swriteand.sreadmethods - Require private key
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 queries
Real-time monitoring, subscriptions
Notes
The function is synchronous (no
awaitneeded) but returns anAsyncWeb3instance whose methods are asyncNo private key required or accepted
No encryption setup performed
No RPC calls during client creation (lightweight)
Cannot perform any write operations or shielded reads
Contract wrappers only expose
.tread(transparent read, async)All
w3.seismicmethods are async and must beawait-edWebSocket connections should be properly closed when done
For write operations, use
create_async_wallet_client()For sync operations, use
create_public_client()
Use Cases
Async block explorers and chain analytics
Real-time monitoring dashboards with WebSocket subscriptions
High-throughput read-only services
Async data aggregation pipelines
Event monitoring and alerting systems
Price oracles with low-latency requirements
Warnings
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_public_client - Sync variant (HTTP only)
create_async_wallet_client - Async client with private key
AsyncSeismicPublicNamespace - The async public
w3.seismicnamespaceChains Configuration - Pre-configured chain constants
Contract Instances - Working with contract wrappers
Last updated

