bitcoin-core / btcdeb

Bitcoin Script Debugger

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Same Transaction, different result

Barno opened this issue · comments

commented

Hi,
I'm playing with btcdeb and I want to analyze my transaction to understand malleability.

The signature is ok because it is confirmed on blockchain

Now I want to debug the transaction.
If I use tx and txid the result is 01.
btcdeb --tx=02000000016d0bafbe058c16f8a66ed330d7218aa566fb39efa18d870faa99d365907e543a000000006c52754730440220192b64bb3952c144ead43fdb5286007388785d81fd90ecedfba8bf7a5ea0a1ad02205891ceb16a793adad74497ee5f4a3eb42f6a6e4e1602b540f434e711a7d3521b012102ab74ff5864c29ab400030afc05a7c141c4970707fef9dbb0ac24115867c987a5ffffffff01a0bb0d00000000001976a914aec36b59e621343037fd7a4f97f46995cf0533cc88ac00000000 --txin=010000000001014c972deb5303774560bbb47689ffc9591421b293abcac73e6524764fb8f0e8dd0100000000f0ffffff0340420f00000000001976a914ccbdfc0f1e5fc51e01d50c9ebc37ca7c323c05b588ac0a302b00000000001600149ff604fed7c5c4b7929bc4ec67d4ce3a10f562b10000000000000000196a1768747470733a2f2f746274632e6269746170732e636f6d024730440220695be41f6396687fbfe8395a5e562e483c30fa272ca8198df6a5c444f930edff02206f251a96e926cd8a22d21f784be855e1ae38ff345223fd2e3202c4d86fcab2c0012102099ad04f4be7b2883e0a32d50250b48282db2bf918a464b4bbe39ebf3b86d94d00000000

If I use
btcdeb '[OP_2 OP_DROP 30440220192b64bb3952c144ead43fdb5286007388785d81fd90ecedfba8bf7a5ea0a1ad02205891ceb16a793adad74497ee5f4a3eb42f6a6e4e1602b540f434e711a7d3521b01 02ab74ff5864c29ab400030afc05a7c141c4970707fef9dbb0ac24115867c987a5 OP_DUP OP_HASH160 ccbdfc0f1e5fc51e01d50c9ebc37ca7c323c05b5 OP_EQUALVERIFY OP_CHECKSIG]'

I get this alert

Signature must be zero for failed CHECK(MULTI)SIG operation (is this a historical transaction from before NULLFAIL enforcement? Try with --modify-flags=-NULLFAIL)

I tried with that flag and the final result is 0x

@Barno The reason why it fails is because it does not have the necessary data to evaluate the signature. It requires the input transaction and the transaction itself in order to generate the signature hash.

commented

@kallewoof thanks for reply.
Both script have the same parameters. Even the stack is the same if I compare.
The signature, the public key and the UTXO are the same.
Just one different <<< scriptPubKey >>>
image

I can check the OP_CHECKSIG only with tx= ?

The signature check can only happen if btcdeb also has the transaction data, which it doesn't for the right case (it only has the script containing the signature and pubkey, not the input -- it literally has no way of checking whether the signature is valid or not).

commented

Ok I understand, btcdeb check the signature against Public key and "message".
thanks again :)