Abstract
QuantumDEX is the native decentralised exchange of the ThiChain Layer 1 blockchain — a quantum-safe, dharmic-ethics-embedded proof-of-karma blockchain. Unlike existing DEXs that treat all users identically, QuantumDEX introduces karma-adjusted trading: fees, liquidity incentives, and governance weight are dynamically computed from each participant's on-chain karma score, creating an ecosystem that rewards constructive, non-harmful behaviour.
QuantumDEX combines an automated market maker (AMM) with a perpetuals engine, a cross-chain bridge with ML-DSA-65 (NIST FIPS 204) post-quantum signatures, and governance via veQBIT vote-escrow — all governed by the Five Yamas ethical framework.
1. Background
1.1 The Problem with Existing DEXs
Current decentralised exchanges operate on purely financial logic: fees are flat, liquidity mining rewards short-term capital, and governance is dominated by large token holders. This produces:
- Mercenary liquidity — capital leaves immediately when incentives end
- Governance plutocracy — whale votes override community consensus
- Quantum vulnerability — ECDSA signatures are broken by quantum computers, threatening all existing DEX state by approximately 2030
- Ethics-blind execution — protocols cannot distinguish predatory from constructive behaviour
1.2 ThiChain as Foundation
ThiChain L1 provides three capabilities unavailable on any other chain:
- Proof of Karma consensus — validator selection weight = karma × stake, making validator behaviour consequential
- ML-DSA-65 cryptography — NIST FIPS 204 post-quantum signatures natively at the protocol layer
- Dharmic Validator precompile (0x0423) — on-chain ethical validation of contract operations against the 5 Yamas
2. Architecture
- QuantumFactory.sol — pair registry
- QuantumPair.sol — x·y=k AMM with karma fees
- QuantumRouter.sol — swap routing + slippage
- QuantumPerps.sol — perpetuals engine
- QuantumBridge.sol — cross-chain ML-DSA-65
- VotingEscrow.sol — veQBIT lock mechanism
- QuantumGovernor.sol — proposal + voting
- TimelockController.sol — 48h execution delay
- FeeDistributor.sol — protocol revenue distribution
- GaugeController.sol — liquidity gauge weights
2.1 ThiChain Integration Layer
All QuantumDEX contracts interact with ThiChain-native precompiles:
| Precompile | Address | Function |
|---|---|---|
| KarmaOracle | 0x0421 | On-chain karma score lookup per address |
| DharmicValidator | 0x0423 | 5-Yama ethical validation gate |
| ConsciousnessAI | 0x0420 | ML inference for QCS 15D scoring |
3. Karma-Adjusted AMM
3.1 Fee Model
Standard AMMs charge flat fees. QuantumDEX charges fees inversely proportional to karma score:
| Karma Tier | Score Range | Fee |
|---|---|---|
| Visitor | 0–250 | 30 BPS (0.30%) |
| Practitioner | 251–750 | 15 BPS (0.15%) |
| Guardian | 751+ | Karma-scaled toward 0 BPS |
3.2 x·y = k with Karma Modifier
The invariant is the standard constant product formula. Karma modifies the effective fee component f extracted before the invariant check, incentivising long-term positive-sum behaviour rather than pure arbitrage extraction.
3.3 TWAP Oracle
Price feeds use time-weighted average prices accumulated in QuantumPair._update(). Perpetuals mark prices are sourced from IQuantumTWAPOracle.getMarkPrice() — not spot price — to prevent oracle manipulation attacks.
4. Perpetuals Engine
QuantumPerps supports up to 20× leverage on supported pairs. Liquidations are capped at MAX_LIQUIDATION_BPS = 5000 (50% of position) to honour the Ahimsa principle — protecting counterparties from catastrophic loss.
5. Tokenomics
Protocol governance token. Lock QBIT for veQBIT to vote, earn fees, and boost liquidity mining rewards (1×–2.5× boost based on lock duration).
Thideva (ธิเทวา) is the native gas token of ThiChain L1. All QuantumDEX transactions consume THI for gas. QBIT is separate from THI.
6. Governance
Protocol upgrades, fee parameter changes, and gauge weights are controlled by veQBIT holders via QuantumGovernor.sol. All passed proposals execute through a 48-hour TimelockController — honouring the Aparigraha principle of non-hasty action.
The Six Sages Council (ThiChain-native) provides a non-binding advisory layer for proposals with significant dharmic implications.
7. Security
- 1,827+ passing tests (Hardhat + Vitest), 0 failures
- Reentrancy guards on all 8+ entry points in
QuantumRouter - ML-DSA-65 post-quantum signatures on bridge (3,309-byte signatures)
- Internal self-audit engine: 96.2/100 overall score
- External security audit: planned post-testnet (Q3 2026)
See the Security page and Bug Bounty programme for details.
8. Roadmap
| Phase | Milestone | Status |
|---|---|---|
| 0 | ThiChain L1 local testnet (3-node Docker) | COMPLETE |
| 1 | Public testnet — Hetzner VPS, DNS, Blockscout | IN PROGRESS |
| 2 | QuantumDEX public testnet deployment | PLANNED |
| 3 | External security audit (bridge priority) | Q3 2026 |
| 4 | Mainnet launch + MiCA NCA filing | 2026 |
| 5 | KarmaLend + DharmicStable (ThiChain P3) | Post-mainnet |