PQGrind Docs

Valid mint

Candidates

A confirmed, non-coinbase transaction tx in a block at height h is a candidate iff

  • (a) the transaction carries a claim: under Format B, PARSE_CLAIM_B(tx) is not none (the first output beginning 6a 5d decodes cleanly and contains tag 127); under Format A, some output script begins with 6a 0b 50 51 53 42; and
  • (b) the output spent by tx.vin[0] is P2WSH (00 20 ‖ 32 bytes).

Non-candidates are not recorded. Candidates are recorded either as a mint or as a rejection with a code.

Conditions

Let D = D(h) be the block's difficulty (Difficulty). A candidate is a valid mint iff all of the following hold. They are evaluated in this order; the first failure gives the rejection code (Error codes).

# Condition Code on failure
1 h ≥ H_start (blocks below are skipped entirely) —
2 witness has ≥ 3 items and SHA256(witness[last]) equals the 32-byte program of the spent output E02
3 witness[last] equals the lock template at some level β ∈ {80, 88}, β ≥ β_min(D) E03
4 witness shape (below) E04
5 PARSE_CLAIM(tx) (format of the frozen rule) returns op = mint (Format A: and ticker "PQSB") E05
6 target index is 0, tx.vout[0] exists and is not OP_RETURN E06
7 Draft C: int(txid) < 16^(64 − zeros(h)), i.e. at least zeros(h) leading hex zeros (earlier drafts: score_fp(β, txid) ≥ ONE · D) E07
8 value of the output spent by tx.vin[0] ≥ R E08
9 valid mints so far (earlier blocks plus earlier in this block) < M_max E09

Level search for 3–4: try β = β_min(D), β_min(D)+8, … ≤ 88; use the first β at which both 3 and 4 pass. If none passes, report the code from the lowest level tried.

Witness shape (condition 4)

With h = 9 positions and c = 4 pins the witness has 2 + 5h + c = 51 items:

index   content                       check
0       owner signature               non-empty, last byte 0x01
1..45   positions 8 … 4 (5 items),    per position:
        then 3 … 0 (6 items)            T: strict DER, r = x(½G), hash type 0x01, len = D_ℓ
        [tag], T, A, Σ, B, j            Σ: strict DER, r = x(½G), hash type 0x01
                                        A, B: 33 bytes;  j: ≤ 1 byte;  tag: 32 bytes
50      witness script                (conditions 2–3)

x(½G) = 3b78ce563f89a0ed9414f5aa28ad0d96d6795f9c63 (21 bytes, the short r value used by the construction).

Strict DER here means: 30 L 02 rl r 02 sl s ht with L = len − 3, rl, sl > 0, and the lengths consistent; no other padding check is made.

Same-block ordering

Mints in one block are counted in block order (pos(tx)). This matters only for condition 9 and for the schedule boundary on Constants and difficulty.

Effects

  • Valid: mints ← mints + 1; R units are added at offset 0 of input 0, then State transition runs.
  • Rejected: no units are created; marked satoshis on the inputs (if any) still move under State transition.