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
Apparently embit v0.8.0 produces incorrect signatures in Taproot transactions with a non-standard sighash.
The following script reproduces the issue. The unsigned PSBT has been prepared in Sparrow with SINGLE|ANYONECANPAY. We call sign_with() passing None as the sighash argument, so that the sighash defined in the psbt data is the one taken into account.
frombase64importb64decodefromembit.bip32importHDKeyfromembit.psbtimportPSBT# tprv of "aim" x12 in testnet/signetmaster_private_key='tprv8ZgxMBicQKsPf7HFb4WqgmtZCLyuWp3qdDDMngGZUcVLK27uovLZmq87VQRzmRLNGGfuv9MmbrfDfFqYWN9UC4jU9yFPFBKznKtjJXAp6zB'unsigned_psbt_base64='cHNidP8BAF4CAAAAARfCyWIG/NiHOFrFkb34/tlVFc/N0wVIGQzWQrx0j2pLAAAAAAD9////AbBjzR0AAAAAIlEgl3d2EP+VhSPaLqFAcO3gOmaApwdP0ulTfjbhZnQkGpZNPgAATwEENYfPA6fJqKyAAAAANFK5sPQqTwnjADO2lv7oWYdTo0CWEwxtTtGDWvPUiMsD1hM7Pe2Gzg01QefANL7alLQYwxsmeyTFfH/TlstresUQnRILGVYAAIABAACAAAAAgAABAF4CAAAAARIkR5wC2SeGdLpgweIuxsxD3wICJsUWtJ3T1ZIrxsyjAAAAAAACAAAAASBkzR0AAAAAIlEg0vcpFkr36+uyRermS3owVW2WZAoX2RxiCnLL4jFfaCUAAAAAAQErIGTNHQAAAAAiUSDS9ykWSvfr67JF6uZLejBVbZZkChfZHGIKcsviMV9oJQEDBIMAAAAhFmNl9RJbp6Iz+FwX7WJG3TcKWmrvBr1tvpdVJ9n6XGUTGQCdEgsZVgAAgAEAAIAAAACAAAAAAAIAAAABFyBjZfUSW6eiM/hcF+1iRt03Clpq7wa9bb6XVSfZ+lxlEwAhByx1NQ1R+Sx4GcdHzkgnsRJh7SapmaqPBXiewFXgL3RdGQCdEgsZVgAAgAEAAIAAAACAAAAAAAMAAAABBSAsdTUNUfkseBnHR85IJ7ESYe0mqZmqjwV4nsBV4C90XQA='xkey=HDKey.from_base58(master_private_key)
unsigned_psbt_raw=b64decode(unsigned_psbt_base64)
psbt=PSBT.parse(unsigned_psbt_raw)
sigs=psbt.sign_with(xkey, None)
print(sigs)
print(psbt.to_base64())
Bitcoin Core is able to run finalizepsbt on that result, but attempting to broadcast the final transaction with sendrawtransaction results in this error:
If the seed is loaded in a Sparrow wallet, Sparrow is able to sign that same PSBT and broadcast the final transaction. Comparing both final transactions can be seen that Sparrow and embit do not produce the same result byte per byte in the signature section of the transaction, and I believe these should be identical. In both cases the signature fields are 65 bytes long instead of the usual 64, and their last byte is the correct value 83 for SINGLE|ANYONECANPAY.
These are the two transactions side by side. The first one is Sparrow (broadcastable), the second one Embit's.
The tests have been carried out in a custom signet network. If you want to run the exact same tests you need to connect Sparrow in signet mode to the ssl://electrum.bitcoinbarcelona.xyz:60602 electrum server. An explorer is available.
The text was updated successfully, but these errors were encountered:
Apparently embit v0.8.0 produces incorrect signatures in Taproot transactions with a non-standard sighash.
The following script reproduces the issue. The unsigned PSBT has been prepared in Sparrow with SINGLE|ANYONECANPAY. We call sign_with() passing
None
as thesighash
argument, so that the sighash defined in the psbt data is the one taken into account.Output:
Bitcoin Core is able to run
finalizepsbt
on that result, but attempting to broadcast the final transaction withsendrawtransaction
results in this error:If the seed is loaded in a Sparrow wallet, Sparrow is able to sign that same PSBT and broadcast the final transaction. Comparing both final transactions can be seen that Sparrow and embit do not produce the same result byte per byte in the signature section of the transaction, and I believe these should be identical. In both cases the signature fields are 65 bytes long instead of the usual 64, and their last byte is the correct value
83
for SINGLE|ANYONECANPAY.These are the two transactions side by side. The first one is Sparrow (broadcastable), the second one Embit's.
The tests have been carried out in a custom signet network. If you want to run the exact same tests you need to connect Sparrow in signet mode to the
ssl://electrum.bitcoinbarcelona.xyz:60602
electrum server. An explorer is available.The text was updated successfully, but these errors were encountered: