Skip to content

vibevortex32/sylphy-

Repository files navigation

███████╗██╗   ██╗██╗     ██████╗ ██╗  ██╗██╗   ██╗
██╔════╝╚██╗ ██╔╝██║     ██╔══██╗██║  ██║╚██╗ ██╔╝
███████╗ ╚████╔╝ ██║     ██████╔╝███████║ ╚████╔╝ 
╚════██║  ╚██╔╝  ██║     ██╔═══╝ ██╔══██║  ╚██╔╝  
███████║   ██║   ███████╗██║     ██║  ██║   ██║   
╚══════╝   ╚═╝   ╚══════╝╚═╝     ╚═╝  ╚═╝   ╚═╝   

Confidential OTC Settlement Rail on Arbitrum

Trade without revealing your identity, size, or price — enforced by cryptography, not trust.


Network License


Solidity React Hardhat Arbitrum RainbowKit Wagmi


✦ Overview

Sylphy is an institutional-grade, privacy-first OTC protocol where two parties can trade large blocks of digital assets without leaking sensitive information to the market. Every trade is:

  • 🔒 Private — amounts hidden via Pedersen commitments
  • 🤫 Anonymous — identity sealed inside a Trusted Execution Environment
  • Compliant — every party is KYC/AML verified via ERC-3643 before settlement
  • Fast & Cheap — atomic settlement on Arbitrum L2

╔══════════════════════════════════════════════════════════════╗
║                      SYLPHY FLOW                             ║
╠══════════════════════════════════════════════════════════════╣
║                                                              ║
║   Trader A (BUY intent)  ──┐                                 ║
║                             ├──► TEE Matching Engine         ║
║   Trader B (SELL intent) ──┘     (Nox Protocol)              ║
║                                       │                      ║
║                                       ▼                      ║
║                             Compliance Check (ERC-3643)      ║
║                                       │                      ║
║                                       ▼                      ║
║                          Atomic On-Chain Settlement          ║
║                              (Arbitrum Sepolia)              ║
║                                       │                      ║
║                                       ▼                      ║
║                        Encrypted Audit Log → Regulator       ║
║                                                              ║
╚══════════════════════════════════════════════════════════════╝

✦ Repository Structure

sylphy/
│
├── 📁 frontend/              # React dashboard — the trading interface
│   ├── src/
│   │   ├── App.jsx           # Core app — 5 dashboard pages
│   │   ├── main.jsx          # Entry — RainbowKit + Wagmi providers
│   │   ├── wagmi.ts          # Chain config — Arbitrum Sepolia
│   │   ├── contracts.ts      # ABIs + deployed addresses + helpers
│   │   └── styles.css        # Full design system (dark terminal theme)
│   ├── dashboard.html        # Dashboard HTML entry
│   ├── index.html            # Landing page HTML entry
│   └── vite.config.ts        # Vite build config
│
├── 📁 backend/               # Node.js intent API + matching engine
│   ├── server.js             # Express REST API (CORS, validation, routes)
│   ├── db.js                 # JSON file storage (zero native deps)
│   └── matcher.js            # Price-time-priority matching engine
│
├── 📁 contracts/             # Solidity smart contracts
│   ├── SylphyCompliance.sol  # KYC/AML on-chain verification (ERC-3643)
│   ├── SylphyAuditLog.sol    # Encrypted regulator audit trail
│   ├── SylphySettlement.sol  # Core atomic settlement engine
│   └── interfaces/           # Shared interfaces
│
├── 📁 scripts/               # Hardhat deployment & verification
│   ├── deploy.ts             # Deploy all contracts + wire roles
│   ├── verify.ts             # Verify on Arbiscan
│   └── simulate-tee.ts       # Simulate TEE matching for testing
│
├── 📁 tee/                   # TEE enclave simulation (Nox Protocol)
│
├── 📁 tests/                 # Contract test suite (Hardhat)
│
├── hardhat.config.ts         # Hardhat config — optimizer + network
├── .env.example              # Environment variable template
└── README.md                 # You are here

✦ Frontend

React 18 · Vite · RainbowKit · Wagmi v2 · TanStack Query

The dashboard provides a terminal-aesthetic trading interface with 5 sections:

PageDescriptionData Source
🖥️ Dashboard Real-time stats, order book, TEE status terminal, trade activity feed Mock (demo) + wallet balance via wagmi
📋 OTC Desk Submit BUY/SELL intents — token, amount, price limit, slippage, expiry Calls POST /api/intents on backend
💱 Settlements Live matched trades + open intents for connected wallet GET /api/matches/:address + /api/intents/:address
✅ Compliance KYC/AML status, identity claim hash, ERC-3643 attestation details On-chain via SylphyCompliance
🔐 Audit Log Encrypted audit entries — visible structure, content regulator-key-only GET /api/matches/:address

Supported Wallets: MetaMask · Rainbow · WalletConnect · Coinbase Wallet


✦ Backend API

Node.js · Express · JSON file persistence · Auto-matching every 10 seconds

Base URL

Development:  http://localhost:4000
Production:   https://your-railway-url.up.railway.app

Endpoints

Method Endpoint Auth Description
GET /api/health None Service health check
POST /api/intents None Submit a new trade intent
GET /api/intents/:address None Get all intents for a wallet
GET /api/intents/detail/:id None Get a single intent by ID
DELETE /api/intents/:id x-wallet-address header Cancel a pending intent
GET /api/matches/:address None Get all matches for a wallet
GET /api/matches None Get all matches (admin/debug)
POST /api/match None Manually trigger matching cycle

Intent Payload

