Tapscript
Also called: BIP 342, BIP342, Taproot scripts, OP_CHECKSIGADD, OP_SUCCESSx.
Tapscript is the script language for Taproot script paths (BIP 342): Bitcoin Script with Schnorr signature checks, OP_CHECKSIGADD and OP_SUCCESS hooks.
Tapscript is the version of Bitcoin Script used when a Taproot output is spent through its script path. It is defined in BIP 342 by Pieter Wuille, Jonas Nick and Anthony Towns, and activated with Taproot at block 709,632 in November 2021. A Taproot leaf with leaf version 0xc0 is a tapscript.
What's different from legacy Script
- Schnorr signatures. OP_CHECKSIG and OP_CHECKSIGVERIFY verify BIP 340 Schnorr signatures against 32-byte x-only keys, signing the BIP 341 sighash message.
- OP_CHECKSIGADD replaces CHECKMULTISIG. OP_CHECKMULTISIG and OP_CHECKMULTISIGVERIFY are disabled. The new OP_CHECKSIGADD (0xba) counts valid signatures, so a 2-of-3 multisig becomes
<A> CHECKSIG <B> CHECKSIGADD <C> CHECKSIGADD 2 NUMEQUAL, which supports batch verification. - Simpler limits. The 10,000-byte script size limit and the 201-opcode limit don't apply. Instead each input has a signature budget of 50 plus its witness size in bytes, and each signature check uses 50.
- MINIMALIF is consensus. The argument to OP_IF and OP_NOTIF must be exactly empty or exactly 0x01, removing a malleability vector.
Built for upgrades
Opcodes 80, 98, 126-129, 131-134, 137-138, 141-142, 149-153 and 187-254 became OP_SUCCESSx: a script containing one succeeds unconditionally, so a future soft fork can give it a meaning. Proposals such as OP_CAT (BIP 347, using OP_SUCCESS126), BIP 348 and BIP 443 build on this. Unknown public key types and leaf versions are reserved the same way; BIP 118 proposes a new key type.
Look up any opcode in the opcode reference.