Skip to content

Nkovaturient/GhostLock-MEV-Reaper

Repository files navigation

GhostLock: MEV Reaper

A stealth shield against MEV, encrypting trades and settling them fair.

Glance

ChatGPT Image Aug 30, 2025, 09_57_54 PM

πŸ›‘οΈ Overview

GhostLock: MEV Reaper is a cutting-edge DeFi platform that protects traders from Maximal Extractable Value (MEV) attacks through advanced cryptographic techniques and fair ordering mechanisms. Built on Base Sepolia, it leverages blocklock encryption, VRF-based ordering, and AI-optimized batch auctions.

GhostLock Banner

✨ Key Features

  • πŸ”’ Blocklock Encryption: Time-locked encryption hides trading intents until execution
  • 🎲 VRF Ordering: Verifiable Random Function ensures fair transaction sequencing
  • ⚑ Batch Auctions: Uniform pricing eliminates front-running opportunities
  • πŸ€– Trade Intents Settlement:
    • Future: Solver competition board to ensure liveness + decentralization.
  • πŸ“Š Transparency Panel (new):
    • Gas fee estimate,
    • Unlock block + decryption ETA (calculated dynamically per network),
    • Expected receive amount via 1inch API.
  • πŸ’³ Mock ERC-20 Tokens: ETH, USDC, WETH for dev/test.

πŸ—οΈ Architecture

Frontend (React + TypeScript)

  • Framework: React 18 with TypeScript
  • Styling: TailwindCSS with custom design system
  • Animations: Framer Motion + Three.js for 3D components
  • Web3: Wagmi + RainbowKit for wallet integration
  • State: Zustand for client state management

Backend (Node.js + Express)

  • Runtime: Node.js with Express framework
  • Blockchain: Ethers.js for smart contract interaction
  • APIs: RESTful API design with comprehensive endpoints
  • Real-time: WebSocket support for live updates

Smart Contracts (Solidity)

  • GhostLockIntents: Manages encrypted trading intents
  • BatchSettlement: Handles uniform-price batch auctions
  • EpochRNG: Provides verifiable randomness for fair ordering
  • MockTokens: Test tokens for development and testing

βš”οΈ How GhostLock is Different

Compared to other MEV-resistant efforts, GhostLock stands apart:

  • Flashbots / SUAVE

    • Focus: private mempools + off-chain transaction sequencing.
    • Limitation: requires trust in relays / builders; opaque order-flow markets.
    • GhostLock advantage: no trusted relay; instead, ciphertexts are natively encrypted on-chain and decrypted only after safe block height. No privileged actors.
  • CoW Protocol

    • Focus: batch auctions with solver competition.
    • Limitation: intents visible before clearing β†’ still exploitable; solvers can extract flow.
    • GhostLock advantage: adds Blocklock encryption + VRF randomization, so intents remain hidden until reveal, then shuffled to remove sequencing edge. GhostLock inherits batch auction fairness but eliminates pre-reveal leakage.
  • MEV-Boost / PBS

    • Focus: splitting block builders and proposers.
    • Limitation: improves validator decentralization but not user-level trade protection.
    • GhostLock advantage: user-first MEV protection, solving leakage at the transaction level.
  • Secret Network / TEEs

    • Focus: hardware-enforced secrecy.
    • Limitation: trust in hardware enclaves, supply-chain risk.
    • GhostLock advantage: cryptographic, open, and verifiable; no hardware black box.

⚠️ Limitations & Edge Cases

  • Decryption timing mismatch: If unlock block < inclusion block, could allow premature reveal. Mitigation β†’ safety margins + epoch alignment.
  • Solver centralization: Current AI call is centralized; roadmap includes solver marketplace + bond/slashing to prevent manipulation.
  • Metadata leakage: Ciphertext size/timing may leak info. Roadmap β†’ padding + dummy intents.
  • Latency vs UX tradeoff: Batch auctions add delay (~minutes). Mitigation β†’ deploy on L2 for faster block times.
  • Oracle/API dependency: Reliance on 1inch & external VRF oracles. Add fallback quoting + distributed randomness in roadmap.

πŸš€ Quick Start

Prerequisites

  • Node.js 18+ and npm

Installation

  1. Clone the repository
git clone https://github.com/your-org/ghostlock-mev-reaper.git
cd ghostlock-mev-reaper
  1. Install dependencies
# Install root dependencies
npm install

# Install server dependencies
cd server && npm install && cd ..
  1. Environment Setup
# Copy environment files
cp .env.example .env
cp server/.env.example server/.env

# Update with your configuration
# - Add your WalletConnect Project ID
# - Configure RPC URLs
# - Set contract addresses (after deployment)
  1. Start Development Servers
# Terminal 1: Start frontend
npm run dev

# Terminal 2: Start backend API
npm run server
  1. Access the Application locally
  • Frontend: http://localhost:3000
  • Backend API: http://localhost:4800
  • Health Check: Preview
  • Peak the server here πŸ‘€: Preview

πŸ“‹ Smart Contract Deployment

Deployed Smart Contracts on BaseSepolia Network:

πŸ“– API Documentation

Endpoints

Auctions

  • GET /api/auctions - List all auctions
  • GET /api/auctions/:id - Get specific auction
  • GET /api/auctions/stats - Get auction statistics

Markets[ZEROMEV API]

  • GET /api/markets - List all markets
  • GET /api/markets/:id - Get specific market
  • GET /api/markets/stats - Get market statistics

Future Roadmap

  • On-chain verified randomness Intefrations β†’ Calling the Drand( VRF) verification baked directly into EpochRNG contracts, so ordering proofs are trustless.
  • Liveness guarantees β†’ Bond + slashing for missed reveals, fallback threshold revealers, and permissionless settlement calls so no one can grief the auction.
  • Privacy hardening β†’ Add ciphertext(intent) padding, dummy intents, and batch-only publication so metadata leakage doesn’t kill the whole β€œencrypted” vibe.

🀝 Contributing

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

Acknowledgments

Happy building! πŸ˜„πŸ˜Š

About

Encrypt. Randomize. Equalize :: A stealth shield against MEV, encrypting trades and settling them fair

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •