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.