Funding Rate Model

Funding Rate Model

Computing Skew from Encrypted Open Interest • Avoiding Manipulation Without Revealing Directionality


In traditional perpetual futures markets, the funding rate is a critical mechanism for anchoring the perp price to the underlying spot market. It dynamically incentivizes traders to either long or short based on net open interest. However, in transparent on-chain implementations, funding becomes an adversarial signal — a leak that reveals aggregate positioning and exposes the protocol to manipulation.

SnarkSide introduces a novel privacy-preserving funding rate model, engineered to compute open interest skew and funding differentials without ever revealing individual positions or net directional bias. It accomplishes this using encrypted vaults, zero-knowledge aggregation proofs, and epochal mark commitments.

This section outlines how SnarkSide safely computes funding adjustments, prevents oracle manipulation or skew attacks, and enforces time-decoupled settlements — all under cryptographic privacy constraints.


The Problem with Transparent Funding

In typical perp DEXs:

  • Net open interest (OI) is public and directional.

  • Traders can "game" funding by entering large temporary positions.

  • LPs are exposed to toxic flow when traders crowd one side to extract rebates.

  • Observers gain information asymmetry by watching positioning shift.

Transparency around OI undermines neutrality and creates extractable alpha.


SnarkSide's Solution: Encrypted Open Interest Aggregation

SnarkSide does not compute funding from real-time addresses or position counts. Instead, it builds a private epochal aggregate of long vs. short positions, sourced from encrypted vaults.

Key Properties:

  • All positions are stored as Poseidon-hashed vault commitments.

  • No trader address, position size, or direction is visible.

  • Each epoch (e.g., 1h), relayers construct a ZK aggregation proof that computes:

skew_factor = (total_notional_longs - total_notional_shorts) / global_notional

The proof outputs only the funding coefficient, not the raw values.


Zero-Knowledge Skew Aggregation

Each vault has private fields:

vault = Poseidon(
    notional_size,
    entry_price,
    position_direction,  // 1 = long, 0 = short
    expiry_slot,
    margin_amount,
    salt,
    nullifier
)

The relayer performs:

  1. Merkle scan of active vaults.

  2. Selects those with expiry ≥ current epoch.

  3. Separates longs vs shorts in circuit logic.

  4. Sums notional_size fields conditioned on direction.

  5. Computes the skew ratio off-chain.

  6. Generates a SNARK proving the computation is correct under constraints.

The resulting proof binds:

  • epoch_id

  • funding_coefficient

  • vault_merkle_root

  • Timestamp

This is posted on-chain as a ZK funding anchor.


Constraint Circuit Snippet

component skew = SkewAggregator(n);

for (var i = 0; i < n; i++) {
    signal isLong = vaults[i].direction;
    signal notional = vaults[i].notional_size;
    
    skew.totalLongs += isLong * notional;
    skew.totalShorts += (1 - isLong) * notional;
}

skew.coefficient <== (skew.totalLongs - skew.totalShorts) / (skew.totalLongs + skew.totalShorts);

The circuit emits skew.coefficient as a public input — but all vaults and directions remain encrypted and unlinked.


Applying the Funding Rate

Each trader’s vault contains:

  • entry_funding_index

  • mark_funding_index

To compute the funding owed:

funding_owed = (mark_funding_index - entry_funding_index) * notional_size * direction

This calculation is done inside the position update or liquidation circuits, and verified without revealing any of the position parameters.

Traders cannot spoof directionality. LPs cannot selectively rebalance. The protocol maintains non-extractable market incentives.


Avoiding Funding Manipulation

Because:

  • The direction is hidden,

  • The size is hidden,

  • The aggregation is delayed (epoch-based),

  • The funding proof is zk-bound,

→ No trader can "see" what the current skew is until it’s too late. → No actor can reverse-engineer the imbalance from on-chain state. → There is no funding oracle leak to game.

This eliminates the key attack vectors that plague most perp DEXs.


Funding Synchronization Logic

To ensure time-consistent state:

  • Epochs are deterministically derived from Solana or EVM block timestamps.

  • Funding proofs must be submitted within a pre-set finalization window.

  • Late funding updates invalidate the epoch and are ignored in downstream circuits.

  • Funding updates are hashed into the position commitment tree, so they can be proven later.

This guarantees that all funding adjustments are verifiable, synchronized, and tamper-resistant.


Summary

SnarkSide’s funding rate system achieves what no transparent DEX can:

  • A dynamic funding model that anchors perps to spot

  • Without revealing who is long, who is short, or how much

  • Enforced by ZK aggregation and circuit constraints

This is funding as a private market oracle, not a public vector of attack. It is a system where capital incentives are balanced without betraying signal. And in that silence, SnarkSide restores market symmetry.

Last updated