• About
  • FAQ
  • Earn Bitcoin while Surfing the net
  • Buy & Sell Crypto on Paxful
Newsletter
Approx Foundation
  • Home
    • Home – Layout 1
  • Bitcoin
  • Ethereum
  • Regulation
  • Market
  • Blockchain
  • Business
  • Guide
  • Contact Us
No Result
View All Result
  • Home
    • Home – Layout 1
  • Bitcoin
  • Ethereum
  • Regulation
  • Market
  • Blockchain
  • Business
  • Guide
  • Contact Us
No Result
View All Result
Approx Foundation
No Result
View All Result
Home Bitcoin

Bitcoin Covenants: TXHASH And CHECKTXHASHVERIFY(BIP 346)

Moussa by Moussa
April 19, 2025
in Bitcoin
0
Bitcoin Covenants: TXHASH And CHECKTXHASHVERIFY(BIP 346)
189
SHARES
1.5k
VIEWS
Share on FacebookShare on Twitter


This is the third article in a series deep diving into individual covenant proposals that have reached a point of maturity meriting an in-depth breakdown.

TXHASH and CHECKTXHASHVERIFY (TXHASH), put forward by Steven Roose and Brandon Black with a BIP number currently unassigned, is a “template based” covenant that can conceptually seen as an extension or more advanced version of CHECKTEMPLATEVERIFY (CTV). 

Before getting into the nitty gritty of how TXHASH works, let’s refresh on the pieces of data in a Bitcoin transaction. 

At a high level you have the outputs, the inputs, and the witness (or script sig for non-Segwit transactions in the input). 

Global transaction fields:

  • Version
  • Marker, indicating Segwit with a flag value
  • Flag, indicating Segwit with a flag value
  • Input count
  • Output count
  • nLocktime, used for timelocks

Each input contains:

  • TXID of the previous transaction
  • VOUT (index) of the output from that transaction being spent
  • ScriptSig size
  • ScriptSig (if a non-segwit transaction)
  • Sequence number (used for RBF flagging and relative timelocks).

Each output contains:

  • Amount of satoshis assigned to the output
  • ScriptPubKeySize, the size of the locking script
  • ScriptPubkey, the actual locking script

We can ignore the witness field when considering TXHASH or CHECKTXHASHVERIFY as neither opcode constrains the witness field to retain certain properties. 

How TXHASH Works

Both TXHASH (tapscript only) and CHECKTXHASHVERIFY (legacy script and tapscript) have different behaviors on the stack because of the differences between legacy script and tapscript. For the purposes of this article, these differences are not material, so we are simply going to ignore them.

If CTV is a covenant opcode that constrains a bitcoin output to only be spent in a singular and exactly defined way, TXHASH is a supercharged version of CTV that lets you pick and choose exactly what pieces of a transaction are constrained and must be spent in the exactly pre-defined way, and which pieces of a transaction can be whatever someone wants at spending time. 

It gives you the best of both worlds, requiring something be done when spending a covenant restricted coin, but then allowing a user to do whatever they want with the rest of the funds available to them or the transaction they are crafting. 

This is accomplished using the ‘TxFieldSelector’. 

CTV simply uses a single hash of the pre-defined transaction in order to verify at spending time. With TXHASH, you need a way to communicate what pieces of information that hash is committing to, and what pieces of information it is not. That is the TxFieldSelector’s job. 

TxFieldSelector is essentially a series of bytes (that can be variable in length), with each bit communicating what fields in a transaction are committed to by the hash that will be verified against. This allows you to select specific fields of the transaction, nLocktime, version etc. It lets you select specific fields of the inputs and outputs, i.e. include or not the sequence number, or the previous output id, or the taproot annex (a datafield specific to taproot scripts). The outputs, whether to commit to the ScriptPubkey, the amount values, both, or neither. You can also decide exactly which outputs and inputs these restrictions apply to. 

