• 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

Getting error “non-mandatory-script-verify-flag (Witness program hash mismatch)” when trying to send raw signed transaction

Moussa by Moussa
March 22, 2024
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’m trying to send a fairly simple segwit transaction with multiple input and outputs using bitcoinlib, here’s how the simplified code looks like:

from bitcoinlib.transactions import Output, Key, Transaction

# (prev_txid, output_n, address, value in satoshis)
inputs = [
    (u'4ab923ee400a3899dc0790c7658af9931e54fc40dc1a8a79281a989e6a56ddd2', 125, 'bc1p0val59xpljwfr52hdg667v0nnnjzusfmvgys6warv7hklrfjum7sjgj75j', 1077938),
]

outputs = []
outputs.append(Output(15260, address="bc1pylrxedd66287hl0e000qy9c86u9tagg206yvyymp4j2c6c5npfjseyjpdu"))

 # 1000 = 10.00 sat/vB
fee_per_kb = 1000

t = Transaction(outputs=outputs, witness_type="segwit", version=2)

for ti in inputs:
    ki = Key("PRIVATE_KEY")
    t.add_input(prev_txid=ti[0], output_n=ti[1], address=ti[2], value=ti[3],  keys=ki.public(), witness_type="segwit")

fee = round((t.estimate_size(1) * fee_per_kb) / 100)

total_inputs = 0
for ti in inputs:
    total_inputs += ti[3]

total_output = 15260
change = total_inputs - total_output - fee

# Add change output
t.add_output(change, address="bc1pyr9x8f7z5t9cxykfzzx66y2xc3davshzmd3xmf9dcxdpkg4tjuusschhpq")

icount = 0
for ti in inputs:
    ki = Key("PRIVATE_KEY")
    t.sign(ki.private_byte, icount)
    icount += 1

t.update_totals()
t.verify()
t.info()
print()
print("Raw Signed Transaction: %s" % t.raw_hex())
Transaction b2b765f26c3d8f766e205f1ae4bd82950f6283013ed23c0dd6d337c15b30d97a
Date: None
Network: bitcoin
Version: 2
Witness type: segwit
Status: new
Verified: True
Inputs
- bc1p0val59xpljwfr52hdg667v0nnnjzusfmvgys6warv7hklrfjum7sjgj75j 0.01077938 BTC 4ab923ee400a3899dc0790c7658af9931e54fc40dc1a8a79281a989e6a56ddd2 125
  segwit sig_pubkey; sigs: 1 (1-of-1) valid
Outputs
- bc1pylrxedd66287hl0e000qy9c86u9tagg206yvyymp4j2c6c5npfjseyjpdu 0.00015260 BTC p2tr U
- bc1pyr9x8f7z5t9cxykfzzx66y2xc3davshzmd3xmf9dcxdpkg4tjuusschhpq 0.01061148 BTC p2tr U
Size: 236
Vsize: 153
Fee: 1530
Confirmations: None
Block: None

Raw Signed Transaction: 02000000000101d2dd566a9e981a28798a1adc40fc541e93f98a65c79007dc99380a40ee23b94a7d00000000ffffffff029c3b00000000000022512027c66cb5bad28febfdf97bde021707d70abea10a7e88c21361ac958d62930a651c3110000000000022512020ca63a7c2a2cb8312c9108dad1146c45bd642e2db626da4adc19a1b22ab973902473044022019d43d372c8d6967f377f76d20a24d31fb3cb046a5640e9a02197afa526738dd02201afdc3e421665b35397ef2adf40908aeb3031569e49aab367285a9015effbd1f0121023f5bdab1fb426681f1a020998ffc69c844f380fe6e0d67b73e7fc9bc3291018b00000000

Everything seems ok when running the script and it even shows Verified as True but when I try to send it through bitcoin-cli I get a “non-mandatory-script-verify-flag (Witness program hash mismatch)” error.

I think I’m making a mistake signing my inputs but I’m not sure how, I checked the private key multiple times and it does match the address that currently holds the UTXO.

Can anyone advise what to do?



Source link

Related articles

Central Bank of Russia Proposes Opening National Economy to International Markets Using Digital Assets

Central Bank of Russia Proposes Opening National Economy to International Markets Using Digital Assets

March 17, 2026
How do Bitcoin mining pools typically handle payout frequency versus thresholds?

bitcoin hash password – Bitcoin Stack Exchange

March 17, 2026
Share76Tweet47

Related Posts

Central Bank of Russia Proposes Opening National Economy to International Markets Using Digital Assets

Central Bank of Russia Proposes Opening National Economy to International Markets Using Digital Assets

by Moussa
March 17, 2026
0

The institution has asked the government to allow digital financial assets to be issued on open networks like Ethereum, opening...

How do Bitcoin mining pools typically handle payout frequency versus thresholds?

bitcoin hash password – Bitcoin Stack Exchange

by Moussa
March 17, 2026
0

hope you doing well. There is my question : after finding my old wallet.dat it appear that I can't find...

Is XRP ‘Mispriced’? Grayscale Analyst Signals Value as Ripple Targets PayFi

by Moussa
March 17, 2026
0

XRP is trading near $1.40, yet a Grayscale-linked analyst argues the asset is fundamentally detached from its real-world value. This...

Bitcoin Hashrate Down 12% From March High As Miners Pull Out

Bitcoin Hashrate Down 12% From March High As Miners Pull Out

by Moussa
March 17, 2026
0

Trusted Editorial content, reviewed by leading industry experts and seasoned editors. Ad Disclosure Data shows the Bitcoin mining Hashrate has...

Ethereum Futures Volume Outruns Spot 6-to-1 As Macro Stress Weighs On Crypto

Ethereum Futures Volume Outruns Spot 6-to-1 As Macro Stress Weighs On Crypto

by Moussa
March 16, 2026
0

Ethereum has reclaimed the $2,200 level as the broader cryptocurrency market shows signs of short-term strength following several weeks of...

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

© 2024 APPROX FOUNDATION - The Crypto Currency News