#29247 CAT in Tapscript (BIP-347)
https://github.com/bitcoin/bitcoin/pull/29247 · · +788/-7 in 9 files, 3 commits · labels: Consensus · draft
Goal
- Allows Tapscript to concatenate stack elements for advanced covenant and contract designs
- Provides a reference implementation for protocol developers and users to evaluate BIP-347 on testnets
This pull request implements the OP_CAT opcode for Tapscript according to BIP-347 by redefining OP_SUCCESS126. It adds execution logic enforcing stack limits up to 520 bytes, defines SCRIPT_VERIFY_OP_CAT and SCRIPT_VERIFY_DISCOURAGE_OP_CAT verification flags, and adds unit and functional test coverage. It intentionally omits miner activation logic.
Problem: Tapscript currently treats opcode 126 as an OP_SUCCESS, preventing scripts from concatenating stack elements to build advanced covenant or contract constructions. Protocol developers and users seeking to evaluate BIP-347 on signet or testnets need a reference implementation in Bitcoin Core.
Category: Validation (#6 of 48)
P2 · decision needed
- P2 because a working implementation is essential for evaluating whether to adopt the soft fork
- Resolving exact opcode semantics and edge cases is critical to deciding the path forward on BIP-347
Proposed soft forks belong to validation because having a reliable implementation is necessary for evaluation and reaching a decision. While the PR lacks activation logic, resolving opcode semantics and edge cases is critical to deciding whether to progress BIP-347.
Membership: Modifies script interpreter execution logic and consensus script verification flags in src/script/interpreter.cpp.
Factors: security/stability 1, bug 0, performance 0, user value 2, leverage 2
Reviewability: Stale: Author silent
- Author has been silent for over four months
- Maintainers converted the pull request to draft pending community consensus on the soft fork
The author has been silent for over 120 days, exceeding the project inactivity threshold, and maintainers converted the PR to draft pending community consensus.
Author status: silent since May 2026 force push; co-author noted temporary shift in focus in April 2026
Open concerns:
- Lack of project and community consensus on adopting the OP_CAT soft fork
- Unintended introspection capabilities and covenant implications if output sizes are not limited
Resolved concerns:
- Ensuring comprehensive script verify flag combinations are tested for DISCOURAGE_OP_CAT and OP_SUCCESS
Agreement: Disputed
- Drafted because concept consensus for the soft fork does not yet exist (achow101)
- Cannot be merged even if the code is acceptable until consensus is reached (achow101)
- Concern that unrestricted output sizes allow unintended introspection and covenants (moonsettler)
- Acknowledged the need to pause and wait for wider consensus (EthanHeilman)
Drafted because concept consensus for the soft fork is absent (achow101); covenants discussed (moonsettler).
Maintainers converted the PR to draft following discussions indicating that there is no consensus to activate or merge OP_CAT. Architectural concerns were also raised regarding unintended covenant capabilities.
- achow101 converted to draft: 'there does not appear to be consensus for the concept of OP_CAT in TapScript yet, so this PR cannot be merged even if the code is okay'
- moonsettler raised concerns that standard OP_CAT allows open-ended introspection and proposed restricting output sizes to 80 bytes
- EthanHeilman acknowledged the need to wait for consensus and noted shifting attention temporarily
Review verdicts (DrahtBot): 0
Dependencies
Enables:
- BIP-347
Files
743 lines under test/bench/ci.
- src/test/data/script_tests.json +414/-0
- test/functional/feature_opcat.py +248/-0
- src/test/script_tests.cpp +79/-1
- src/script/interpreter.cpp +36/-5
- src/script/interpreter.h +4/-0
- src/policy/policy.h +2/-1
- src/script/script_error.h +3/-0
- src/script/script_error.cpp +1/-0
- test/functional/test_runner.py +1/-0
Card
This pull request implements the OP_CAT opcode for Tapscript per BIP-347, without including miner activation logic. It defines SCRIPT_VERIFY_OP_CAT and SCRIPT_VERIFY_DISCOURAGE_OP_CAT to govern script execution and relay policy. While the patch has received testing and inquisition deployment, maintainers converted it to draft because concept consensus for activating OP_CAT does not exist. Review is currently stale as the author has been inactive for several months.