How mrmalinka/cc-cryptocoin works
Project type and purpose
• This is a peer‑to‑peer, decentralized cryptocurrency implementation running inside Minecraft’s ComputerCraft (CC: Tweaked).
• It is _not_ a blockchain; instead it relies on periodic _ledger broadcast_ and a “popularity” consensus mechanism.
• Key use case: each CC computer (a “node”) syncs a shared transaction history (ledger), verifies and signs transactions, and stores the ledger and wallet on a floppy disk.
File structure
• Top level
• startup.lua – entry point
• TODO.md, README.md, etc. for docs
• src/
• node.lua – core P2P node logic (network, ledger sync, transaction handling)
• wallets.lua – wallet generation, address encoding, signing/verification
• popularity.lua – consensus algorithm (vote counting, distance penalty)
• random.lua – random number generation utility
• ccryptolib/ – pure‑Lua crypto library
– blake3.lua, chacha20.lua, ed25519.lua (public API)
– internal/ – ECC arithmetic, field ops, packing, SHA‑512, util
README for additional insights
• Hardware: one ender modem + one disk drive per node
• “startup.lua genesis” to bootstrap first node, “startup.lua wallet” to display address
• Nodes broadcast the ledger periodically; newcomers pick the most popular copy
• No balance file stored; balances computed on‑the‑fly from transaction history
Elements
• Clear labels:
• Node Hardware (Modem, Disk)
• Node Software Modules (Startup, Core, Wallet, Consensus, Crypto)
• Local Storage (wallet.dat, ledger.dat)
• P2P Network
• External Pastebin Service
• Transaction broadcast → network → other nodes
• Ledger broadcast/retrieval → network → other nodes
• Crypto Library calls within Node Core / Wallet Module