ChainBook: Design and Evaluation of an On-Chain Order-Book DEX
摘要
Centralized exchanges (CEXs) dominate cryptocurrency trading but introduce critical custody risks and execution opacity, while Automated Market Makers (AMMs) suffer from impermanent loss and limited order expressiveness. To bridge this gap, we present ChainBook, a decentralized exchange (DEX) featuring a fully on-chain Central Limit Order Book (CLOB) and non-custodial settlement. Unlike hybrid models that rely on off-chain relayers, ChainBook executes all matching logic deterministically on-chain using gas-optimized array-based data structures. Experimental evaluations on an Ethereum-compatible environment demonstrate that the matching engine scales sub-linearly ( \(O(N^{0.52})\) ) with order book depth. A standard taker trade consumes approximately 414,000 gas ( \({\approx }2.6{\times }\) a Uniswap V3 swap), rendering the system cost-prohibitive for Layer-1 but highly practical for near real-time trading on modern Layer-2 rollups. These results confirm that ChainBook restores the precision of traditional limit orders without sacrificing the trust-minimization guarantees of DeFi.