There is some complexity and flexibility in how the TxFieldSelector is put together, and you can read all the finer details here in the proposed BIP if you’re interested in those, but the chief point to take away is it allows you to pick exactly which parts of the transaction are restricted by the covenant when someone goes to spend the encumbered output, and which parts are not, to a very granular degree. 

What Is TXHASH Useful For

Firstly, TXHASH allows you to do everything that you can with CTV. So all of the value provided by CTV to optimize the coordination costs of anything currently possible with pre-signed transactions is also provided by TXHASH. But it supercharges that capability massively. Instead of having to commit to the entirety of a transaction, you can commit to just the parts you care about. 

This has two big benefits in theory right off the bat. First of all, in band fee management for layer twos becomes easier to deal with. Currently the use of anchor outputs is required to fee-bump layer two settlement transactions with Child Pays For Parent, where a transaction spending an output from an unconfirmed one can add to the net fees for both. TXHASH lets you commit to only your counterparties outputs in a multiparty transaction, and leave yours free to do whatever you want with (caveat here that other things must be done to make this safe so a third party can’t burn all of your funds to fees), including decrementing slightly to RBF the transaction. 

Second, the door is now open for multiparty protocols to allow granular guarantees about what off-chain transactions are committing to. Some users can now receive a guarantee about how their coins will be spent, but not have to care about what some other group of users does with theirs. I can be sure that one TxFieldSelector guarantees my coins are handled properly, and I don’t have to care about where anyone else’s coins go. 

In combination with CHECKSIGFROMSTACK (CSFS), TXHASH can facilitate a completely generalized SIGHASH system. The SIGHASH flag is a part of a signature that communicates what parts of the transaction to check the signature against. They are currently: 

  • SIGHASH_ALL – signs all inputs and outputs
  • SIGHASH_NONE – signs all inputs and no outputs
  • SIGHASH_SINGLE – signs all inputs and the output with the same index as this input

None of these SIGHASH flags allow adding any new inputs to a transaction without invalidating them, but each has an ANYONECANPAY version that only signs its own input and the appropriate outputs, allowing anyone else to then add new inputs, and new outputs for the ANYONECANPAY version of SIGHASH_NONE and SIGHASH_SINGLE.

By being able to “sideload” new TxFieldSelectors using CSFS, users can emulate a SIGHASH system that allows them to pick and choose exactly which individual pieces of a transaction the signature commits to or not. 

TXHASH also allows enforcing equality between the value of inputs and outputs by using individual TxFieldSelectors that commit only to a single value field of an input or output you wish to inspect, and then ensuring their hashes are the same on the stack. 

Closing Thoughts

TXHASH is a potential supercharging of CTV, enabling an incredibly granular degree of introspection of the spending transaction which can be incredibly powerful, especially in combination with something like CSFS. 

However, that power is expressive enough that it opens up the door to an incredibly large design space. One that could potentially have a material effect on the overall incentives of Bitcoin. Things like ensuring amount equality across outputs or inputs is getting very close to the territory of what is needed for trustless automated exchange on-chain. That is a serious source of Miner Extractable Value (MEV), which has been a very serious incentive and centralization problem for other blockchains to deal with. 

TXHASH should absolutely not be dismissed, as it provides incredibly powerful primitives for protocol developers to take advantage of, but the potential second order implications of what people will build with it should be weighed against the positives.



Source link

Related articles

CLARITY Act Delay Shows Crypto Market Structure Fight Is Not Over

SEC Charges 38 Entities Over False Investment Adviser Filings

August 31, 2026
Strive (ASST) Adds 17.76 Bitcoin As Falling Prices Boost Its Quarterly Yield

Strive Becomes Fifth Biggest Bitcoin Treasury, Stock Surges On Latest BTC Buy

August 31, 2026
Share76Tweet47

Related Posts

CLARITY Act Delay Shows Crypto Market Structure Fight Is Not Over

