Position Model
Position Model
Anatomy of an Encrypted Margin Account Entry Price, Direction, Leverage, Expiry — Privately Committed
SnarkSide redefines the concept of a margin account through the design of a cryptographically committed position model. Unlike transparent perpetual DEXes where open positions are stored in publicly readable account slots or mappings, SnarkSide encodes all position data within shielded commitments, forming the foundation of CipherVault. These commitments contain verifiable, private information about a user’s margin status, trading intent, and exposure — all of which are provable under zero-knowledge but never revealed to the blockchain or other participants.
This section unpacks the structure, behavior, and lifecycle of SnarkSide’s position model — the internal logic of how a “trade” becomes an enforceable but invisible on-chain state transition.
Why Encrypt Position Metadata?
Public perp protocols inherently leak critical edge-enabling data:
Entry price reveals sentiment timing.
Trade direction allows adversaries to fade the trade.
Leverage gives fragility signals (especially near liquidation).
Expiry or funding interval allows prediction of rebalancing behavior.
Each of these leaks is an opportunity for MEV searchers or competitors to derive asymmetric advantage — or worse, create liquidation cascades.
SnarkSide neutralizes these vectors by encrypting all position metadata inside a zero-knowledge commitment structure, proving only:
That the position is valid
That sufficient collateral was committed
That the trade’s resolution adheres to protocol invariants
Nothing else is exposed. Not even the size of your position.
Encrypted Position Structure
A SnarkSide position is stored as a Poseidon hash commitment:
position_commitment = Poseidon(
entry_price,
direction,
leverage,
margin_amount,
expiry_slot,
salt,
owner_nullifier
)This value is submitted to the on-chain margin pool as a new vault state. It cannot be queried, decoded, or reverse-engineered.
Fields Breakdown:
entry_price
Price at which position was opened
Private
direction
Long (1) or Short (0)
Private
leverage
1x–20x integer or fixed-point
Private
margin_amount
Collateral locked against position
Private
expiry_slot
Optional forced close or funding interval
Private
salt
256-bit randomizer to ensure unique commitment
Private
owner_nullifier
Proof of ownership identity (never revealed)
Private
This commitment is bound cryptographically and stored as a hash in the on-chain vault tree. To operate on it (extend, update, close, or liquidate), the user must supply a ZK proof of knowledge of its pre-image and satisfy the transition logic.
Opening a Position
Opening a position on SnarkSide involves:
Submitting a trade intent with encrypted direction, notional, slippage, and expiry.
Having the intent matched by a relayer with a counterparty.
Generating a position commitment off-chain using the match parameters.
Submitting a
zkProof(position_commitment)that:Demonstrates knowledge of the committed fields.
Confirms margin commitment is valid.
Enforces leverage * LTV * funding invariants.
No directional flags, leverage, or amounts are submitted on-chain. The proof alone is enough to verify the action.
Maintaining and Updating Positions
Position updates (e.g. partial closes, funding adjustments, re-leveraging) are modeled as:
OldPositionCommitment --[zkProof]--> NewPositionCommitmentThis is verified on-chain via a transition circuit that ensures:
Nullifier for the old position is marked as spent.
Margin invariants (LTV, maintenance margin) are preserved.
Trade history or fee accruals are folded correctly.
Vault root is updated atomically.
Again, none of these values are public. Only their constraints are enforced via SNARKs.
Closing a Position
To close a position, the user provides:
A ZK proof of knowledge of the original commitment.
The closing intent (amount, direction).
A proof that the resulting margin delta is redeemable.
A vault output commitment for the released funds.
The vault system:
Verifies that the original commitment existed.
Confirms that its nullifier is unused.
Updates vault root, logs nullifier, and optionally unlocks margin.
From the chain’s perspective, the only thing that happens is:
A nullifier is marked as spent.
A new vault commitment is added.
A SNARK was valid.
No price, direction, or user address ever appears.
Liquidation Model (Preview)
If a position is no longer solvent (e.g. mark price crosses liquidation threshold), a third-party liquidator can submit:
A ZK proof that a specific position is overexposed.
A proof of solvency failure (e.g. LTV > max).
A proposed vault replacement (for seizure or close).
Burned nullifiers for the liquidated vaults.
This proof is public, but the position details are not. Liquidators must scan proofs, not monitor addresses.
Summary
The SnarkSide Position Model achieves a previously impossible goal: verifiable leveraged trading with zero public position data. Every piece of metadata — direction, leverage, expiry, entry — is encrypted, committed, and proved only under ZK logic.
This model enables:
MEV-immune margin accounts.
Position obfuscation at the protocol level.
Stateless, trust-minimized enforcement of funding and liquidation rules.
Modular, private DeFi composability.
With the position model as its backbone, SnarkSide offers a new kind of trading experience — one where the only person who knows your exposure… is you.
Last updated

