signatureSigned Read Pattern

Complete signed read pattern with result decoding

This example demonstrates signed reads (.read), which encrypt both the calldata you send and the result you receive. Signed reads prove your identity to the contract via msg.sender, enabling access-controlled data retrieval.

Prerequisites

# Install the SDK
pip install seismic-web3

# Set environment variables
export PRIVATE_KEY="your_64_char_hex_private_key"
export CONTRACT_ADDRESS="0x..." # Your deployed contract address

Why Use Signed Reads

Signed reads are necessary when:

  1. The contract function depends on msg.sender (e.g., balanceOf() with no arguments)

  2. You need to prove your identity for access control

  3. You want to hide what data you're querying from external observers

A transparent read (.tread) sets msg.sender to the zero address, which usually returns incorrect data.

Basic Signed Read

Complete Read Workflow with Type Decoding

Signed Read vs Transparent Read

This example shows the difference between signed and transparent reads:

Custom Security Parameters

Like shielded writes, signed reads support custom security parameters:

Low-Level Signed Call

For pre-encoded calldata or advanced use cases:

Error Handling

Async Signed Reads

Batch Reads

Expected Output

Common Variations

Reading Complex Types

Handling View Functions with Arguments

Next Steps

See Also

Last updated