Bitcoin Forum
October 21, 2025, 07:53:26 AM *
News: Pumpkin carving contest
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Cryptocurrency with minimal lines of code?  (Read 53 times)
Mikolo (OP)
Member
**
Offline Offline

Activity: 128
Merit: 10


View Profile
October 12, 2025, 11:59:28 AM
 #1

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?
Mikolo (OP)
Member
**
Offline Offline

Activity: 128
Merit: 10


View Profile
October 15, 2025, 04:20:59 PM
 #2

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.
Mikolo (OP)
Member
**
Offline Offline

Activity: 128
Merit: 10


View Profile
October 17, 2025, 07:43:38 PM
 #3

There is this, Python version is ~2500 LOC
https://github.com/zack-bitcoin/basiccoin
BattleDog
Member
**
Offline Offline

Activity: 66
Merit: 104


View Profile
October 17, 2025, 11:57:50 PM
 #4

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.

I've lately been raising skeletal dogs from the dead in my spare time
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!