You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There is a scenario where the signature produced by bitcoin-lib is different than the one made by bitcoin-core, it's a legacy multisig (P2SH) with 2-of-2 signatures required. For clarity i reproduced the issue in bitcoin using regtest mode and comparing the produced scriptSig with the one from bitcoin-lib,
the example is located here, to run the test:
$ test/functional/regtest_signature.py
The test in bitcoin-lib tries to sign the same input of the same transaction (also with same private keys)
and results in a mismatch of the signature (specifically the last in the 2-of-2), this is located here.This test shows that the signature script (for legacy p2sh multisig) produced in this case is different from the one made by bitcoin-core. I also added sighash tests (both in bitcoin-core and bitcoin-lib) to check that we're signing the same data, those test can be found in the same git branch of the above examples.
The text was updated successfully, but these errors were encountered:
Bitcoin-lib still creates valid signatures, but they may be different from the ones created by bitcoin core since bitcoin/bitcoin@18dfea0.
AFAICT none of the reference tests depend on creating exactly the same sigs and will still pass, but I guess that in some cases in may make the life of lib developers a bit harder. Reproducing exactly the same behaviour is not so easy yet because first the JNI bindings for libsecp256k1 would have to be updated, so I'll leave this issue open in case someone wonders why our sigs may be different from core's. Thanks for the test data!
sstone
changed the title
Signing P2SH input produces different signatures from bitcoin-core
Bitcoin-lib may produce valid but different signatures from bitcoin-core
Oct 12, 2018
There is a scenario where the signature produced by bitcoin-lib is different than the one made by bitcoin-core, it's a legacy multisig (P2SH) with 2-of-2 signatures required. For clarity i reproduced the issue in bitcoin using regtest mode and comparing the produced scriptSig with the one from bitcoin-lib,
the example is located here, to run the test:
The test in bitcoin-lib tries to sign the same input of the same transaction (also with same private keys)
and results in a mismatch of the signature (specifically the last in the 2-of-2), this is located here.This test shows that the signature script (for legacy p2sh multisig) produced in this case is different from the one made by bitcoin-core. I also added sighash tests (both in bitcoin-core and bitcoin-lib) to check that we're signing the same data, those test can be found in the same git branch of the above examples.
The text was updated successfully, but these errors were encountered: