Back to Case Studies
DeFi / DEX|Sienna Network

Sienna Swap: Privacy-Preserving AMM with Front-Running Resistance

Built a privacy-preserving automated market maker DEX on Secret Network that eliminates MEV extraction and front-running through encrypted transaction processing.

Cover Image for Sienna Swap: Privacy-Preserving AMM with Front-Running Resistance

The Challenge

Decentralized exchanges had revolutionized crypto trading, but they came with a hidden tax: front-running. On transparent blockchains, every pending trade was visible in the mempool, creating a systematic extraction of value from regular users.

Sienna Network faced this problem head-on:

The MEV Problem: Miners and sophisticated bots could see pending swap transactions, execute their own trades first, and profit at users' expense. Studies estimated that MEV extraction cost Ethereum users hundreds of millions of dollars annually. Every large swap on a public AMM was essentially advertising "front-run me."

Privacy as Table Stakes: For Sienna's privacy-focused user base, transaction visibility wasn't just about MEV - it was about fundamental financial privacy. Users didn't want their trading activity, portfolio rebalancing, or investment strategies visible to the world.

Technical Complexity: Building an AMM that maintains accurate pricing, provides liquidity providers with fair returns, and enables efficient arbitrage - all while keeping individual transactions private - required solving problems no one had tackled before.

User Experience Trade-offs: Privacy solutions often came with UX penalties: slower transactions, complex key management, limited wallet support. Sienna needed a DEX that felt as smooth as Uniswap while delivering privacy by default.

Our Approach

We designed Sienna Swap to deliver the best of both worlds: the proven mechanics of constant-product AMMs with the privacy guarantees of Secret Network's encrypted computation.

Why AMM Over Order Book?

For a privacy-preserving DEX, we evaluated multiple architectures:

ModelPrivacy PotentialLiquidity EfficiencyImplementation Complexity
Central Limit Order BookHigh (encrypted orders)HighVery High
Constant Product AMMHigh (encrypted swaps)GoodModerate
Batch AuctionsMediumMediumHigh

AMMs offered the best balance: proven economics, simpler privacy implementation, and established user familiarity. The constant-product formula (x * y = k) provides deterministic pricing without revealing individual trade details.

Front-Running Resistance by Design

Secret Network's architecture provides inherent MEV protection:

  1. Encrypted Mempool: Transactions are encrypted before broadcast - no one can see swap details until execution.
  2. TEE Execution: Swaps execute inside Trusted Execution Environments where state is encrypted.
  3. Atomic Settlement: No window exists between price observation and trade execution for front-runners to exploit.

Permissionless Design

Despite the privacy features, we maintained DeFi's core principle: anyone can participate without gatekeepers. Users need only a compatible wallet to swap, provide liquidity, or create new trading pairs.

The Solution

Sienna Swap implements a full-featured AMM with privacy as a foundational property rather than an add-on.

Core AMM Mechanics

Liquidity Pools

  • Standard two-token pools with constant product pricing
  • LP tokens represent proportional pool ownership
  • Fees accrue to liquidity providers automatically

Swap Execution

  • Users specify input token and minimum output amount
  • Swap executes atomically with price determined by pool state
  • Slippage protection ensures users receive expected value

Price Discovery

  • Pool ratios reflect market prices through arbitrage
  • External price feeds available for reference
  • All while individual swap amounts remain private

Privacy Implementation

What's Private

  • Individual swap amounts and directions
  • User addresses participating in swaps
  • Portfolio composition and trading patterns
  • LP position sizes

What's Public

  • Total pool liquidity (enables price discovery)
  • Aggregate trading volume (demonstrates market activity)
  • Fee parameters (ensures transparency)

Technical Mechanisms

  • Viewing Keys: Users generate personal keys to access their own transaction history and LP positions
  • Encrypted State: All position and balance data stored encrypted on-chain
  • Private Tokens: Integration with SNIP-20 token standard for privacy-preserving assets

Integration & Ecosystem

Wallet Support

  • Keplr browser extension with native Secret Network support
  • Hardware wallet integration via Ledger
  • Mobile-friendly design for broad accessibility

Cross-Chain Assets

  • IBC-enabled assets from across Cosmos
  • Secret Bridges for assets from Ethereum and other chains
  • Native SCRT and wrapped token support

Additional Infrastructure

Post-launch, we extended the platform with:

  • JavaScript/TypeScript SDK for developer integration
  • Token vesting contracts for project launches
  • Rewards distribution for liquidity mining programs

Development Process

PhaseDurationFocus
Architecture Design3 weeksAMM mechanics, privacy model, contract structure
Core Development8 weeksSwap logic, liquidity provision, fee distribution
Frontend & Integration4 weeksUser interface, wallet connection, transaction handling
Testing & Security3 weeksComprehensive testing, audit preparation
Launch & IterationOngoingMainnet deployment, SDK development, additional features

Team: 5 full-stack blockchain developers with Cosmos specialization

Initial Development: 4 months to mainnet launch

Results

Platform Capabilities

FeatureDetails
Swap PrivacyFull - amounts and addresses encrypted
Front-Running ProtectionNative - encrypted mempool prevents MEV
Liquidity ProvisionPermissionless pool creation and LP
Supported AssetsSCRT, sTokens, IBC assets, bridged tokens
Wallet SupportKeplr, Ledger

User Experience

  • Near-Instant Execution: Secret Network's fast finality enables responsive trading
  • Clean Interface: Intuitive UI familiar to users of other AMMs
  • Transparent Fees: Clear fee structure with no hidden MEV extraction

Technical Achievements

  • First Privacy-Preserving AMM: Pioneered the combination of AMM mechanics with encrypted state
  • Zero MEV Extraction: Users protected from front-running by design
  • Production Stability: Successful mainnet operation with consistent uptime

Developer Ecosystem

The JavaScript/TypeScript libraries we built enable other projects to integrate Sienna Swap functionality, extending the protocol's reach beyond direct users.

Technologies Used

Secret Network CosmWasm Rust Cosmos SDK IBC Protocol SNIP-20 Fadroma React TypeScript JavaScript Keplr Azure

Ready to ship your blockchain project?

From smart contracts to full-stack dApps, we turn your Web3 vision into reality. Let's talk about what you're building.

hello@hack.bg

By submitting, you agree to our privacy policy.