Event Decryption
Decrypting encrypted SRC20 Transfer and Approval events
Decode encrypted Transfer and Approval events emitted by SRC20 contracts.
Overview
SRC20 events contain encrypted suint256 values. Unlike standard ERC20, where Transfer and Approval event data is publicly visible on-chain, SRC20 encrypts the amounts so that only authorized parties can read them. To decrypt event data, you need a viewing key registered with the Seismic Directory contract.
How SRC20 Events Work
Standard ERC20 Transfer event:
Transfer(address indexed from, address indexed to, uint256 value)
-> value is publicly visible in event logs
SRC20 Transfer event:
Transfer(address indexed from, address indexed to, suint256 value)
-> value is encrypted in event logs
-> Only holders of the viewing key can decryptWhat Is Encrypted
from (indexed)
No
Sender address is visible as a topic
to (indexed)
No
Recipient address is visible as a topic
value
Yes
Transfer amount is encrypted in event data
owner (indexed, Approval)
No
Owner address is visible
spender (indexed, Approval)
No
Spender address is visible
Subscribing to SRC20 Events
Use a WebSocket provider to subscribe to events in real time. Both signed and unsigned WebSocket providers are supported via connect_ws():
Fetching Historical Events
Query past Transfer events using get_logs:
Filtering by Sender or Recipient
Use indexed topics to filter events for a specific address:
Viewing Keys and Decryption
SRC20 event values are encrypted with the contract's encryption scheme. To decrypt them:
Register a viewing key with the Seismic Directory contract
Derive the decryption key from the viewing key and the event's encryption context
Decrypt the event data using AES-GCM
Viewing key registration and event decryption are protocol-level features. The exact API for registering viewing keys and decrypting events may vary depending on the SRC20 implementation and the Seismic protocol version. Consult the latest protocol documentation for the current viewing key registration process.
Conceptual Flow
Monitoring Multiple Event Types
Subscribe to both Transfer and Approval events simultaneously:
Notes
SRC20 events encrypt only the
suint256value fields, not the indexed address parametersIndexed parameters (addresses) are always visible as log topics
Event subscription requires a WebSocket provider (
connect_ws()). Both signed and unsigned WebSocket providers are supported.Historical event queries work with HTTP providers via
get_logs()Viewing key registration is done through the Seismic Directory contract
Each SRC20 contract manages its own encryption context for events
Warnings
Privacy limitations — While transfer amounts are encrypted, the sender and recipient addresses are still visible as indexed topics. Transaction metadata (gas, block number, etc.) is also public.
Viewing key management — Protect your viewing key private key. Anyone with access to it can decrypt your token events.
Block range limits — Some RPC providers limit the block range for
get_logsqueries. Use pagination for large historical ranges.
See Also
Token Interaction — Reading balances and metadata
Transfers — Shielded transfer patterns
Precompiles Overview — Cryptographic operations used in decryption
Provider Overview — WebSocket and HTTP providers
Last updated

