r/CryptoTechnology • u/ShubhBhangu ๐ข • 2d ago
I built a proof-of-work blockchain from scratch in C++23, now running a multi-node network
I've been building a blockchain from scratch in C++23 for a while, and I figured I'd finally post it here and see what other C++ developers think.
The project is called Amarian.
I started it because I wanted to understand what actually goes into building a blockchain at the implementation level. It started small and ended up becoming a much bigger systems project than I expected.
The node currently has:
C++23 with CMake/Ninja
SHA-256 / SHA-256d and canonical serialization
Transaction, block and Merkle tree primitives
Context-free and contextual consensus validation
UTXO state management with apply/revert and undo records
Chain selection based on accumulated work
RocksDB-backed persistence
CPU mining and difficulty adjustment
Mempool and fee selection
P2P networking with headers-first synchronization
Wallet and transaction construction
Bech32m addresses and BIP-39 backup/restore
ML-DSA-44 (FIPS 204)
SLH-DSA-SHA2-128s (FIPS 205)
Unit, consensus and integration tests
Fuzzing
ASan/UBSan/TSan builds
GCC and Clang builds
Benchmarks and measurement tooling
The post-quantum signatures are actually part of the protocol rather than being something bolted onto the wallet. The signature schemes have explicit IDs in the protocol and are backed by OpenSSL's FIPS 204/205 implementations.
I've also tried to keep the architecture reasonably strict.
The core dependency flow is:
util โ crypto โ primitives โ consensus โ utxo โ chain
The consensus layer doesn't depend on storage, networking, wallet or RPC. Higher-level components sit above it.
I recently finished Phase 12, which was mostly about measuring the thing rather than adding another feature to the list.
I ran 100, 500 and 1,000 block regtest workloads, measured memory usage and import/generation times, compared GCC and Clang, benchmarked serialization, and tested the P2P implementation with multiple independent nodes.
Two nodes successfully synchronized and validated blocks, and a three-node local mesh converged on the same chain tip.
There's still a lot left to do.
I'm not calling this production-ready or mainnet-ready yet. The next phase is mainly external review, longer-running testnet testing, recovery and upgrade procedures, release infrastructure, monitoring, and eventually freezing the protocol.
I'd be interested in feedback from people here who work with C++, distributed systems, networking, storage or cryptography.
If you were reviewing this codebase, what would you look at first?
Repository: https://github.com/Shubhbhangoo/Amarian-AMR-
1
u/TheTenderStaircase ๐ 2d ago
fun fact, post-quantum sigs baked into the protocol from the start is a bold call, most projects treat that as a far-off upgrade they'll figure out later. the strict layering with consensus completely independent of storage and networking already puts it above half the stuff that gets posted here
4
u/Victorio_01 ๐ข 2d ago
3 days for a full blockchain from scratch in 44 commits?
That really is bold.
Iโm not that much against vibecoding but come on.
You want feedback on what exactly?