SEC Charges 38 Entities Over False Investment Adviser Filings

by Moussa
August 31, 2026
0

The SEC has charged 38 entities for allegedly using false filings to make themselves appear legitimate as registered investment advisers....

Strive (ASST) Adds 17.76 Bitcoin As Falling Prices Boost Its Quarterly Yield

Strive Becomes Fifth Biggest Bitcoin Treasury, Stock Surges On Latest BTC Buy

by Moussa
August 31, 2026
0

Strive’s stock soared on Monday after the company announced a $143 million bitcoin buy, making it the fifth biggest publicly...

Blackrock’s BUIDL Hits $2.8B, Reclaims Treasury Crown

Blackrock’s BUIDL Hits $2.8B, Reclaims Treasury Crown

by Moussa
August 31, 2026
0

Key TakeawaysBlackrock’s BUIDL fund holds about $2.8 billion in assets, or 18.5% of the $15.1 billion market.BUIDL lost the top...

Bitcoin rainbow chart – multiple variants

by Moussa
August 31, 2026
0

In my research on the Bitcoin rainbow chart, I have seen 4 variants of the Bitcoin Rainbow chart on the...

Bitcoin Price Prediction: Macro Pressure Mounts as Yen Slides and Oil Climbs

Bitcoin Price Prediction: Macro Pressure Mounts as Yen Slides and Oil Climbs

by Moussa
August 31, 2026
0

Bitcoin traded at $78,500 as the Japanese yen breached 160 per dollar in Tokyo trading, while a U.S. strike on...

Load More

youssufi.com

sephina.com

[vc_row full_width="stretch_row" parallax="content-moving" vc_row_background="" background_repeat="no-repeat" background_position="center center" footer_scheme="dark" css=".vc_custom_1517813231908{padding-top: 60px !important;padding-bottom: 30px !important;background-color: #191818 !important;background-position: center;background-repeat: no-repeat !important;background-size: cover !important;}" footer_widget_title_color="#fcbf46" footer_button_bg="#fcb11e"][vc_column width="1/4"]

We bring you the latest in Crypto News

[/vc_column][vc_column width="1/4"][vc_wp_categories]
[/vc_column][vc_column width="1/4"][vc_wp_tagcloud taxonomy="post_tag"][/vc_column][vc_column width="1/4"]

Newsletter

[vc_raw_html]JTNDcCUzRSUzQ2RpdiUyMGNsYXNzJTNEJTIydG5wJTIwdG5wLXN1YnNjcmlwdGlvbiUyMiUzRSUwQSUzQ2Zvcm0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CUyMGNsYXNzJTNEJTIydG5wLXByaXZhY3klMjIlM0UlQzIlQTBCeSUyMGNvbnRpbnVpbmclMkMlMjB5b3UlMjBhY2NlcHQlMjB0aGUlMjBwcml2YWN5JTIwcG9saWN5JTNDJTJGbGFiZWwlM0UlM0MlMkZkaXYlM0UlM0NkaXYlMjBjbGFzcyUzRCUyMnRucC1maWVsZCUyMHRucC1maWVsZC1idXR0b24lMjIlM0UlM0NpbnB1dCUyMGNsYXNzJTNEJTIydG5wLXN1Ym1pdCUyMiUyMHR5cGUlM0QlMjJzdWJtaXQlMjIlMjB2YWx1ZSUzRCUyMlN1YnNjcmliZSUyMiUyMCUzRSUwQSUzQyUyRmRpdiUzRSUwQSUzQyUyRmZvcm0lM0UlMEElM0MlMkZkaXYlM0UlM0NiciUyRiUzRSUzQyUyRnAlM0U=[/vc_raw_html][/vc_column][/vc_row]
No Result
View All Result
  • Contact Us
  • Homepages
  • Business
  • Guide

© 2024 APPROX FOUNDATION - The Crypto Currency News