eyeEvent 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 decrypt

What Is Encrypted

Event Field
Encrypted?
Description

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

circle-info

Indexed event parameters (addresses) remain visible as log topics. Only the non-indexed suint256 values in the event data are encrypted.

Subscribing to SRC20 Events

Use an unsigned WebSocket provider to subscribe to events in real time:

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:

  1. Register a viewing key with the Seismic Directory contract

  2. Derive the decryption key from the viewing key and the event's encryption context

  3. Decrypt the event data using AES-GCM

circle-exclamation

Conceptual Flow

Monitoring Multiple Event Types

Subscribe to both Transfer and Approval events simultaneously:

Notes

  • SRC20 events encrypt only the suint256 value fields, not the indexed address parameters

  • Indexed parameters (addresses) are always visible as log topics

  • Event subscription requires a WebSocket provider (new_ws())

  • 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_logs queries. Use pagination for large historical ranges.

See Also

Last updated