1. Overview
Block identity hashes (block hash, txid, merkle tree) on b3chain still use double SHA-256, identical to Bitcoin Core. The proof-of-work hash is the only consensus-critical hash that differs — it is double BLAKE3-256:
PoW_hash = BLAKE3( BLAKE3( serialize(block_header) ) ) where the 80-byte header serialisation is: nVersion (4 bytes, int32, little-endian) hashPrevBlock (32 bytes, uint256, little-endian) hashMerkleRoot (32 bytes, uint256, little-endian) nTime (4 bytes, uint32, little-endian) nBits (4 bytes, uint32, little-endian) nNonce (4 bytes, uint32, little-endian)
The verifier checks this exact construction against published BLAKE3 test vectors and against four pre-computed b3chain block-header vectors.
2. Prerequisites
pip3 install blake33. Run it
git clone https://github.com/b3chain/b3chain.git cd b3chain pip3 install blake3 python3 contrib/testing/verify-blake3-pow.py
4. Expected output
BLAKE3 single-hash test vectors: PASS empty input PASS "abc" PASS 64-byte chunk boundary Double BLAKE3-256 vectors: PASS empty input PASS "Bitcoin" Block-header PoW vectors: PASS height 0 genesis PASS height 1 PASS height 100 PASS height 1000 Verifier: ALL PASS
5. With a live node (optional)
python3 contrib/testing/verify-blake3-pow.py --rpc-port=18545
Connects to a running b3chain regtest / testnet node, fetches the most recent N blocks, recomputes the PoW hash for each header in pure Python, and compares against the value the node reports.
6. Common pitfalls
- Using
hashlib.blake2bby mistake — b3chain uses BLAKE3, a different (faster, parallel) algorithm. Theblake3Python package is the official binding. - Forgetting little-endian byte order for header fields. The verifier prints the bytes it serialised so you can diff them against your own.
- Using single BLAKE3 instead of double. The script tests both, so the failure mode is loud.
7. Source links
- Verifier: contrib/testing/verify-blake3-pow.py
- C++ implementation: src/primitives/block.cpp::CBlockHeader::GetPoWHash
- BLAKE3 spec: BLAKE3 specs repository
- PoW design notes: doc/b3chain-pow-design.md