• 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 core – Issue: Taproot Multisig Script Path Spending Fails with “Witness program hash mismatch”

Moussa by Moussa
March 12, 2025
in Bitcoin
0
peer discovery – how to obtain the IP addresses of nodes for mining pools?
189
SHARES
1.5k
VIEWS
Share on FacebookShare on Twitter


I generated a Taproot multisig address using Bitcoin Core’s deriveaddresses command with multi_a:

deriveaddresses "tr(tprv8ZgxMBicQKsPdgBQV2Y9EVPSjAGhyZXArhwSzHwnV3FytzPRr8KCR8EKEpLeHbANAncgbc31a6QoXjBTARQiZ2h1Z2NgSCjFYeTqKpAN5Gc/86h/1h/0h/0/1,multi_a(2,tprv8ZgxMBicQKsPdgBQV2Y9EVPSjAGhyZXArhwSzHwnV3FytzPRr8KCR8EKEpLeHbANAncgbc31a6QoXjBTARQiZ2h1Z2NgSCjFYeTqKpAN5Gc/86h/1h/0h/0/2,tprv8ZgxMBicQKsPdgBQV2Y9EVPSjAGhyZXArhwSzHwnV3FytzPRr8KCR8EKEpLeHbANAncgbc31a6QoXjBTARQiZ2h1Z2NgSCjFYeTqKpAN5Gc/86h/1h/0h/0/3))"

Key-path spending works correctly.

Script-path spending fails with error:

mandatory-script-verify-flag-failed (Witness program hash mismatch)

Code for Constructing Script Path Spending Transaction

final script = Script(script: [
  pk2.toXOnlyHex(),
  'OP_CHECKSIG',
  pk3.toXOnlyHex(),
  'OP_CHECKSIGADD',
  2,
  'OP_NUMEQUAL'
]);

final address = pk.toTaprootAddress(scripts: [
  [script]
]);

final sig1 = prv1.signTapRoot(
  tx.getTransactionTaprootDigset(
    txIndex: 0,
    tapleafScript: script,
    scriptPubKeys: [address.toScriptPubKey()],
    amounts: [amount],
  ),
  tweak: false
);

final sig2 = prv2.signTapRoot(
  tx.getTransactionTaprootDigset(
    txIndex: 0,
    tapleafScript: script,
    scriptPubKeys: [address.toScriptPubKey()],
    amounts: [amount],
  ),
  tweak: false
);

final controlBlock = ControlBlock(
  public: pk,
  scripts: toTapleafTaggedHash(script.toBytes())
);

final witness = TxWitnessInput(
  stack: [ sig1, sig2, script.toHex(), controlBlock.toHex()]
);

tx = tx.copyWith(witnesses: [witness]);

Raw Transaction

020000000001012543af34ab664d559d793946dd47345d5b6fff9f2e89456e03a5cc8acf57bf0e0100000000ffffffff0210270000000000001976a914e12bdac26ab92798ca56a38fd81bd09406458d5a88acb44e070000000000225120577176e689685df89c26a97cf400f11e33431ace42973389f48b78c14310d13a0440051c660118fbf450304e929389074629303fa4c5777a3e638c1956e64960e885fc5df26b430063e3b57012b6ec69262f30c0e922a2528aeeee472cdcada508eb40dd52984447622f84b473fa92336ebb4c3482c51cf4ad74b6ce50b76441c00cc59d69cab1b0fc76a9627847a87a7a0ca6a37860c15a574e052c675b323f90d64d46200db491b6b7b47d42a78b270a1e395e6b8f62886d4286c39c6111d326cdd31dc6ac20116d5f1c9eee66aef644423bd29e3b7549dd3e3d7e44702f3076305b7fd9d946ba529c41c0ba4e3cf774e82577c830c1e99b4e08ce158644f7ddd04aeca712b0daa72c74c01819cabf8c966ff15284017054ef1ce61b18dd66ccefa4b67941d2c0d04be44200000000

What is causing the witness hash mismatch?
Is my control block correct?
Does Bitcoin Core allow spending via script-path for multi_a descriptors?
Am I missing any required tweaks or flags.
Thanks



Source link

Related articles

What happens to old transactions in case of a fork?

August 29, 2026
NFL Returns to Draftkings and Fanduel, Still Shuns Prediction Markets

NFL Returns to Draftkings and Fanduel, Still Shuns Prediction Markets

August 29, 2026
Share76Tweet47

Related Posts

What happens to old transactions in case of a fork?

by Moussa
August 29, 2026
0

I'm confused about forking. What happens to the 'old' version of a blockchain and related transactions/data in case of a...

NFL Returns to Draftkings and Fanduel, Still Shuns Prediction Markets

NFL Returns to Draftkings and Fanduel, Still Shuns Prediction Markets

by Moussa
August 29, 2026
0

Key TakeawaysNFL signed three sportsbook partners on Aug. 27, its first since deals lapsed March 31.Partners agreed to prohibit bets...

How bitcoin browsers check P2PK and P2SH balance?

by Moussa
August 29, 2026
0

Suppose someone sends bitcoins to me using P2PK, I only enter my address starting with 1 in the bitcoin browser,...

Should You Trust Their Bitcoin Price Calls?

Should You Trust Their Bitcoin Price Calls?

by Moussa
August 29, 2026
0

Key TakeawaysArmstrong and CZ remain broadly bullish, but their forecasts often follow bitcoin’s price action.Long-term price calls offer entertainment value...

Could Bitcoin Power the Next Generation of Trust-Minimized Prediction Markets?

by Moussa
August 29, 2026
0

Prediction markets are becoming an interesting intersection of blockchain technology, real-time data, and artificial intelligence. The basic idea is simple:...

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

© 2024 APPROX FOUNDATION - The Crypto Currency News