Proof of Work: Bytes to Predicate

Course format: unsigned 24-bit mantissa, raw digest interpreted big-endian. This is a teaching model, not Bitcoin consensus validation.

1 / 6

Decode by shifting

0x04123456 → 0x123456 << 8 → 0x12345600

0x02123456 → 0x123456 >> 8 → 0x1234

Use arbitrary-precision integers; right shifts truncate.

2 / 6

Canonical does not mean lossless

0x80 → 0x02008000 after high-bit normalization.

0x12345678 → 0x04123456 → 0x12345600 loses low bits.

3 / 6

Header bytes

4 version + 32 previous hash + 32 Merkle root + 4 time + 4 bits + 4 nonce = 80. Integers are little-endian; supplied hash arrays are copied unchanged. Double SHA-256 consumes raw bytes, not hex text.

4 / 6

Search boundaries

Accept H <= T. Scan 0 through maxNonce, inclusive. Test the endpoint and stop before uint32 wraparound. A failed search says nothing about nonces outside its range.

5 / 6

Predict

Decode 0x020abcde. Encode target 0x8000. How many attempts does a failing search through nonce 4 perform?

6 / 6
←/→ or click edges to navigate · ? help · N notes · F fullscreen