PoW Reference Verifier

A standalone Python script that verifies the double BLAKE3-256 PoW algorithm against published test vectors. Requires no running node and no build — just Python and the official blake3 binding.

Script: verify-blake3-pow.py Runtime: ~1 second Status: PASS

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

OS
Linux, macOS, or WSL2
Python
3.10+
Dependency
pip3 install blake3

3. 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.blake2b by mistake — b3chain uses BLAKE3, a different (faster, parallel) algorithm. The blake3 Python 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