Low-Latency Order Book
A limit-order-book matching engine in C++ with lock-free queues and nanosecond-scale microbenchmarks.
Koustav Manna
Thread 03 — Others
The rest of the stack I care about — scalable system design, low-latency trading systems, and Ethereum smart contracts. The hard, performance-critical corners.
Designing systems that scale — partitioning, caching, and the consistency trade-offs behind them.
Trading systems where microseconds matter — from the order book down to cache lines.
Smart contracts and DeFi protocols on Ethereum and EVM-compatible chains.
Gas-optimized Solidity.
1// SPDX-License-Identifier: MIT2pragma solidity ^0.8.20;3 4import "@openzeppelin/contracts/token/ERC20/IERC20.sol";5import "@openzeppelin/contracts/security/ReentrancyGuard.sol";6import "@openzeppelin/contracts/access/Ownable.sol";7 8/// @title SimpleStaking - stake tokens, earn rewards9contract SimpleStaking is ReentrancyGuard, Ownable {10 IERC20 public immutable stakingToken;11 uint256 public rewardRate = 100; // per block12 13 mapping(address => uint256) public stakedBalance;14 mapping(address => uint256) public lastClaimBlock;15 16 event Staked(address indexed user, uint256 amount);17 18 constructor(address _token) Ownable(msg.sender) {19 stakingToken = IERC20(_token);20 }21 22 function stake(uint256 amount) external nonReentrant {23 require(amount > 0, "Amount must be > 0");24 _claimRewards();25 stakingToken.transferFrom(msg.sender, address(this), amount);26 stakedBalance[msg.sender] += amount;27 emit Staked(msg.sender, amount);28 }29 30 function pendingRewards(address user) public view returns (uint256) {31 uint256 blocks = block.number - lastClaimBlock[user];32 return (stakedBalance[user] * rewardRate * blocks) / 1e18;33 }34}A limit-order-book matching engine in C++ with lock-free queues and nanosecond-scale microbenchmarks.
Sharded token-bucket rate limiter on Redis with sliding windows and graceful degradation under load.
Real-time market-data ingestion over WebSockets with normalization and a replayable event log.
Sharding, replication, consensus, CAP trade-offs.
Lock-free structures, cache-aware code, kernel bypass.
Gas-optimized, reentrancy-safe Solidity with fuzz tests.
Metrics, tracing, and SLOs with Prometheus + Grafana.