# OP_CHECKXMSSSIG

> OP_CHECKXMSSSIG (0xde) checks a 2,340-byte post-quantum XMSS signature. Its stack layout, Pearl's parameters, the wallet's removed pq leaf and its status.

Source: https://pearlcodex.com/technical/script/op-checkxmsssig/ · Last updated: 2026-11-02 · Checked against Pearl's source code at v1.5.5

[OP_CHECKXMSSSIG](https://pearlcodex.com/glossary/#op-checkxmsssig) is the one opcode Pearl added to Bitcoin’s Script. It checks an [XMSS](https://pearlcodex.com/glossary/#xmss) signature: a signature built only from hash functions, which are believed to stay secure even against large quantum computers.

It’s an insurance policy. Schnorr signatures on secp256k1 protect every Pearl coin today, but a working quantum computer could break them. A Taproot address can carry an XMSS check as a hidden backup script, ready to use if that day comes (though the address’s Schnorr key path stays open too). The opcode exists and works; this page also covers how Pearl’s wallet once used it, and why it no longer does.

## What is XMSS, in short?

A one-time signature, multiplied. A Winternitz one-time key can sign exactly one message using nothing but hash chains. XMSS makes 32 of them (on Pearl) and ties their public keys together in a [Merkle tree](https://pearlcodex.com/glossary/#merkle-tree), whose root is the long-term public key. Each signature uses one leaf and includes the path that proves the leaf belongs to the tree.

The catch: it’s _stateful_. The signer must never use a leaf twice, and when all 32 are used, the key is spent. The [XMSS page](https://pearlcodex.com/technical/cryptography/xmss/) covers the scheme in depth.

- **Hash function:** SHAKE256 n = 32 bytes
- **Winternitz w:** 16 67 hash chains per one-time key
- **Tree height:** 5 32 signatures per key
- **Public key:** 64 bytes Merkle root + public seed
- **Signature:** 2,340 bytes 5 × 468 on the stack
- **Opcode:** 0xde 222; tapscript only

Pearl’s code names the parameter set “XMSS-SHAKE256_5_256 (not in RFC 8391)”: the RFC’s standard sets have taller trees.

| Field               | Size    | Description                                                        |
| ------------------- | ------- | ------------------------------------------------------------------ |
| index               | 4       | Which of the 32 one-time keys was used.                            |
| randomness r        | 32      | Per-signature randomness mixed into the message hash.              |
| WOTS signature      | 67 × 32 | 2,144 bytes: one value from each of the 67 Winternitz hash chains. |
| authentication path | 5 × 32  | 160 bytes: the sibling hashes from that leaf up to the root.       |

## What does the opcode do?

- **Size:** 1 byte (0xde)
- **Type:** Tapscript opcode
- **Format:** \[sig1 sig2 sig3 sig4 sig5 pubkey] → \[true]

1. **Tapscript only**

   Anywhere else, it’s an invalid opcode. (On Pearl, every script that runs is tapscript anyway.)

2. **Pop the public key**

   The top item must be the 64-byte XMSS public key.

3. **Pop five pieces**

   The next five items are the signature, sig1 deepest. Each must be exactly 468 bytes. Any wrong length fails the script.

4. **Charge the budget**

   1,000 is taken from the input’s signature budget (50 plus the witness size). A Schnorr check costs 50.

5. **Compute the message**

   The BIP-342 tapscript sighash, always with the default sighash type: the same message an OP_CHECKSIG in this leaf would sign.

6. **Verify**

   Join the pieces and verify. Valid: push true. Invalid: the script fails immediately. Unlike OP_CHECKSIG, it never pushes false.

`node/txscript/opcode.go`

```go
const numSigChunks = 5
const sigChunkSize = xmss.SignatureLen / numSigChunks // 468 bytes = 2340 / 5
…
// XMSS_SHAKE256_5_256 verification is capped at 67 * 16 + 5 hashes
if err := vm.tapscriptCtx.tallyOpCost(1000); err != nil {
	return err
}
…
valid := xmss.Verify(pk, msg, sig)
if !valid {
	str := "invalid XMSS signature"
	return scriptError(ErrNullFail, str)
}
```

The 520-byte limit on stack items is why the signature arrives in five pieces. Run `de` alone, with an empty stack, and Pearl’s engine fails trying to pop the key; in Bitcoin’s tapscript the same byte is OP_SUCCESS222 and the script would pass.

## How did Pearl’s wallet use it?

It doesn’t any more. Until v1.5.5, `getnewaddress … pq=true` made a quantum-safe address like this:

1. **Two keys from one seed**

   The usual Schnorr key at `m/86'/808276'/0'/branch/index`, and a second key at `m/222'/808276'/0'/branch/index`. 222 is 0xDE, the opcode’s byte.

2. **XMSS seeds**

   The second key’s 32-byte private key went through HKDF-SHA256 with the label “XMSS-SEED-EXPANSION”, giving a 64-byte private seed and a 32-byte public seed. XMSS key generation ran from those.

3. **One leaf**

   The leaf script was `40` ‖ the 64-byte XMSS public key ‖ `de`: 66 bytes.

4. **Tweak**

   The Schnorr key was tweaked with that leaf’s hash, exactly as on the [Taproot tweak](https://pearlcodex.com/technical/keys/taproot-tweak/) page.

The result was an ordinary `prl1p…` Taproot address, not a P2MR one. Here is the real example the research for this site produced with Oyster v1.5.2, from the public test phrase “abandon … about” (index 3):

|                                                 | Value                                                              |
| ----------------------------------------------- | ------------------------------------------------------------------ |
| Schnorr internal key P (`m/86'/808276'/0'/0/3`) | `a93c92e3e66d37d57328f72b9705a8d76abaa0aff97c4cd9a3bc147bc3894f1b` |
| PQ key (`m/222'/808276'/0'/0/3`), HKDF input    | `c8d6edf779a83c7faef392035015191b634a85dc198c9e123f164872b86c2870` |
| XMSS public key (64 bytes)                      | `5e70da755554f576…ce2f0df31994e54b25ee8f8`                         |
| Leaf hash = tree root                           | `4d136994bb1cfe36b7b495d9bda4de40afe915112882d7b4730bf90fea75a91a` |
| Output key Q                                    | `b9cacae9a3006236c709e93e003a649f38ac20966a00dd3de5a80c1acbf5837d` |
| Address (pq=true)                               | `prl1ph89v46drqp3rd3cfaylqqwnynuu2cgykdgqd60094qxp4jl4sd7ssg6v5j`  |
| Same P with no leaf, for comparison             | `prl1prmdvgxfgzmqzq5dj58enw6y7c55wpsfdpr0af7t79x65z6gmms8q4qa93j`  |

The leaf changes the tweak, so the address differs from the plain one, but nobody can tell from outside that it has a backup path.

v1.5.5 removed the option, the `m/222'` branch and the XMSS key helpers. Pearl Research Labs call it a clean-up before a full post-quantum wallet built on [P2MR](https://pearlcodex.com/technical/script/p2mr/), which will derive XMSS keys its own way.

## What would an XMSS spend look like?

It would be a Taproot script-path spend with seven witness items: the five signature pieces, the 66-byte leaf, and a 33-byte control block (leaf version and parity, then P). Adding up the bytes:

$$
1 + 5 \times (3 + 468) + (1 + 66) + (1 + 33) = 2{,}457 \text{ bytes}
$$

That’s about 615 vbytes of witness, so a one-input, two-output XMSS spend would be roughly 750 vbytes, around five times a Schnorr payment. Its budget, 50 + 2,457 = 2,507, easily covers the 1,000-unit check. These are estimates from the rules; no such spend has been observed.

## Can I use it today?

Only in the rules, and it’s worth being precise:

- **Consensus is ready.** Any node running v1.5.5 verifies OP_CHECKXMSSSIG in any tapscript leaf, Taproot or P2MR.
- **No wallet uses it.** Since v1.5.5, Oyster can’t make an address with an XMSS leaf, and a search of the v1.5.5 code found no `xmss.Sign` caller outside tests. Every address Pearl’s wallets make is plain BIP-86.
- **Old pq addresses need the old wallet.** Oyster v1.5.3 and earlier spent pq addresses by the Schnorr key path, tweaked with the leaf. Oyster v1.5.5 signs for the plain key, which doesn’t match, so it can’t spend them. Pearl’s release notes say to move those coins with the earlier release before upgrading. See also the [mnemonic page](https://pearlcodex.com/technical/keys/mnemonic-seed/).

> **Warning: One-time keys, many-time risk**
>
> Each XMSS key can sign 32 times, and the signer must remember which of its one-time keys it has used. Signing twice with the same index would reveal enough to forge signatures. Pearl’s code warns about this, and the state handling is not implemented outside tests at v1.5.5.

> **Pearl vs Bitcoin**
>
> Bitcoin has no post-quantum signature opcode: byte 0xde is OP_SUCCESS222 in its tapscript, so a leaf containing it always succeeds. BIP-360 (P2MR) doesn’t define one either. Pearl adds OP_CHECKXMSSSIG and closes every OP_SUCCESS, so 0xde does exactly one thing.

## In short

- OP_CHECKXMSSSIG is byte 0xde and works only in tapscript. It verifies a hash-based XMSS signature, believed to resist quantum computers.
- Stack in: five 468-byte signature pieces, then a 64-byte public key. Stack out: true. A bad signature fails the whole script; it never pushes false.
- The signature (2,340 bytes) is split in five because no stack item may exceed 520 bytes. The check costs 1,000 from the input’s signature budget.
- Pearl’s XMSS key has a tree of height 5: exactly 32 signatures per key. It signs the same tapscript sighash as Schnorr, default type only.
- Oyster v1.5.3 and earlier could add an XMSS leaf to a Taproot address on request (pq=true), and v1.5.5 removed that option. No wallet code signs with XMSS, so no wallet uses the opcode today.

## Read the code

- [opcodeCheckXmssSig](https://github.com/pearl-research-labs/pearl/blob/v1.5.5/node/txscript/opcode.go#L2020-L2107) `node/txscript/opcode.go:2020-2107`
- [OP_CHECKXMSSSIG = 0xde](https://github.com/pearl-research-labs/pearl/blob/v1.5.5/node/txscript/opcode.go#L264) `node/txscript/opcode.go:264`
- [XMSS-SHAKE256_5_256 parameters](https://github.com/pearl-research-labs/pearl/blob/v1.5.5/xmss/src/xmss.cpp#L11-L31) `xmss/src/xmss.cpp:11-31`
- [A valid script-path spend, in a test](https://github.com/pearl-research-labs/pearl/blob/v1.5.5/node/txscript/opcode_test.go#L260-L323) `node/txscript/opcode_test.go:260-323`

## Sources

### Pearl source

- [Pearl source code at v1.5.5](https://github.com/pearl-research-labs/pearl/tree/v1.5.5)
- [Pearl PR #463: removing the wallet's partial post-quantum support (v1.5.5)](https://github.com/pearl-research-labs/pearl/pull/463)

### Bitcoin standards

- [BIP-342: Validation of Taproot scripts (the signature message)](https://github.com/bitcoin/bips/blob/master/bip-0342.mediawiki)
- [BIP-360: Pay to Merkle Root (P2MR), draft](https://github.com/bitcoin/bips/blob/master/bip-0360.mediawiki)

### Papers

- [RFC 8391: XMSS, eXtended Merkle Signature Scheme](https://www.rfc-editor.org/rfc/rfc8391)
