Closed mrx23dot closed 1 year ago
same transaction created with different lib, but verify still fails
020000000001014596dde147995ae7485eba2ac365df99a67ab75f81990e4cc1163471cd5659950000000000ffffffff0175070000000000001976a9146f303d16fc6680f171c087a7d41b6bdf215aee5e88ac024730440220475ef700c502af5c4e2d4bf6776997fb4adb7ff509991415fa42e343b09616220220464d1db3ca6b48f8fe01af37dfeedee629ba4d48d7710bea002a803620d52196012102f629179b2a08f930ec72d5909b5c4b8a6d18e88fdb473d040abfa90cc81745aa00000000
The raw transaction does not contain the value of the input, which is needed to verify it. To fix it try:
rawtx = '020000000001014596dde147995ae7485eba2ac365df99a67ab75f81990e4cc1163471cd5659950000000000ffffffff0175070000000000001976a9146f303d16fc6680f171c087a7d41b6bdf215aee5e88ac024730440220475ef700c502af5c4e2d4bf6776997fb4adb7ff509991415fa42e343b09616220220464d1db3ca6b48f8fe01af37dfeedee629ba4d48d7710bea002a803620d52196012102f629179b2a08f930ec72d5909b5c4b8a6d18e88fdb473d040abfa90cc81745aa00000000'
t = Transaction.parse(rawtx)
t.inputs[0].value = 2115
t.verify()
t.info()
I see your point, but this was a valid transaction accepted by the chain https://mempool.space/tx/ce8419aa2a9d29a7965cf44645a535d6f5c37ee28ea933c5f60bfb38ef888826?showFlow=false#flow
raw hex: 020000000001014596dde147995ae7485eba2ac365df99a67ab75f81990e4cc1163471cd5659950000000000ffffffff0175070000000000001976a9146f303d16fc6680f171c087a7d41b6bdf215aee5e88ac024730440220475ef700c502af5c4e2d4bf6776997fb4adb7ff509991415fa42e343b09616220220464d1db3ca6b48f8fe01af37dfeedee629ba4d48d7710bea002a803620d52196012102f629179b2a08f930ec72d5909b5c4b8a6d18e88fdb473d040abfa90cc81745aa00000000
so it must know that the input was: 0.00002115 BTC
and output was: 0.00001909 BTC
Also why does it say that it's not signed?
Inputs
Or does it need the witness data for these?
The witness data is included but the input value is not included in the raw transaction hash, so to verify the transaction any client needs to look at the preceding transactions.
I have created this segwit transaction https://coinb.in/#verify accepts it, but this lib doesn't:
at least it could give reason.