# Jingswap > Blind batch auctions for sBTC swaps on Bitcoin L2. Zero slippage, zero MEV, zero front-running. Jingswap is a blind batch auction protocol on the Stacks blockchain (Bitcoin L2). It enables trustless swaps between sBTC and STX (or USDCx) using periodic blind auctions with oracle-based settlement. ## Key Facts - **Markets**: sBTC/STX and sBTC/USDCx - **Mechanism**: Blind batch auction — depositors on both sides, settled at Pyth oracle clearing price - **Contracts**: SPV9K21TBFAK4KNRJXF5DFP8N7W46G4V9RCJDC22.sbtc-stx-jing-v2, SPV9K21TBFAK4KNRJXF5DFP8N7W46G4V9RCJDC22.sbtc-usdcx-jing-v2 - **Oracle**: Pyth Network (BTC/USD and STX/USD price feeds) - **DEX Pricing**: XYK pool and DLMM for reference - **Website**: https://www.jingswap.com - **Twitter/X**: https://x.com/JingSwap ## How It Works 1. **Deposit phase** (~5 min minimum): Users deposit sBTC or STX/USDCx into the current cycle 2. **Buffer phase** (~1 min): 30-block cooldown — no actions allowed, stale prices expire 3. **Settlement**: Anyone calls settle, Pyth oracle price is read, tokens distributed pro-rata 4. Unswapped remainder rolls into the next cycle automatically ## FAQ Q: What is Jing Swap? A: Jing Swap is a blind batch auction DEX for sBTC swaps on Stacks. Depositors commit funds before the settlement price is known, then everyone settles at the same Pyth oracle spot price. Zero slippage, zero MEV, zero front-running. Q: How is Jing different from a DEX? A: On any DEX — whether constant-product (Uniswap v2) or concentrated liquidity — larger trades move the price against you and are vulnerable to MEV. Jing sidesteps this entirely: all depositors settle at the same Pyth oracle spot price in a single batch. No price impact, no sandwich attacks, and the settlement price is unknown at deposit time. Q: How does a swap cycle work? A: Each cycle has phases: Deposit (lock sBTC or STX, stays open until someone calls close-deposits after 150+ blocks), Buffer (30 blocks of silence so stale prices expire), then Settle (anyone calls settle, Pyth oracle price is read, tokens are distributed pro-rata). Unfilled amounts auto-roll to the next cycle. Q: What are the safety gates? A: Settlement only proceeds if three gates pass: Pyth price must be fresh (< 60s), Pyth confidence must be tight (< 2%), and the oracle price must be within 10% of the on-chain DEX price. If any gate fails, settlement waits until conditions normalize. Q: Why is there a buffer before settlement? A: After deposits close, there's a 30-block buffer (~60s) where no actions are allowed. This is what makes Jing "blind" — the Pyth price must be less than 60 seconds old at the time of the settlement block, so any price that was visible during the deposit phase is guaranteed stale by the time settlement opens. The settler must push a fresh Pyth price that nobody could have seen when depositing. Q: Could the buffer be removed? A: Since the settlement price comes from the Pyth oracle (off-chain exchange data, essentially impossible to manipulate on-chain), the buffer is less about preventing price manipulation and more about preventing timing games. Without it, someone could see all deposits, then front-run the settle transaction with a Bitflow/DLMM trade to profit from the known imbalance. The buffer also prevents the settler from cherry-picking the most favorable Pyth price tick — the price is determined by whatever Pyth reports ~60 seconds after deposits close (30 blocks at ~2s each), which no depositor could have known at deposit time. Removing it would be defensible given how hard Pyth is to manipulate, but you'd lose the timing-game protection. Jing doesn't compete on speed — it competes on integrity. Whales and stacking pools need robust, manipulation-proof settlement, not millisecond execution. One minute of patience is a small price for that guarantee. Q: Can I cancel my deposit? A: During the deposit phase, yes — cancel anytime with no penalty. Once deposits close, your funds are locked for settlement. Q: What if settlement keeps failing? A: Settlement fails if any of the three safety gates fails — Pyth confidence wider than 2%, the price being stale (> 60s), or the oracle price diverging more than 10% from the on-chain DEX price. Anyone can retry settle() and conditions usually normalize within minutes. If settlement still hasn't succeeded after ~500 blocks (~16 min), anyone can call cancel-cycle. All deposits roll over to the next cycle, and users can withdraw (get a refund) during the next deposit phase. No funds are ever stuck. Q: Do I need to claim my tokens after settlement? A: No. Settlement pushes tokens directly to your wallet — there's no claim step. Once the cycle settles, the swapped tokens are already yours. Q: What if the pool is full? A: Each side (STX and sBTC) has 50 deposit slots. If all 50 are taken, you can still deposit — but your amount must be larger than the smallest existing deposit. That smallest depositor gets refunded instantly and you take their slot. This keeps the pool open to serious participants and prevents dust spam. Q: Why do stacking pools need Jing? A: Stacking pools like STX Juice and FastPool need to swap large amounts of sBTC to STX every 2 weeks when rewards come in. Today they do this off-chain — paying 1-2% in slippage on centralized exchanges. With Jing, they can swap on-chain at the oracle price with zero slippage. It's non-custodial, transparent, and verifiable — no more trusting that the pool operator got you the best rate. Q: Can AI agents use Jing? A: Yes. Jing is integrated into the aibtc-dev toolkit — both as MCP tools (15 tools) and CLI skills (15 subcommands). Any AI agent can deposit, cancel, and settle through these interfaces. Because settlement is MEV-proof and the price is oracle-determined, agents can swap without getting sandwiched. Q: Where are the smart contracts? A: The current market contracts are sbtc-stx-jing-v2 and sbtc-usdcx-jing-v2 by SPV9K21TBFAK4KNRJXF5DFP8N7W46G4V9RCJDC22. The previous contracts (sbtc-stx-jing, sbtc-usdcx-jing, sbtc-stx-jingswap, sbtc-usdcx-jingswap) are retired but their history is preserved on-chain. Q: What is a Drip strategy? A: A premium feature for large holders. A dedicated contract is deployed where only you can withdraw. A keeper drips your position across many auction cycles over days or weeks — like a self-custodied TWAP order. No market impact, trustless custody. Q: Is Jing Swap open source? A: Yes. All smart contracts are fully open source and publicly available for review. Inspired by CoW Protocol batch auctions, adapted for Stacks. Q: Who built Jing Swap? A: Jing Swap is built by RaphaStacks and the Stacks community. It is an independent project with no VC funding or token sale. ## AI Agent Integration Jingswap is fully accessible to AI agents via: - **aibtc MCP Server**: 15 tools prefixed `jingswap_*` — install via `npx @aibtc/mcp-server@latest --install` - **aibtc Skills**: 15 CLI subcommands — `bun run jingswap/jingswap.ts ` - **API**: Backend endpoints at `/api/auction/*` (requires API key) Agents can query cycle state, deposit/cancel, close deposits, settle auctions, and monitor prices programmatically. ## Detailed documentation - [llms-full.txt](https://www.jingswap.com/llms-full.txt) ## Links - Website: https://www.jingswap.com - X/Twitter: https://x.com/JingSwap - AI Tools: https://www.jingswap.com/ai-tools - sBTC/STX contract: https://explorer.hiro.so/txid/SPV9K21TBFAK4KNRJXF5DFP8N7W46G4V9RCJDC22.sbtc-stx-jing-v2?chain=mainnet - sBTC/USDCx contract: https://explorer.hiro.so/txid/SPV9K21TBFAK4KNRJXF5DFP8N7W46G4V9RCJDC22.sbtc-usdcx-jing-v2?chain=mainnet