From 51d617e70f90a972185917ea0096c1ecef2bfa8b Mon Sep 17 00:00:00 2001 From: Bitflash-sh Date: Fri, 24 Jul 2026 11:18:11 -0300 Subject: Bitflash: fair-launch release Satoshi's bitcoin-0.1.0 reborn with RandomX CPU proof of work, anonymous .btf addressing over Nostr with CGNAT rendezvous, automatic peer discovery, a headless Linux node, and Windows GUI wallet. Fair launch, no premine, 21M cap. --- src/randomx_pow.h | 44 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 src/randomx_pow.h (limited to 'src/randomx_pow.h') diff --git a/src/randomx_pow.h b/src/randomx_pow.h new file mode 100644 index 0000000..0027571 --- /dev/null +++ b/src/randomx_pow.h @@ -0,0 +1,44 @@ +// Copyright (c) 2026 Bitflash developers +// Distributed under the MIT/X11 software license. +// +// Memory-hard Proof of Work (CPU + RAM) via RandomX -- replaces SHA-256d as +// the PoW algorithm. The block IDENTITY hash stays SHA-256d (GetHash), +// preserving all indexing; what changes is the PROOF-OF-WORK hash +// (GetPoWHash), computed with RandomX. +// +// Modes: +// - Verification (all nodes): 256 MB cache, "light" VM. Cheap. +// - Mining (optional, fast): ~2 GB dataset, "full" VMs. Fast. +// GPUs and ASICs are neutralized by RandomX's memory cost/latency. + +#ifndef BITFLASH_RANDOMX_POW_H +#define BITFLASH_RANDOMX_POW_H + +// uint256 comes from uint256.h, already included by headers.h before this file. + +// Initialize the cache (256 MB) and the verification VM. Call once at startup. +// Returns false if allocation fails. +bool RandomXInit(); + +// Allocate and initialize the ~2 GB dataset for fast mining (fast mode), +// using nThreads to speed it up. Idempotent. Returns false on failure (the +// miner then falls back to light mode automatically). +bool RandomXInitDataset(int nThreads); + +// PoW hash of an 80-byte header, using the verification VM (thread-safe, +// guarded by a critical section). +uint256 RandomXPoWHash(const void* pHeader, size_t nSize); + +// Create a VM for a mining thread (own VM, not shared). Uses the dataset +// (fast) if available, otherwise the cache (light). Release with +// RandomXDestroyMinerVM. Returns NULL on failure. +void* RandomXCreateMinerVM(); +void RandomXDestroyMinerVM(void* vm); + +// Compute a PoW hash on an owned mining VM (not guarded). +uint256 RandomXHashWithVM(void* vm, const void* pHeader, size_t nSize); + +// True when the 2 GB dataset is ready (fast mode active). +bool RandomXFastReady(); + +#endif -- cgit v1.2.3