-
Notifications
You must be signed in to change notification settings - Fork 0
Test Mode Verification
MacMetal CLI includes a built-in test mode that mathematically proves correct SHA256d computation.
./MacMetalCLI --testComputes the hash of Bitcoin Block #125552 using CPU and verifies against the known hash.
Block 125552 Details:
- Mined: May 21, 2011
- Nonce: 1,118,806,677
- Hash:
00000000000000001e8d6829a8a21adc5d38d0a473b144b6765798e61f98bd1d
This block is commonly used for testing Bitcoin implementations because:
- Well-documented
- Has many leading zeros (67 bits)
- Verifiable on any block explorer
Uses the GPU to search for the winning nonce of Block #125552.
The test:
- Takes the block header (without nonce)
- Searches nonces around the known winning value
- Verifies the GPU finds the exact correct nonce
- Confirms the resulting hash matches
If the GPU finds the correct nonce, it proves:
- GPU SHA256d implementation is correct
- Buffer handling is correct
- Result parsing is correct
- The miner would correctly identify real Bitcoin blocks
Runs three batches of 16 million hashes each:
- Measures time for each batch
- Calculates hashes per second
- Reports average hashrate
╔══════════════════════════════════════════════════════════════════════════╗
║ MacMetal CLI Miner v2.1 - TEST MODE ║
║ SHA256d Verification Suite ║
╚══════════════════════════════════════════════════════════════════════════╝
[TEST] Initializing Metal GPU...
[TEST] ✓ GPU: Apple M3 Pro
[TEST 1] Bitcoin Block #125552 Header Hash
─────────────────────────────────────────────────────────────────────────
Header: 0100000081cd02ab7e569e8bcd9317e2fe99f2de...
Expected: 00000000000000001e8d6829a8a21adc5d38d0a473b144b6765798e61f98bd1d
CPU Hash: 00000000000000001e8d6829a8a21adc5d38d0a473b144b6765798e61f98bd1d
[PASS] ✓ CPU SHA256d correct
[TEST 2] GPU Mining - Find Known Nonce
─────────────────────────────────────────────────────────────────────────
Searching for nonce around: 2504433986
Target: 32+ zero bits (difficulty 1)
Hashes computed: 16777216
Time: 0.048 seconds
Hashrate: 349.52 MH/s
Results found: 1
→ Nonce: 0x9546a142 (2504433986) - 67 bits
[PASS] ✓ GPU found correct nonce!
Verified hash: 00000000000000001e8d6829a8a21adc5d38d0a473b144b6765798e61f98bd1d
[TEST 3] GPU Hashrate Benchmark
─────────────────────────────────────────────────────────────────────────
Running 3 batches of 16M hashes each...
Batch 1: 16777216 hashes in 0.047s = 357.07 MH/s
Batch 2: 16777216 hashes in 0.048s = 349.52 MH/s
Batch 3: 16777216 hashes in 0.048s = 349.52 MH/s
─────────────────────────────────
Average: 352.04 MH/s
[PASS] ✓ GPU hashrate > 100 MH/s
═══════════════════════════════════════════════════════════════════════════
TEST RESULTS
═══════════════════════════════════════════════════════════════════════════
Passed: 3
Failed: 0
╔═══════════════════════════════════════════════════════════════════╗
║ ✅ ALL TESTS PASSED - GPU MINER VERIFIED WORKING ║
╚═══════════════════════════════════════════════════════════════════╝
Your GPU is computing correct Bitcoin SHA256d hashes.
The miner is ready for production use.
The basic SHA256d algorithm is implemented correctly. This is the foundation.
This is the smoking gun. The GPU searched through millions of hashes and found the exact nonce (2,504,433,986) that produces Block #125552's hash.
The hash produced:
00000000000000001e8d6829a8a21adc5d38d0a473b144b6765798e61f98bd1d
This has 67 leading zero bits - matching the real Bitcoin block from 2011.
Performance is acceptable for Apple Silicon.
- Block #125552 is real - You can verify it on any block explorer
- The nonce is unique - Only one nonce produces this hash
- The hash is cryptographically secure - Can't be faked
- If GPU finds it, SHA256d is correct - QED
The basic hash function is broken. This shouldn't happen - report as a bug.
- GPU may not be working correctly
- Buffer sizes may be wrong
- Shader compilation may have failed
Try rebuilding:
./build.sh
./MacMetalCLI --test- Mac may be thermal throttling
- Running on battery
- Other GPU workloads active
This is a warning, not a failure.
Version: 01000000
Prev Block: 81cd02ab7e569e8bcd9317e2fe99f2de44d49ab2b8851ba4a308000000000000
Merkle Root: e320b6c2fffc8d750423db8b1eb942ae710e951ed797f7affc8892b0f1fc122b
Timestamp: c7f5d74d (2011-05-21 17:26:31 UTC)
Bits: f2b9441a
Nonce: 42a14695 (little-endian) = 0x9546a142 (big-endian) = 2,504,433,986
The nonce 1118806677 appears as 42a14695 in the block header (little-endian).
When read as big-endian for computation: 0x9546a142 = 2504433986