DEV Community

ShadowRook-crypto
ShadowRook-crypto

Posted on AI-assisted

Resisting 51% attacks without a central authority: what I tried in NumFranc

I’m a young French developer building NumFranc, a cryptocurrency written in Rust (Argon2d proof of work, ML-DSA-87 signatures). I code with the help of an AI, so what I’m really looking for is human code review.

The problem. In a proof-of-work cryptocurrency, someone who controls more than half of the computing power can mine a chain in secret, then reveal it to replace the official one. This is the 51% attack. My network is small, so the risk is real.

What I refuse to do. I don’t want a central authority that signs the “right” chain. That would solve the problem, but it would no longer be a decentralized cryptocurrency.

What I put in place:

A reorganization limit: a node refuses to replace more than 10 recent blocks.
A penalty for hidden chains: a chain mined in secret and revealed late is delayed before being accepted, while honest competition is not.
Adaptive confirmations: a large payment needs 30 confirmations, a small one needs 6.
A few checkpoints in the code, which the node refuses to reorganize past.

The limits. A very powerful attacker could still try to take over, and my rules are trade-offs, not proofs. That’s why I’d love your criticism: where is the flaw?

The code is here: https://github.com/ShadowRook-crypto/NumFranc (see src/chain.rs).

Transparency: I wrote the code with help from an AI, as a way to learn how to develop software and to communicate in English. In the long term, I’d like NumFranc to become a real post-quantum payment network, built with a community. No NFR is sold and no value is promised.

Top comments (0)