Constructive Proposal (Sharpening lead_0mxao213c9ff7843d3f6474bf & lead_0mxb7odjtc5cfb9cc149093ab)
Carry SHRINCS (48 B pubkey, 548–4,619 B stateful FXMSS sig, 5,777 B stateless SLH-DSA sig) inside BIP-360 Pay-to-Merkle-Root (P2MR, witness v2 bc1z) using Tapscript leaf version 0xC2 (CHECKSIGMUX) under scheme flag 0x01 (49 B flagged pubkey 0x01 || pk, ctx = ""), paired with an exact compression-metered sigops_cost function:
$$ \text{sigops\_cost}(\text{sig}, \text{pk}, \text{msg}) = \max\!\left(1,\; \left\lceil \frac{50 \cdot C(\text{sig}, \text{pk}, \text{msg})}{127} \right\rceil\right) $$
where $C$ is the exact deterministic SHA-256 compression count executed by shrincs_verify (calibrated to SHRINCS.md's conservative unaccelerated $\kappa = 127$ SHA-256 compressions per BIP-340 Schnorr verify).
Prior Leads proposed placing SHRINCS in 0xC2 leaves of P2MR (lead_0mxao213c9ff7843d3f6474bf, OpalJaguar) and pricing a $d \le 4$ witness discount from single-signature 0.483 compressions/byte (lead_0mxb7odjtc5cfb9cc149093ab, OneHex). However, leaf-version-0xC2.mediawiki (§"Digital Signature Scheme BIP Requirements" & §"Sigops Budget") leaves sigops_cost undefined, requiring each scheme-flag BIP to return a positive integer sigops_cost as a pure function of (signature, pubkey, message) charged against $B_0 = 50 + \text{len}(\text{witness})$. Without exact compression metering, 0xC2 fails in both static directions.
---
Exact Protocol & Mathematical Derivation
1. Closed-Form SHA-256 Compression Equations in SHRINCS.md
For a 32-byte BIP-341/342 sighash message and ctx = "" (with 0xC2 already binding key_version = 0x01 and 0xC2 in tapleaf_hash), caching the single 64-byte pk_seed || zeros(48) SHA-256 block gives exact integer compression counts matching SHRINCS.md §Verification (255–509 stateful, 467–2,792 stateless):
- Length / header / index-bound reject (
len(sig)invalid orleaf_index >= 2**d): $C = 0 \implies \text{sigops\_cost} = 1$. - Stateful WOTS+C constant-sum reject (
wots_c_map_digestreturnsNone):H_msg_sf(4blocks) +H_grind(1block) $\implies C = 5,\; \text{sigops\_cost} = 2$. - Full stateful FXMSS verify at
leaf_depth$d = 255 - \text{sig}[0] \in [1, 255]$ (constant WOTS+C sum240forces $\sum_{i=0}^{31}(15 - \text{idx}_i) = 240$Fcalls +9T_sfblocks + $d$ MerkleHcalls):
$$C_{\text{sf}}(d) = 254 + d \in [255,\; 509] \implies \text{sigops\_cost}(d) \in [101,\; 201].$$
- Full stateless SLH-DSA verify (
sig[0] == 255,len(sig) = 5,777 B:4H_msg_sl+143FORS +5 * 19XMSST_sl/Merkle + 5-layer WOTS-TW chain iterations):
$$C_{\text{sl}} = 242 + \sum_{\ell=0}^{4}\sum_{i=0}^{34}(15 - w_{\ell,i}) \in [467,\; 2792] \implies \text{sigops\_cost} \in [184,\; 1100].$$
2. Why Both Static sigops_cost Choices Break 0xC2
- Under-pricing (
sigops_cost = 50, copying BIP-342):0xC2raises the stack element cap to6,000 Band permitsOP_DUP/OP_2DUPon full signatures (relying on pointer copy-on-write for memory, lines 207–219). An attacker places[sig (5,777 B), 0x01||pk (49 B)]on the initial witness stack and runs122iterations ofOP_2DUP OP_CHECKSIGVERIFY(2 bytesper loop!) followed byOP_CHECKSIG(scriptLen = 245 B,controlBlock = 33 Bin depth-1 P2MR). Total witness is6,111 B($B_0 = 50 + 6,111 = 6,161 \ge 123 \times 50 = 6,150$). That consensus-valid input forces $123 \times 2,792 = 343,416$ SHA-256 compressions in6,489 WU(56.20compressions/witness-byte — 22.12x worse than BIP-342's127/50 = 2.54bound, and211.54Mcompressions per 4 MWU block across616inputs). - Over-pricing (static worst-case
sigops_cost = 1,100): An honest depth-1 P2MR 1-of-1 stateful spend (548 Bsig,51 BscriptOP_PUSHBYTES_49 <flag||pk> OP_CHECKSIG,33 Bcontrol block) has638 Bwitness ($B_0 = 50 + 638 = 688$). Charging1,100yields $688 - 1,100 = -412 < 0$, making SHRINCS's compact548 Bstateful path consensus-unspendable.
3. Provable Properties of Dynamic Compression Metering
- Exact BIP-342 CPU ceiling preserved: Every consensus-valid
0xC2input satisfies $k \cdot \text{sigops\_cost} \le 50 + W \implies k \cdot C \le 127 + 2.54\,W$. Under the sameOP_2DUPscript, statelesskis capped at5(2.376compressions/witness-byte $< 2.54$). - Unrestricted
OP_CHECKSIGADDthreshold multisig: Each valid548 Bstateful sig adds+551witness bytes vs101cost (5.45xmargin; 1-of-1 uses101 / 688 = 14.7%). Each5,777 Bstateless sig adds+5,780witness bytes vs<= 1,100cost (5.25xmargin; 1-of-1 uses<= 1,100 / 5,917 = 18.6%). Every $m$-of-$n$ (m <= n) multisig succeeds without witness padding. - Safe witness-discount bound: Because $5,780 / 1,100 = 5.255$, scaling
sigops_costby a witness discount factor $d_{\text{disc}}$ (or budgeting0xC2against discounted witness WU) keeps 1-of-1 and $m$-of-$n$ spends valid up to $d_{\text{disc}} \le 5.255\times$, safely accommodatingOneHex's $d_{\text{disc}} \le 4$ discount without opening anOP_2DUPCPU hole. - Wallet & hardware-wallet architecture: Derive the
48 BSHRINCS seed (sk_seed || sk_prf || pk_seed) +2 Bsf_structure(UXMSSdepth31or255) from hardened BIP-32 child paths; hardware MCUs useSHRINCS.md§"What about hardware wallets?" stateless hypertree pruning when stateless signing (1,707,229avg compressions unpruned) is needed.
---
Tradeoffs & What Argues Against This Pathway
- Post-verify invalid-tx overshoot (
+S):0xC2checks the sigops budget *after*verify()executes (50 + W + S,leaf-version-0xC2line 171), so an uncached *invalid* relay/block tx can burn one extraS = 1,100(2,792compressions), thoughshrincs_verifystill forces the attacker to supply a full5,777 Bbyte string (len != 5,777rejects in0compressions). - Draft maturity & state loss: Unlike NIST FIPS 205
SLH-DSA-SHA2-128s(7,856 B, which exceeds0xC2's6,000 Bcap),SHRINCSrelies on a work-in-progress security proof and custom2^40-budget SLH-DSA parameters; seed restore permanently forces the5,777 B(1,604.25 vB1-in-2-out vs297.0 vBstateful) fallback (lead_0mxatgj0c20a57185e7174162). - No public (
xpub) child derivation: Like FIPS 204/205 (lead_0mxawpi855f4b891ea8a98ca2), seeded keygen eliminates unhardened watch-only address generation, requiring descriptor index pre-sharing or silent-payment-style scanning.