.read
Signed read namespace for encrypted contract queries
The .read namespace provides encrypted contract read operations using signed eth_call. Both calldata and return values are encrypted end-to-end, and the transaction is signed to prove your identity to the contract.
Overview
When you call contract.read.functionName(...), the SDK:
Encodes your function call using the contract ABI
Encrypts the calldata using AES-GCM with a shared key derived via ECDH
Constructs a full
TxSeismicwith encryption metadata (nonce, block hash, expiry)Signs the transaction with your private key
Sends the signed transaction to
eth_callendpointNode decrypts calldata inside TEE, executes the call, encrypts the result
Returns encrypted result (which the SDK can decrypt if needed)
Unlike standard eth_call, signed reads prove your identity to the contract via msg.sender, enabling access-controlled queries.
Usage Pattern
result = contract.read.functionName(arg1, arg2, ...)Sync: Returns decoded Python value immediately
Async: Returns decoded Python value (must
await)
Return values are automatically ABI-decoded:
Single output (e.g.
returns (uint256)): returns the value directly (int,bool,str, etc.)Multiple outputs (e.g.
returns (uint256, bool)): returns atupleNo outputs defined in ABI: returns
None
Parameters
Function Arguments
Pass function arguments as positional parameters:
Call Options (Keyword Arguments)
All call options are optional keyword arguments:
value
int
0
ETH value for the call (in wei)
gas
int
30_000_000
Gas limit for the call
Note: Unlike .write, there is no gas_price parameter because reads don't consume gas.
Examples
Sync Usage
Async Usage
Reading with Arguments
Custom Gas Limit
Custom Security Parameters
Simulating Value Transfer
Return Value
Returns the ABI-decoded Python value:
Single output (e.g.
returns (uint256)): the value directly —int,bool,str,bytes, etc.Multiple outputs (e.g.
returns (uint256, bool, address)): atupleof decoded valuesNo outputs defined in ABI:
None
Why Use Signed Reads?
Identity Matters
Many contracts use msg.sender to determine access or return personalized data. For example, SRC20's balanceOf() takes no arguments and returns the caller's balance:
With signed read (.read):
With transparent read (.tread):
Common Use Cases
Use signed reads when the contract function:
Checks
msg.senderpermissionsReturns data specific to the caller
Has access control (owner-only, role-based, etc.)
Uses
msg.senderin any way
Privacy Guarantees
What Gets Encrypted
Function selector (4 bytes)
All function arguments
Return value (encrypted by node)
An observer watching the network can see:
Your address (call sender)
Contract address (call recipient)
That you made a call (via signed transaction)
But cannot see:
Which function you called
What arguments you passed
What data was returned
What Remains Visible
These fields are not encrypted:
from— Your wallet addressto— Contract addressGas limit
Transaction metadata (block hash, expiry, encryption nonce)
Comparison with .tread
Feature
.read (Signed)
.tread (Transparent)
Calldata encryption
Yes
No
Result encryption
Yes
No
Proves identity
Yes (msg.sender is your address)
No (msg.sender is 0x0)
Gas cost
None (doesn't broadcast)
None (doesn't broadcast)
Use case
Access-controlled reads
Public reads
Security Considerations
Block Hash Freshness
Like shielded writes, signed reads include a recent block hash. The node validates:
Block hash corresponds to a real block
Block is recent (within freshness window)
Transaction Expiry
Calls include an expiry block number:
Default: 100 blocks (~20 minutes)
After expiry, node rejects the call
Nonce Uniqueness
Each call uses a cryptographically random 12-byte encryption nonce. The SDK generates random nonces automatically.
Private Key Security
Signed reads require your private key to sign the call. Never expose your private key or share it with untrusted parties.
Error Handling
Best Practices
Use .read When
Contract function checks
msg.senderYou need to prove your identity
Data is access-controlled (requires authentication)
Privacy is required (both query and result)
Don't Use .read When
Function is public and doesn't check
msg.senderNo privacy needed (use
.treadfor lower overhead)Function is a simple getter with no access control
Production Checklist
Verify contract function actually uses
msg.senderUse appropriate gas limits for complex reads
Results are auto-decoded — no manual
eth_abi.decodeneededConsider caching read results if called frequently
Low-Level Alternative
If you need more control (e.g., pre-encoded calldata):
See Signed Read Guide for details.
Async Patterns
Concurrent Reads
Read with Timeout
See Also
Signed Read Guide — Full workflow and examples
SeismicSecurityParams — Security parameter reference
.write Namespace — Encrypted writes
.tread Namespace — Transparent reads without encryption
ShieldedContract — Contract wrapper reference
Last updated

