Bitcoin Forum

Alternate cryptocurrencies => Altcoin Discussion => Topic started by: Mikolo on October 12, 2025, 11:59:28 AM



Title: Cryptocurrency with minimal lines of code?
Post by: Mikolo on October 12, 2025, 11:59:28 AM
I wonder: in how many lines of code is it possible to write minimally functional cryptocurrency with blockchain? This thing https://github.com/skepticoin/skepticoin have ~5000 LOC length. Is it possible to write cryptocurrency in less than 1000 LOC, assuming P2P and cryptography is offloaded to other libraries?
By minimally functional I mean:
-Can create blockchain
-Can mine new blocks with coins
-Can validate blocks
-Can create accounts and check their balance
-Can transfer coins
-Can increase difficulty(can just increment diff counter every x blocks)
I hope I didn't forget anything. Also can cryptocurrency with DAG have smaller code than the one with blockchain? How hard it is to implement DAG or other less conventional ledgers?


Title: Re: Cryptocurrency with minimal lines of code?
Post by: Mikolo on October 15, 2025, 04:20:59 PM
Found early testnet prototype of Virel block chain, only 11339 lines, and that with tests!
https://github.com/virel-project/virel-blockchain/commit/89a9a80e30c2a10b85c309cdb77026f834174f41
So 1000 lines of code seem doable.


Title: Re: Cryptocurrency with minimal lines of code?
Post by: Mikolo on October 17, 2025, 07:43:38 PM
There is this, Python version is ~2500 LOC
https://github.com/zack-bitcoin/basiccoin


Title: Re: Cryptocurrency with minimal lines of code?
Post by: BattleDog on October 17, 2025, 11:57:50 PM
Below 1k lines is totally doable for a play/test coin if you lean on libraries. Maybe you'll want to keep it a linear PoW chain, UTXO only, single-sig (ed25519/secp via a lib), no scripting, fixed block/tx format, naive mempool and longest-chain reorgs.

In Python/Go that should be around 700-1200 lines of code if my estimates are correct.


Title: Re: Cryptocurrency with minimal lines of code?
Post by: Mikolo on November 01, 2025, 07:19:29 PM
Found https://github.com/jstnryan/cruzbit
Written in Go, around 11k lines for main stuff, without wallet or client. Net is still alive.