MStocks

A confidential stock trading platform built on Midnight Network

Repo

About

## Wave 1 submission

MStocks: Privacy-First ZK Stock Trading Engine Live DApp, source code, and deployment parameters on the Midnight Preview Network:

Live DApp: mstocks-mocha.vercel.app

GitHub Repository: github.com/bammyoly/mstocks

Contract Address: f6801a4d93e41adc3f1b6851f7b55fdb524faae5ee8919d16d45fea3dbf28bed

Deploy Tx Hash: f0b8d0bb1e4b6e7f5351d1bde6c334280730685284edba3ac2fb980d65022eab

Key Deliverables & Wave Updates

1. Zero-Knowledge Smart Contract (trading.compact) Toolchain: Written in Compact 0.23; compiled with compactc 0.31.1.

Assets Supported: AAPL, TSLA, GOOGL, MSFT, AMZN, NVDA, SPY, META, NFLX, AMD (10 assets).

Core ZK Circuits:

verifyWallet(): On-chain Sybil protection gate registering verified human wallets.

claimFaucet(): Credits $1,000 Shielded USDC to private state with a 7-day cooldown (604,800s).

placeOrder(): Proves Balance ≥ Cost (Buy) or Holding ≥ Qty (Sell) via ZK proofs, updates local state, and posts an opaque 32-byte commitment hash.

cancelOrder(): Owner-only order cancellation via public key matching in the DApp.

executeTrade(): Recomputes commitments from preimages, enforces price limits (Buy ≥ Trade ≥ Sell), and updates public stats (lastPrice, totalVolume).

Confidential State: 10 TypeScript witness handlers managing private variables (cash/stock balances, salts, secret keys, time) locally on-device.

2. Deployment Pipeline

Automated deployment using deploy.ts / wallet.ts with DUST fee token management and HTTP/WebSocket RPC failover for Preview.

Automatic export of compiled ZK artifacts (zkir, proving keys, contract JS, config.ts) directly to the frontend.

3. Frontend & Web3 Architecture

Tech Stack: React 19, Vite 8, Tailwind v4 (Neo-Brutalist UI).

Midnight Integration: Direct @midnight-ntwrk/midnight-js-contracts (v4.1.1) connection for Lace Wallet.

WASM Proving: Configured Vite with WASM and Node polyfills (Buffer, process, exports) for async in-browser ZK proof generation.

State Persistence: Address-scoped, BigInt-safe localStorage wrapper to keep local private state secure across wallet switches.

4. Market Data & PnL Engine

Real-Time Data: Finnhub REST + WebSocket streaming for 10 assets with an embedded TradingView interactive candlestick widget.

Portfolio Engine: Calculates Average Entry Cost Basis, Unrealized/Realized PnL, and powers a complete trading dashboard (Positions, Orders, Trades, Logs).

From the public Akindo product page. Votes, swipes and the judge score are hackfeed's own.

AI judge

Not judged yet. A free model reads this page, compares it with similar projects and this event's winners, then scores it and says what would make it win.

Still being built?

Not checked yet.

Swipe stats

0upvotes
0skips
0saves

Discussion 0

No comments yet. Ask the team something, or say what you'd use it for.

Posting as a guest. Plain text, 1,000 characters max.

Already built nearby

Closest projects by meaning and shared words. Similar isn't the same as copied: read them.