PublicContract
Sync contract wrapper with transparent read-only access
Synchronous contract wrapper for read-only transparent access to Seismic contracts.
Overview
PublicContract provides a simplified interface for reading public contract state without requiring encryption or a private key. It exposes only the .tread namespace for standard eth_call operations. Use this class when you only need to read public contract data and don't need shielded operations.
Definition
class PublicContract:
def __init__(
self,
w3: Web3,
address: ChecksumAddress,
abi: list[dict[str, Any]],
) -> None:
...Constructor Parameters
w3
Web3
Yes
Synchronous Web3 instance connected to RPC endpoint
address
ChecksumAddress
Yes
Contract address (checksummed Ethereum address)
abi
list[dict[str, Any]]
Yes
Contract ABI (list of function entries)
Namespace
.tread - Transparent Read
Executes standard eth_call with unencrypted calldata. This is the only namespace available on PublicContract.
Returns: Any (ABI-decoded Python value)
Optional Parameters: None (pass positional arguments only)
Examples
Basic Read Operations
Single and Multiple Returns
Array Results
Error Handling
Notes
Read-only: No write operations available (no
.write,.twrite, or.dwritenamespaces)No encryption required: Does not use
EncryptionStateor private keysNo authentication: Standard unsigned
eth_calloperationsGas not consumed:
eth_callis free (doesn't create transactions)Public data only: Cannot access shielded/encrypted contract state
See Also
AsyncPublicContract - Async version of this class
ShieldedContract - Full contract wrapper with write operations
create_public_client - Create client without private key
Contract Instance Guide - Overview of contract interaction patterns
Last updated

