book-openSeismicPublicNamespace

SeismicPublicNamespace class - Read-only public operations (sync)

The SeismicPublicNamespace class provides read-only Seismic functionality for synchronous public clients. It does not require a private key and is designed for querying blockchain state without performing transactions.

Overview

This namespace is automatically attached as w3.seismic when you create a public client with create_public_client(). It provides:

  • TEE public key retrieval

  • Deposit contract queries (root, count)

  • Public contract wrappers with transparent read capabilities

  • No transaction signing or encryption capabilities

Access

from seismic_web3 import create_public_client

public = create_public_client("https://gcp-1.seismictest.net/rpc")

# Access the namespace
public.seismic.get_tee_public_key()
public.seismic.contract(address, abi)

Public vs Wallet Namespaces

Feature
Public Namespace
Wallet Namespace

Read-only queries

✅ Yes

✅ Yes (inherited)

Shielded writes

❌ No

✅ Yes

Signed reads

❌ No

✅ Yes

Validator deposits

❌ No

✅ Yes

Contract writes

❌ No

✅ Yes

Requires private key

❌ No

✅ Yes

The public namespace is ideal for:

  • Monitoring blockchain state

  • Reading public contract data

  • Querying deposit information

  • Applications that don't need to send transactions

For write operations, use SeismicNamespace with a wallet client.

Class Definition

Methods

Query Methods

get_tee_public_key()

Fetch the TEE's compressed secp256k1 public key.

Returns: 33-byte compressed public key (bytes)

Use case: Required for client-side encryption before sending shielded transactions (though this namespace cannot send transactions itself).

See detailed documentation →


get_deposit_root()

Read the current deposit Merkle root from the deposit contract.

Parameters:

  • address (str, optional): Deposit contract address (defaults to genesis contract at 0x4242424242424242424242424242424242424242)

Returns: 32-byte deposit root hash

Use case: Verify deposit inclusion or monitor deposit tree state.

See detailed documentation →


get_deposit_count()

Read the current deposit count from the deposit contract.

Parameters:

  • address (str, optional): Deposit contract address (defaults to genesis contract at 0x4242424242424242424242424242424242424242)

Returns: Number of deposits as a Python int

Use case: Monitor validator deposits or calculate deposit tree depth.

See detailed documentation →


Contract Factory

contract()

Create a PublicContract wrapper with transparent read-only capabilities.

Parameters:

  • address (ChecksumAddress): Contract address

  • abi (list[dict[str, Any]]): Contract ABI (list of function entries)

Returns: PublicContract instance with namespace:

  • .tread - Transparent reads (unencrypted, read-only)

Note: This returns a PublicContract, not a ShieldedContract. It only supports transparent reads via the .tread namespace. For full contract capabilities including writes and encrypted operations, use a wallet client with SeismicNamespace.

See contract documentation →


Usage Examples

Basic Query Operations

Reading Contract Data

Monitoring Deposits

Multiple Clients Pattern

Custom Deposit Contract

Data Aggregation

When to Use Public vs Wallet Client

Use Public Client When:

  1. Read-only operations: You only need to query blockchain state

  2. No private key: You don't have or want to handle private keys

  3. Monitoring: Building monitoring or analytics tools

  4. Public data: Accessing transparent contract data

  5. Security: Minimizing attack surface by not handling keys

Use Wallet Client When:

  1. Transactions: You need to send transactions

  2. Shielded operations: Working with encrypted contract calls

  3. Signed reads: Performing authenticated queries

  4. Deposits: Submitting validator deposits

  5. Full contract interaction: Using write operations

Limitations

The public namespace does not support:

  • Sending transactions (use SeismicNamespace.send_shielded_transaction())

  • Signed reads (use SeismicNamespace.signed_call())

  • Shielded contract writes (use ShieldedContract.write)

  • Debug transactions (use SeismicNamespace.debug_send_shielded_transaction())

  • Validator deposits (use SeismicNamespace.deposit())

Attempting to perform these operations requires upgrading to a wallet client:

See Also

Last updated