POST /api/intents
{
  "address":     "0xYourWalletAddress",
  "direction":   "BUY",           // or "SELL"
  "token":       "RLC",           // RLC | ETH | USDC | WBTC
  "amount":      500000,          // minimum 1,000
  "price_limit": 1.40,            // max you'll pay (BUY) or min (SELL)
  "slippage":    0.3,             // 0.1 – 5.0 %
  "expiry_min":  30               // 30 | 60 | 240 | 1440
}

Matching Algorithm

BUY  fills if:  buy.price_limit  ≥  sell.price_limit × (1 - slippage%)
Exec price   =  (buy.price_limit + sell.price_limit) / 2
Exec amount  =  min(buy.amount, sell.amount)
Priority     =  price → time (FIFO for equal prices)

✦ Smart Contracts

Solidity 0.8.24 · OpenZeppelin · Hardhat · viaIR optimizer · Arbitrum Sepolia

Deployed Addresses

ContractAddressArbiscan
SylphyCompliance 0xAabF6602a0b800e2D86e1087b55b720d6423242f ✅ Verified
SylphyAuditLog 0x3e8651E19b50b3676cFFc68b965fF9A2d06e07ea ✅ Verified
SylphySettlement 0x0971b15f06398882B71bAedd27fb28B535751b1a ✅ Verified

Contract Responsibilities

SylphyCompliance.sol

  • On-chain KYC/AML verification via ERC-3643 identity claims
  • Stores only attestation hashes — never raw personal data
  • Regulator and admin roles with granular access control

SylphyAuditLog.sol

  • Receives encrypted audit payloads from the TEE operator
  • Each entry is AES-256 encrypted with the regulator's public key
  • Emits events for off-chain indexing — fully transparent structure

SylphySettlement.sol

  • Accepts SettlementParams with TEE attestation + compliance proof
  • Verifies Pedersen commitments on-chain before fund movement
  • Supports ERC-20 tokens via SafeERC20
  • Pausable, role-based, reentrancy-protected

✦ Privacy Architecture

Feature Technology What It Hides
Trade amount Pedersen commitment Exact size never on-chain
Trade price TEE sealed computation Price inside secure enclave
Counterparty Nox Protocol TEE Neither party knows the other
Identity ERC-3643 claim hash Personal data never stored
Audit content AES-256 regulator key Details private from market
Timing Jitter randomization Strategy not inferrable

✦ Getting Started

Prerequisites

  • Node.js v18 or higher
  • Git
  • MetaMask (or any WalletConnect-compatible wallet)
  • ETH on Arbitrum Sepolia — Quicknode Faucet

Step 1 — Clone

git clone https://github.com/vibevortex32/sylphy-.git
cd sylphy

Step 2 — Environment

cp .env.example .env

Open .env and fill in:

PRIVATE_KEY=0xYourWalletPrivateKey
ARBITRUM_SEPOLIA_RPC_URL=https://sepolia-rollup.arbitrum.io/rpc
ARBISCAN_API_KEY=YourArbiscanApiKey

Step 3 — Run the Frontend

cd frontend
npm install
npm run dev

Opens at http://localhost:5173/dashboard.html

Step 4 — Run the Backend

# In a new terminal tab
cd backend
npm install
npm run dev

API running at http://localhost:4000 — auto-restarts on file change

Step 5 — Test a Full Match

  1. Open http://localhost:5173/dashboard.html
  2. Connect your wallet (MetaMask on Arbitrum Sepolia)
  3. Go to OTC Desk → Submit BUY 5000 RLC @ $1.40
  4. Submit SELL 5000 RLC @ $1.30
  5. Toast: 🎯 MATCHED! 5000 RLC @ $1.35
  6. Check Settlements → your match appears live
  7. Check Audit Log → encrypted entry created

✦ Deploy Contracts

# Install root dependencies
npm install

# Compile contracts
npx hardhat compile

# Deploy to Arbitrum Sepolia
npx hardhat run scripts/deploy.ts --network arbitrumSepolia

# Verify on Arbiscan
npx hardhat run scripts/verify.ts --network arbitrumSepolia

✦ Tech Stack

LayerTechnologyVersionPurpose
UI FrameworkReact18Component-based dashboard
Build ToolVite5.xFast dev server + bundling
WalletRainbowKit2.xWallet connection modal
Chain HooksWagmi2.xReact hooks for Ethereum
Async StateTanStack Query5.xCache + refresh on-chain data
Smart ContractsSolidity0.8.24On-chain settlement logic
Dev FrameworkHardhat2.xCompile, test, deploy
Contract LibsOpenZeppelin5.xAccessControl, Pausable, ERC-20
NetworkArbitrum SepoliaL2 testnet (Chain ID: 421614)
APIExpress.js4.xREST intent API
StorageJSON file (Node fs)Zero-dependency persistence
Frontend DeployVercelCDN + edge deployment
Backend DeployRailwayAlways-on Node.js server

✦ Roadmap

  • Smart contract suite (Compliance, AuditLog, Settlement)
  • React dashboard with RainbowKit wallet connection
  • Intent submission API + price-time-priority matching engine
  • Live settlements and audit log from backend
  • Contract verification on Arbiscan
  • Deploy backend to Railway (always-on)
  • Real TEE integration (Nox Protocol production enclave)
  • Multi-token support (WBTC, stablecoins)
  • Regulator dashboard (decryption interface)
  • Mainnet deployment

✦ License

MIT License — Copyright © 2026 Sylphy Protocol

Permission is hereby granted, free of charge, to any person obtaining
a copy of this software to use, copy, modify, merge, publish, and/or
distribute it, subject to the conditions in the LICENSE file.

Built with 🌊 on Arbitrum

Arbiscan

About

OTC settlement for instituion, vc, market makers and whales

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors