Pipelined BFT Settlement Engine
Full architecture specification for a production-grade distributed settlement engine: pipelined BFT consensus, QUIC persistent peer mesh, dynamic transaction batching, parallel deterministic execution, and lock-free metrics. Designed for 1k–10k+ TPS with sub-2s finality.
- ✗REST/HTTP per-transaction call
- ✗JSON serialization in hot paths
- ✗Blocking I/O anywhere
- ✗One transaction per block
- ✗Waiting for full consensus before next round
- ✗Heavy logging in data path
- ✗f32/f64 in state transitions
- ✗Synchronous peer loops
- ✓Persistent QUIC connections
- ✓bincode binary serialization
- ✓Tokio full-async everywhere
- ✓100–500 tx per batch (dynamic)
- ✓Pipelined rounds (N, N+1, N+2 concurrent)
- ✓Parallel execution via rayon
- ✓Fixed-point arithmetic in state
- ✓Lock-free atomic metrics
Persistent peer mesh, binary framing, parallel broadcast, QUIC streams. Zero kernel overhead per message.
Dynamic time+size transaction batcher. 100ms window / 500tx max. Non-blocking channel to consensus.
Pipelined 3-phase BFT. Multiple rounds concurrent. Rotating leader. BLS aggregate signatures.
Parallel deterministic execution. Partitioned by sender for independence. Fixed-point only. Non-blocking vs consensus.
State database with atomic delta application, Merkle root per block, snapshot support.
Lock-free atomic TPS counter, nanosecond-resolution latency histogram, per-stage timing.
hcp-node/ (Cargo workspace)
├── crates/hcp-net/ ← QUIC peer mesh
├── crates/hcp-batcher/ ← tx batching
├── crates/hcp-consensus/ ← pipelined BFT
├── crates/hcp-exec/ ← parallel execution
├── crates/hcp-state/ ← RocksDB state
├── crates/hcp-metrics/ ← TPS + latency
└── bin/hcp-node/ ← validator binary
Transaction, Block, and all ConsensusMsg variants use bincode v2 with fixed-size arrays. No heap allocation for signature or hash fields. Zero-copy decode from QUIC stream buffers.
The batcher sits between the client ingest layer and the consensus pipeline. It aggregates transactions using tokio::select! — no busy polling. Flush is triggered by whichever fires first: the time ticker or the size cap.
| Time → | Round N | Round N+1 | Round N+2 | Round N+3 |
|---|---|---|---|---|
| t=0ms | Proposal | — | — | — |
| t=50ms | PreVote | Proposal | — | — |
| t=100ms | Vote | PreVote | Proposal | — |
| t=150ms | Commit ✓ | Vote | PreVote | Proposal |
| t=200ms | Finalized | Commit ✓ | Vote | PreVote |
~12 bytes
Message overhead
vs ~200 bytes HTTP/JSON
<1ms
Broadcast latency
4-node parallel join_all
Once at startup
Connection setup
then persistent forever
Execution is decoupled from consensus. Finalized blocks are pushed to an async execution channel. Transactions are partitioned by sender (no cross-sender dependency) and executed in parallel with rayon. State delta is applied atomically. Fixed-point arithmetic only — no f32/f64 in state transitions.
End-to-End Message Flow
| # | From | To | Message | Latency |
|---|---|---|---|---|
| 1 | Client | Any Node | Transaction (binary, Ed25519 signed) | <1ms |
| 2 | Batcher | Consensus | Vec<Transaction> batch (100–500 tx) | 0–100ms window |
| 3 | Leader | All Peers | Proposal { Block, round } | <1ms (parallel broadcast) |
| 4 | Each Node | All Peers | PreVote { block_id, sig } | <1ms |
| 5 | Each Node | All Peers | Vote { block_id, sig } (after 2f+1 PreVotes) | <1ms |
| 6 | Each Node | All Peers | Commit { block_id, sig } (after 2f+1 Votes) | <1ms |
| 7 | Executor | StateDB | Block finalized → parallel tx execution | 1–10ms |
| 8 | StateDB | Client | Receipt { block_id, tx_results, merkle_root } | <1ms |
Performance Targets
| Configuration | TPS | Finality | Block Time |
|---|---|---|---|
| 4-node multi-region baseline | 1,000–2,000 | 800ms–1.5s | 200ms |
| 4-node same-region optimized | 5,000–10,000 | <300ms | 100ms |
| 10-node same-region | 15,000–25,000 | <400ms | 100ms |
| FPGA MCF + DPDK (Phase 3) | 100,000+ | <80ms | 30ms |
Core Rust Dependencies
Async runtime + channels + timers
QUIC transport — persistent peer connections
Binary serialization — zero allocation decode
BLS12-381 threshold signatures
Transaction signing + verification
State persistence + H-DAG storage
CPU-parallel transaction execution
Nanosecond latency percentiles
Zero-copy payload buffers
Metrics export (Grafana dashboards)
Safety threshold: n ≥ 3f + 1 nodes. For 4 nodes: f=1 (tolerates 1 Byzantine node). For 7 nodes: f=2.
Liveness: Rotating leader with view-change protocol if leader times out (configurable: default 500ms).
Failure simulation: Inject via hcp-metrics fault flags — node drop, artificial delay, message corruption. No production code changes required.
Quorum: Phases require 2f+1 signatures. BLS aggregate signatures keep message size O(1) regardless of committee size.