A privacy-preserving DeFi lending protocol built on Midnight Network that enables private lending and borrowing while maintaining user anonymity through zero-knowledge proofs.
Strix is a decentralized lending protocol with privacy-first design that bridges traditional DeFi transparency requirements with user privacy needs. Built on Midnight Network's zero-knowledge capabilities, Strix enables users to access lending services without compromising their financial privacy.
- Private Identity System (zkID): Privacy-preserving identity tokens with selective revelation
- Customizable Liquidity Pools: Private lending/borrowing with interest earning capabilities
- Privacy-Preserving Transactions: All operations maintain user anonymity through zk-proofs
- Debt Auction Mechanism: Failed repayments trigger debt auctions with controlled identity disclosure
- Modern Development Stack:
- Midnight Network for zero-knowledge blockchain infrastructure
- Bun as the JavaScript runtime and package manager
- Hono as the backend framework
- React for the frontend UI
- Turbo for monorepo build orchestration and caching
.
βββ contracts/ # Midnight Network smart contracts (Compact language)
β βββ src/
β β βββ TestToken.compact # ERC-20-like token contract
β β βββ LiquidityPool.compact # Lending/borrowing pool contract
β β βββ zkID.compact # Privacy-preserving identity contract
β βββ managed/ # Compiled contract artifacts
βββ cli/ # Command-line interface for contract interaction
β βββ src/
β β βββ testtoken-api.ts # TestToken contract API
β β βββ liquidity-pool-api.ts # LiquidityPool contract API
β β βββ initialize-tokens-and-pools.ts # Deployment scripts
β β βββ query-contract-state.ts # Contract state querying
β βββ standalone.yml # Docker configuration for Midnight Network
βββ client/ # React frontend (UI mockups)
βββ server/ # Hono backend API
βββ shared/ # Shared TypeScript definitions
βββ turbo.json # Turbo configuration for build orchestration
Strix implements three core smart contracts using Midnight Network's Compact language:
Basic ERC-20-like functionality with privacy features:
- Mint, burn, and faucet operations
- Private balance tracking
- Owner-based access control
Comprehensive lending/borrowing system:
- Liquidity provision and withdrawal
- Collateral staking and borrowing
- Health factor calculations and liquidation
- Interest rate management
- Reward distribution
Privacy-preserving identity management:
- KYC verification without revealing personal data
- Credit score tracking
- Selective identity revelation during liquidation
- Authorized issuer management
The command-line interface provides comprehensive contract management:
cli/
βββ src/
β βββ testtoken-api.ts # TestToken contract interactions
β βββ liquidity-pool-api.ts # LiquidityPool contract interactions
β βββ initialize-tokens-and-pools.ts # Deployment automation
β βββ query-contract-state.ts # Contract state inspection
βββ standalone.yml # Docker configuration
The React frontend provides a modern web interface for interacting with Strix:
client/
βββ src/
β βββ components/
β β βββ supply-market.tsx # Supply market interface
β β βββ borrow-market.tsx # Borrow market interface
β β βββ core-asset-table.tsx # Asset listing
β β βββ ui/ # Reusable UI components
β βββ routes/
β β βββ index.tsx # Main dashboard
β β βββ portfolio/ # User portfolio
β β βββ transactions/ # Transaction history
β βββ lib/
β βββ token-api.ts # Frontend API integration
Note: The frontend currently contains UI mockups and is not yet connected to the CLI backend. Integration is planned for future development.
- Bun: Version 1.2.4+ (package manager and runtime)
- Docker & Docker Compose: For running Midnight Network standalone environment
- Midnight Compact Compiler: For smart contract compilation
- Install Dependencies
bun install- Start Midnight Network Environment
cd cli
docker compose -f standalone.yml up -d- Compile Smart Contracts
cd contracts
bun run compact- Deploy Tokens and Liquidity Pools
cd cli
bun run src/initialize-tokens-and-pools.ts- Interact with Contracts
# Deploy new token
bun run src/simple-standalone-testtoken.ts
# Query contract states
bun run src/query-contract-state.ts
# List all tokens
bun run src/list-test-tokens.ts# Run all services in development mode
bun run dev
# Build all packages
bun run build
# Lint code
bun run lint
# Type check
bun run type-checkStrix implements a privacy-preserving DeFi protocol with the following key components:
- Default Privacy: All transactions and balances are private by default
- Selective Revelation: Identity is only revealed during liquidation events
- Zero-Knowledge Proofs: Verify financial positions without revealing amounts
- Controlled Disclosure: Authorized entities can access specific information when needed
- Token Deployment: Deploy TestToken contracts with private balances
- Pool Creation: Create LiquidityPool contracts linked to tokens
- Identity Issuance: Issue zkID tokens for KYC verification
- Lending Operations: Provide liquidity and earn interest privately
- Borrowing Operations: Stake collateral and borrow with private amounts
- Liquidation Process: Reveal identity only to debt collectors during default
β
Smart Contracts: TestToken, LiquidityPool, and zkID contracts
β
CLI Interface: Comprehensive command-line tools for contract interaction
β
Contract Deployment: Automated token and pool initialization
β
State Querying: Contract state inspection and transaction history
β
Privacy Protection: Zero-knowledge proof integration
π§ Frontend Integration: Web interface (in development)
π§ Multi-Asset Support: Cross-asset collateralization (planned)
- Running Guide - Detailed setup and usage instructions
- Token Pool Initialization - Contract deployment guide
- Query Tokens - Contract state querying documentation
- Midnight Network Documentation
- Compact Language Reference
- Zero-Knowledge Proofs Guide
- Bun Documentation
- Hono Documentation
MIT License - see LICENSE for details.