#31989 BIP-119 (OP_CHECKTEMPLATEVERIFY) (regtest only)
https://github.com/bitcoin/bitcoin/pull/31989 · · +3683/-23 in 33 files, 9 commits · labels: Consensus, Needs rebase, Needs Conceptual Review
Goal
- Let contract and protocol developers test covenants and vault architectures on regtest
- Addresses the lack of native primitives in Script to constrain output spending
This pull request implements the BIP-119 CheckTemplateVerify (OP_CHECKTEMPLATEVERIFY) opcode as OP_NOP4, accompanied by interpreter validation logic, precomputed template hashing, and functional tests. The activation deployment is restricted strictly to regtest chains. Standardness rules are updated to permit bare CTV outputs while maintaining NOP-equivalent treatment on mainnet.
Problem: Bitcoin Script currently lacks native primitives to constrain where transaction outputs can be spent, limiting layer-2 protocols, transaction batching trees, and self-custodial vault architectures. Contract protocol developers require an implemented opcode specification to test and validate covenant use cases.
Category: Validation (#5 of 48)
P2 · decision needed
- P2 because deciding whether Core should ship experimental consensus opcodes is a major milestone
- It strategically shapes the future validation layer and smart contracting roadmap for covenants
Reaching a technical consensus and decision on proposed soft fork mechanisms like BIP-119 is strategically important for Bitcoin's validation layer and smart contracting roadmap. While this patch isolates activation to regtest to prevent mainnet consensus disruption, deciding whether Core should ship consensus experimental opcodes remains a major open milestone.
Membership: Implements BIP-119 script interpreter execution, deployment flags, and consensus validation logic in src/script/interpreter.cpp and src/validation.cpp.
Factors: security/stability 1, bug 0, performance 0, user value 2, leverage 2
Reviewability: Stale: Needs rebase
- Needs rebase due to merge conflicts across several files
- Author has been inactive since July 2025
The branch has merge conflicts with master across several files and the author has been silent for over 400 days.
Author status: silent since July 2025
Open concerns:
- Core adopting a consensus change without clear emergent consensus across the broader Bitcoin user and developer ecosystem (darosior, BitcoinErrorLog, michaelfolkson)
- Potential DoS vulnerability with hashing block-weight transaction spends and block signature overflow risks in legacy script (ariard)
- Design preference to introduce CTV as a Taproot OP_SUCCESS opcode rather than an upgraded NOP in base script (ariard)
- Risk of using Core as an activation vehicle leading to contentious chain split risks (melvincarvalho, michaelfolkson)
Resolved concerns:
- Lack of functional consensus test coverage resolved by introducing a regtest-only deployment parameter (instagibbs, jamesob)
- Sighash caching performance overhead addressed via benchmarking and removing redundant conditional checks (sedited, moonsettler, jamesob)
- Updated deprecated hex decoding in unit tests (average-gary, jamesob)
Agreement: Blocked
- Blocked by objections against adopting consensus soft forks without broader community consensus
- Unaddressed objection: premature without widespread community consensus (darosior, BitcoinErrorLog)
- Concept approval because it is a minimal extension of script capabilities (ariard, jaybny)
Blocked: darosior and BitcoinErrorLog Concept NACKed inclusion into Core without ecosystem consensus; author has not replied.
A blocking Concept NACK was raised arguing Bitcoin Core should not implement consensus soft forks prior to rough consensus in the wider Bitcoin community. The author has not responded to this objection or engaged on the PR since July 2025.
- darosior: 'As this introduces a new consensus feature, it seems premature to merge this into Bitcoin Core until widespread consensus is reached... Concept NACK on merging this pull request.'
- BitcoinErrorLog: 'NACK. ... this proposal represents an unsolicited modification of Bitcoin’s code and consensus rules. There is no clear user demand...'
- jaybny: 'Concept ACK... CTV is an objectively well-reviewed, fundamental upgrade to Bitcoin...'
- ariard: 'Concept ACK... On the design of CHECKTEMPLATEVERIFY... I do think it's a very minimal extension of the bitcoin script capabilities.'
Review verdicts (DrahtBot): 0 (+1) -2
- Stale ACK: JeremyRubin
- Concept ACK: jaybny, moonsettler, stevenroose, jonatack, delta1, prasincs, pinheadmz, average-gary, ariard
- Concept NACK: BitcoinErrorLog, darosior
Dependencies
Enables:
- Experimental covenant and vault prototyping on regtest
Files
3447 lines under test/bench/ci.
- src/test/data/ctvhash.json +2204/-0
- test/functional/feature_checktemplateverify.py +738/-0
- src/test/ctvhash_tests.cpp +203/-0
- src/test/data/tx_valid.json +152/-0
- src/script/interpreter.cpp +134/-7
- src/test/data/tx_invalid.json +95/-0
- src/script/interpreter.h +43/-4
- test/functional/test_framework/messages.py +14/-0
- src/validation.cpp +12/-1
- test/functional/rpc_blockchain.py +13/-0
- src/test/data/script_tests.json +5/-6
- src/script/script.cpp +9/-1
- src/test/versionbits_tests.cpp +6/-0
- src/kernel/chainparams.cpp +5/-0
- src/policy/policy.cpp +5/-0
- src/script/script.h +4/-1
- src/script/solver.cpp +5/-0
- src/wallet/scriptpubkeyman.cpp +5/-0
- src/deploymentinfo.cpp +4/-0
- src/policy/policy.h +3/-1
- src/rpc/blockchain.cpp +4/-0
- src/rpc/rawtransaction.cpp +4/-0
- test/functional/test_framework/script.py +2/-2
- src/test/transaction_tests.cpp +3/-0
- src/script/script_error.cpp +2/-0
- src/test/CMakeLists.txt +2/-0
- src/addresstype.cpp +1/-0
- src/consensus/params.h +1/-0
- src/script/script_error.h +1/-0
- src/script/sign.cpp +1/-0
- src/script/solver.h +1/-0
- src/test/fuzz/script.cpp +1/-0
- test/functional/test_runner.py +1/-0
Card
This PR implements BIP-119 OP_CHECKTEMPLATEVERIFY on regtest, introducing script interpreter execution and standard template hash calculations to enable basic covenant constructs like vaults and payment trees. Evaluating proposed soft forks and their implementations is strategically important for Bitcoin validation, but the PR is currently blocked by a Concept NACK asserting that Bitcoin Core should not implement consensus rules before rough ecosystem-wide consensus is demonstrated. The branch is stale with merge conflicts and the author has been silent since July 2025.