VeilSwap

A privacy-preserving intent-based DEX settlement layer using MPC.

VeilSwap

Created At

HackMoney 2026

Winner of

Uniswap Foundation

Uniswap Foundation - Uniswap v4 Privacy DeFi 2nd place

ENS

ENS - Integrate ENS

Prize Pool

Project Description

VeilSwap is a privacy‑preserving on‑chain intent settlement system built as a pnpm monorepo with three main parts: a Foundry smart‑contract workspace, a TypeScript MPC node service, and a Next.js web app.

VeilSwap’s core is the MPC node network: multiple independently run nodes listen for on‑chain IntentCreated events, then privately compute allocations using replicated secret sharing (RSS) so no single node learns other nodes’ balances or the network’s total capacity. Each node only sees its own allocation, while the leader aggregates signatures and submits a batch settlement on‑chain. This design preserves privacy (capacities and balances remain hidden) while still enabling deterministic settlement and auditability on the Settlement contract. For liquidity, nodes can hold any ERC‑20 and automatically swap into the required output token using Uniswap v4. The node service integrates the Universal Router + Permit2 flow to perform swaps, and maintains an inventory of token balances to decide when swapping is needed. This makes the system flexible: a node can contribute to any intent as long as it can swap into the requested token, without revealing its full holdings. Node discovery and identification are ENS‑friendly. Node names can be derived from a base ENS name, and peers are specified by ENS‑style identifiers. Nodes auto‑generate and persist wallets, advertise their blockchain addresses during P2P handshake, and can be registered on‑chain in the Settlement contract. Together, the ENS naming + handshake address exchange enable consistent identity and peer discovery without centralized coordination, while preserving privacy in the MPC computation itself.

How it's Made

Built as a pnpm monorepo with three layers: Solidity contracts (Foundry), a TypeScript MPC node service, and a Next.js web app. The Settlement contract handles intent creation and batch settlement; nodes listen for IntentCreated events via Viem, run a n‑party replicated secret sharing MPC protocol to compute allocations without revealing capacities, then exchange signatures over a WebSocket P2P network and submit the final settlement. Node identity/discovery uses ENS‑style names and a handshake that shares blockchain addresses, with wallets auto‑generated and persisted locally. For liquidity, nodes integrate Uniswap v4 using the Universal Router + Permit2 flow and a token inventory manager to swap into required output tokens before participating. The web app uses Wagmi + Viem for SSR‑safe chain interactions. Notable hack: end‑to‑end event‑driven MPC orchestration (on‑chain intents → off‑chain compute → on‑chain settlement) with privacy preserved by RSS, plus auto‑swap so nodes can contribute even if they don’t natively hold the output asset.

background image mobile

Join the mailing list

Get the latest news and updates