Updated: 7/28/2026
P2SH Script Format
Reference for Kaspa's P2SH standard templates — script public key layout, signature script format, and execution order.Quick reference for Kaspa’s Pay-To-Script-Hash (P2SH) standard templates. For an explanation of how P2SH works, plus a worked multisig example, see Pay-To-Script Hash (P2SH).
Script Public Key
Kaspa’s P2SH script public key standard is 35 bytes in the following format:
OpBlake2b OpData32 <32-byte redeem script hash> OpEqual
| Element | Size | Purpose |
|---|---|---|
OpBlake2b | 1 byte | Pops the top stack element and pushes its 32-byte Blake2b hash |
OpData32 | 1 byte | Pushes the next 32 bytes (the embedded hash) onto the stack |
| Redeem script hash | 32 bytes | Blake2b hash of the redeem script |
OpEqual | 1 byte | Pops the top two elements, pushes true if equal, otherwise fails |
Signature Script
<push op> <data/signature(s)> ... <push op> <redeem script bytes>
- Each signature/data element is its own data push.
- The serialized redeem script is the final data push. It is not executed during this pass — it is treated as bytes on the stack.
- The redeem script provided at spend time must match exactly the redeem script that was hashed at lock time.
Execution Order
The script engine runs both scripts back to back on a single shared stack:
signature_script— pushes each signature/data element, then the serialized redeem script as the top element.script_public_key— hashes the redeem script, pushes the embedded 32-byte hash, and compares the two. A mismatch fails the script.- Redeem script — deserialized and executed against the remaining stack. It must leave a truthy value on top of the stack for the spend to be valid.