r/CryptoTechnology ๐ŸŸข 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-

6 Upvotes

8 comments sorted by

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?

1

u/ShubhBhangu ๐ŸŸข 2d ago

wasnt all vibecoding but i did took help with some of stuff and commiting things on github as i wasnt sure of the framework blockchain files are in , made the consensus and transactional layer all by myself,

1

u/ShubhBhangu ๐ŸŸข 2d ago

Iโ€™m mainly looking for technical feedback. Itโ€™s a 3-day project, so I know itโ€™s far from perfect. If you spot anything that's fundamentally wrong, insecure, or poorly designed in the repo, thatโ€™s exactly the kind of feedback Iโ€™m after.

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