An L2 optimistic rollup order book DEX built on Solen. Trades STT/SOLEN with a central limit order book (CLOB), settling batch commitments to the Solen L1 blockchain.
Live demo: solendex.io
┌─────────────────────────────────────────────────┐
│ SolenDEX L2 │
│ │
│ ┌───────────┐ ┌───────────┐ ┌─────────────┐ │
│ │ RPC API │ │ Order │ │ State │ │
│ │ + Web UI │ │ Book │ │ Machine │ │
│ └─────┬─────┘ └─────┬─────┘ └──────┬──────┘ │
│ │ │ │ │
│ ┌─────┴──────────────┴───────────────┴──────┐ │
│ │ Transaction Log (NDJSON) │ │
│ └───────────────────┬───────────────────────┘ │
│ │ │
│ ┌───────────────────┴───────────────────────┐ │
│ │ Settlement Engine │ │
│ │ (batch commitments every 30s) │ │
│ └───────────────────┬───────────────────────┘ │
│ │ │
│ ┌───────────────────┴───────────────────────┐ │
│ │ Bridge Relayer │ │
│ │ (L1 deposit detection, L1 withdrawals) │ │
│ └───────────────────┬───────────────────────┘ │
└──────────────────────┼──────────────────────────┘
│
┌────────┴────────┐
│ Solen L1 │
│ (settlement) │
└─────────────────┘
Order Book — Price-time priority matching engine supporting limit and market orders. Maker/taker fees (0.02%/0.05%).
State Machine — Deterministic L2 state with Ed25519 signature verification, nonce tracking, and blake3 state root computation. Full state can be rebuilt by replaying the transaction log from genesis.
Settlement — Batches of L2 transactions are committed to the Solen L1 every 30 seconds via the rollup bridge contract (submit_batch). Each batch includes pre/post state roots and a data hash.
Bridge — Monitors L1 for transfers to the DEX vault address. Native SOLEN and token (STT) deposits are automatically credited on L2. Withdrawals are queued and settled in the next L1 batch.
Fraud Proofs — Anyone can run the built-in challenger to replay all batches and verify the sequencer's state commitments are correct.
# Build
cargo build --release
# Run the sequencer
./target/release/solendex \
--port 8800 \
--l1-rpc https://testnet-rpc3.solenchain.io \
--sequencer-seed <hex-seed>
# Open the trading UI
open http://localhost:8800| Flag | Default | Description |
|---|---|---|
--port |
8800 |
L2 RPC listen port |
--l1-rpc |
https://testnet-rpc3.solenchain.io |
Solen L1 RPC endpoint |
--rollup-id |
1 |
Rollup ID on L1 |
--settle-interval |
30 |
Batch settlement interval (seconds) |
--data-dir |
data |
Directory for state and transaction log |
--sequencer-seed |
— | Sequencer Ed25519 seed (hex, 64 chars) |
--verify |
— | Run as fraud proof challenger instead of sequencer |
--l2-rpc |
http://localhost:8800 |
L2 RPC to verify against (with --verify) |
| Variable | Description |
|---|---|
SOLENDEX_BRIDGE_SECRET |
Secret for bridge deposit authorization. Auto-generated if not set. |
RUST_LOG |
Log level filter (default: info) |
Anyone can verify the sequencer is honest:
./target/release/solendex --verify --l2-rpc http://localhost:8800This replays every transaction from genesis, recomputes state roots after each batch, and compares them against the sequencer's L1 commitments. Exits with code 1 if any mismatch is found.
See API.md for full JSON-RPC documentation.
| Method | Description |
|---|---|
dex_getOrderBook |
Current order book depth |
dex_getAccount |
Account balances and open orders |
dex_getTrades |
Recent trade history |
dex_submitOrder |
Place a limit or market order (requires signature) |
dex_cancelOrder |
Cancel an open order (requires signature) |
dex_withdraw |
Request withdrawal to L1 (requires signature) |
dex_getMarkets |
Available trading pairs and fee info |
dex_getBatches |
Settlement batch history |
WebSocket: Connect to ws://host:port/ws for live order book, trade, and stats updates.
- Call
dex_getSigningPayloadwith account and action - Sign the payload with the Solen Browser Extension (
window.solen.signMessage) - Submit the transaction with the signature
src/
main.rs Entry point, CLI, startup
orderbook.rs CLOB matching engine
state.rs L2 state machine, signature verification, fees
rpc.rs JSON-RPC API + embedded web frontend
txlog.rs Append-only transaction log (NDJSON)
settlement.rs Batch commitment generation
l1_submitter.rs L1 settlement loop
bridge.rs L1 deposit detection + withdrawal processing
challenger.rs Fraud proof verification
ws.rs WebSocket live updates
web/
index.html Trading UI
app.js Frontend logic
style.css Dark exchange theme
SolenDEX uses the Solen Browser Extension for wallet connectivity. The extension provides:
- Account connection via
window.solen.connect() - L2 transaction signing via
window.solen.signMessage(payload) - L1 deposit transactions via
window.solen.signAndSubmit(params)
MIT