PQGrind Docs

Claim output

Warning

Two formats are described. Format B (runestone) is the proposed format: a Runes-valid runestone that also carries the PQSB claim, so that Runes indexers see the transaction and a companion rune can be minted in the same transaction. Format A is what the test-network reference build implements today. Only one will be frozen; both are pending freeze.

Format B — runestone (proposed)

Why

  • Runes indexers recognise the transaction as carrying a valid runestone.
  • The same runestone can mint the companion rune ("dual mining").
  • One OP_RETURN output instead of two.

Runes rules this relies on

From the Runes documentation (https://docs.ordinals.com/runes/specification.html; the ord code is normative there):

Rule Consequence for us
The runestone is the first output whose script begins OP_RETURN OP_13 (6a 5d); later ones are ignored the claim must be in that first output
Payload = concatenated data pushes after OP_13, decoded as LEB128 integers; truncated or over-long integers make a cenotaph encode carefully
Integers are tag/value pairs; tag 0 (Body) starts edicts our fields go before any tag 0; we use no tag 0
Unrecognised odd tags are ignored; unrecognised even tags make a cenotaph our claim uses an odd tag
Tag 127 is named Nop and is "unrecognized" we use tag 127
"All unused tags are reserved … may be assigned at any time, and should not be used" residual risk: a future Runes change could give 127 a meaning
A cenotaph burns all input runes; a cenotaph mint counts against the cap and its runes are burned our indexer rejects any claim whose runestone would be a cenotaph
Minted runes go to the first non-OP_RETURN output unless a Pointer says otherwise companion runes land on output 0, the same output as the PQSB units

Layout

6a                 OP_RETURN
5d                 OP_13
<n>                one direct push of n bytes (n ≤ 75)
  7f               tag 127 (Nop)
  <LEB128 v>       claim value, see below
  [14 <LEB128 b>   tag 20 (Mint): companion rune id, block      — optional
   14 <LEB128 t>]  tag 20 (Mint): companion rune id, tx index   — optional

Claim value v: the bytes below read as a little-endian integer (trailing zero bytes therefore disappear in the encoding):

byte  0..3   50 51 53 42   "PQSB"
      4      03            claim version 3 (runestone format)
      5      4d            "M"
      6      00            target output index (must be 0)
      7..15  00            must be zero

v = 0x4d0342535150, LEB128 d0a2cd92b4a013 (7 bytes).

Examples:

Variant Script (hex) Size
claim only 6a5d087fd0a2cd92b4a013 11 bytes
claim + companion mint, rune id 980000:1234 (illustrative id) 6a5d0f7fd0a2cd92b4a01314a0e83b14d209 18 bytes

Parsing (normative, Format B)

function PARSE_CLAIM_B(tx):
    out ← first output whose script starts 6a 5d          # Runes rule
    if none: return none
    pushes ← data pushes after 6a 5d; if any opcode ≥ 0x4f: return none
    ints ← LEB128-decode(concat(pushes)); if truncated or any int > 2^128−1 or > 18 bytes: return none
    if len(ints) odd: return none                         # tag without value
    fields ← pairs (tag, value) in order
    if any tag ∉ {127, 20}: return {op: other}           # strict whitelist: no Body, no edicts, no etching, no pointer
    claims ← values of tag 127;  if len(claims) ≠ 1: return {op: other}
    b ← to_bytes_le(claims[0], 16)
    if b[0:4] ≠ "PQSB" or b[4] ≠ 0x03 or b[5] ≠ "M" or any(b[7:16]): return {op: other}
    mint ← values of tag 20; if len(mint) ∉ {0, 2}: return {op: other}
    return {op: mint, target: b[6], companion: mint}

The whitelist keeps every accepted claim inside a runestone that Runes parses without a cenotaph. Whether the companion mint succeeds on the Runes side (mint open, cap not reached) does not affect PQSB validity.

Candidate test (a) on Valid mint becomes: PARSE_CLAIM_B(tx) is not none.

Format A — direct push (implemented on the test network)

Layout

offset  bytes          field
0       6a             OP_RETURN
1       0b             direct push of 11 bytes
2..5    50 51 53 42    magic "PQSB"
6       02             claim version
7       4d             operation "M" (mint)
8..11   50 51 53 42    ticker "PQSB"
12      00             target output index

Full script, hex: 6a0b50515342024d5051534200 (13 bytes). Output value: any; 0 is normal.

Parsing (normative, Format A)

function PARSE_CLAIM(tx):
    for out in tx.vout:                                    # in output order
        s ← out.scriptPubKey
        if len(s) < 3 or s[0] ≠ 0x6a: continue
        n ← s[1]
        if not (1 ≤ n ≤ 75) or n ≠ len(s) − 2: continue    # exactly one direct push
        p ← s[2:]
        if p[0:4] ≠ "PQSB": continue
        if len(p) = 11 and p[4] = 0x02 and p[5] = "M":
            return {op: mint, ticker: p[6:10], target: p[10]}
        return {op: other}                                  # first magic output decides
    return none

Rules that follow (Format A):

  1. Only the first output carrying the magic counts. A malformed first claim is not rescued by a correct second one.
  2. OP_PUSHDATA1/2/4 encodings are not recognised.
  3. The ticker must equal "PQSB"; the target must be 0 (checked in Valid mint, condition 6).
  4. A transaction is a candidate only if some output script begins with 6a0b50515342. Other transactions with marked inputs are still processed as transfers.

Where to put it (both formats)

Any output position except 0. Output 0 receives the units. A typical mint: [out0 recipient ≥ R sat][out1 claim][out2 change].