Anyone know the least amount of code needed for a working crypto with blockchain? I saw this thing with 5000 lines but I wonder if we could make it under 1000 lines if we use other libraries for P2P and cryptography.
By "minimal functionality," I mean you need to have:
- A working blockchain
- Mint new coins
- Validate blocks
- Create accounts and check balances
- Transfer coins
- Adjust difficulty level (just increase a counter every x blocks)
Did I miss anything important?
How Few Lines of Code for a Functional Crypto?
4 replies 113 views
Came across a Virel blockchain prototype, only 11k lines and it even has tests! So cutting down to 1000 lines honestly seems possible if you simplify things a bit. Got a link for reference too!
Yeah, I found this Python version, it's about 2500 lines. Might not be under 1000, but it's definitely on the shorter side. Check it out if you want to see how they did it.
Under 1k lines is totally doable for something basic, especially if you rely on libraries. Just think linear PoW, UTXO model, single-sig, no complex scripting, and you could fit it in around 700-1200 lines in Python or Go. My gut feeling says it's feasible.
Also found this project called Cruzbit, written in Go. It's around 11k lines but doesn't even include the wallet or client. The network's still running though.