Subgraph Alternative
Subgraph Alternative
How to Query Encrypted Intent State • Off-Chain Observable Event Patterns
In standard DEX architectures, The Graph or similar indexing protocols provide a convenient way to monitor on-chain events such as order creation, trade settlement, or vault state. These models depend on transparency—of calldata, logs, and user identities.
SnarkSide, by design, eliminates all three.
There are no public vaults, no orderbook events, and no address-linked state transitions. The protocol’s privacy guarantees deliberately break conventional indexing patterns. As such, building indexers or analytics dashboards for SnarkSide requires rethinking how visibility, causality, and trust are modeled.
This section defines SnarkSide’s alternative to The Graph—a system of off-chain observable event patterns, paired with cryptographically verifiable rollup metadata, allowing clients to index without revealing any user data.
1. What Cannot Be Indexed
Unlike other DEXs, SnarkSide does not emit:
Transferlogs linked to wallet addressesTradeevents with token quantities or directionVaultUpdatedstate diffs tied to a public userLiquidationlogs with initiator/reward linkageLP depositorwithdrawalmarkers
All these are abstracted away through encrypted notes, nullifiers, and ZK-bound constraints.
2. What Can Be Indexed
SnarkSide exposes only:
Batch commitments (ZK-verifiable rollup hashes)
Merkle roots for vault tree, intent tree, liquidation tree
Nullifiers (unlinked hash preimages)
Timestamped batch metadata
These act as indirect signals of state transitions. By observing and cryptographically verifying batch metadata, indexers can build privacy-preserving analytics, such as:
Matching frequency
Liquidation volume (aggregated)
Relayer liveness
Vault tree turnover rate
Market heat without user correlation
3. Rollup-Centric Event Modeling
Each batch is a BatchSettlement event on-chain:
event BatchSettlement (
bytes32 batchRoot,
bytes32 nullifierMerkleRoot,
bytes32 vaultMerkleRoot,
uint64 timestamp,
bytes32 zkProofHash
);This becomes the anchor for off-chain state tracking. Every meaningful update must pass through this root. From here, off-chain clients derive intent matching events, vault closings, LP payout releases, etc., using pre-agreed observable heuristics.
4. Off-Chain Observable Patterns
These patterns allow inference of anonymized protocol state:
Nullifier reuse
Appears in multiple batches
Vault closed or updated
Batch interval shrink
Settlement interval tightens
Matching activity increasing
Oracle sync frequency
Higher price push frequency
High volatility, faster funding
Relayer rotation
New relayer addresses appear in proof
Matching decentralization occurring
Vault root change size
Size delta in root hash
Volume of new position flow
These are indirect, anonymized signals. They enable data-rich dashboards without violating user privacy.
5. Querying the Rollup Data
Instead of a Subgraph, SnarkSide supports:
Rollup event listener service (Node.js or Rust)
Nullifier scanner module
Vault tree replayer (trusted or trustless)
Batch audit script
A basic rollup scanner:
import { ethers } from 'ethers';
import ABI from './BatchABI.json';
const provider = new ethers.JsonRpcProvider(RPC_URL);
const contract = new ethers.Contract(CONTRACT_ADDR, ABI, provider);
contract.on("BatchSettlement", (batchRoot, nullRoot, vaultRoot, timestamp, proofHash) => {
console.log("New Batch:", batchRoot);
// Store for off-chain analysis
});Clients then use this to:
Sync nullifier sets
Calculate Merkle proofs locally
Cross-reference timestamped batch deltas
Build heatmaps of market-wide anonymized activity
6. Analytics Without Visibility
Instead of querying “who did what,” SnarkSide enables querying:
How many vaults changed state?
How often are matches happening in this market?
What’s the average vault lifespan?
How many intents were matched in this epoch?
What % of batches include new LP entries?
All of these questions are answerable with no user data, no address introspection, and no token visibility.
This is analytics restructured for cryptographic anonymity.
7. Future: zkGraph Module
SnarkSide will eventually expose a zkGraph schema, where relayers submit:
Aggregated metrics
Encrypted rollup summaries
SNARK proofs of metric correctness
Examples:
Prove
Xintents were matched in epochTProve
Nvaults liquidated in last 6 hoursProve funding rate exceeded 20% APY during interval
Users will be able to query private data, verified via ZK, without trusting indexer nodes.
Conclusion
SnarkSide is incompatible with The Graph—not by limitation, but by design.
Instead of querying state visibility, developers and analysts are given cryptographic root access to the system’s flow, with guarantees of:
User unlinkability
Market opacity
Verifiable truth
MEV exploits the visible. SnarkSide’s Subgraph alternative ensures nothing important is ever visible—but everything is still provable.
Last updated

