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
In bitcoinjs-lib I can easy using alice.sign(signatureHash) to sign after broadcast. If I convert the signature result for hex string it like this d2ffa12c2191ab1197a318b9c90d2007c66c5157b0a1d0238a4ced93116d3b085d5b20e4c54453d85ca0c747c84f73b3449292456a26d2c8354a24c4b26a5359 it is 64 byte buffer , but If I using bitcoinjs-Message I got like this 1f6407f716337d301b7439ff52e37e829f2d35b51589632e575f203bce9ba4cb526a656faf826a417557753a14b397a8d696520b4dd13cd8e1258ec04e2625ddcb ,when I convert to hex string . it is 65 byte buffer, and then I .slice(1) I got 6407f716337d301b7439ff52e37e829f2d35b51589632e575f203bce9ba4cb526a656faf826a417557753a14b397a8d696520b4dd13cd8e1258ec04e2625ddcb it different.
when I broadcast the .slice(1) result buffer I got error withError: mandatory-script-verify-flag-failed (Non-canonical DER signature)
here is my code
consthashType=bitcoin.Transaction.SIGHASH_ALL;varprivateKey=alice.privateKeyvarmessage='0948924b208d78cdde843cfebf72fdb32f9093f5671b4e09dc8d9371aaa0314f'varderSignature=bitcoinMessage.sign(message,privateKey,alice.compressed)console.log('derSignature',derSignature.toString('hex'))constsignatureHash=redeemTx.hashForSignature(0,lockingScript,hashType);// is 0948924b208d78cdde843cfebf72fdb32f9093f5671b4e09dc8d9371aaa0314fconstsignature_bitcoinjs=bitcoin.script.signature.encode(alice.sign(signatureHash),hashType);constsignature_message=bitcoin.script.signature.encode(derSignature.slice(1),hashType);
Can you tell me what reason and how to fix it ? thank you
The text was updated successfully, but these errors were encountered:
peter-jim
changed the title
Can I using this signature for psbt reedm script?
Can I using this signature for psbt reedem script?
May 6, 2024
In bitcoinjs-lib I can easy using alice.sign(signatureHash) to sign after broadcast. If I convert the signature result for hex string it like this
d2ffa12c2191ab1197a318b9c90d2007c66c5157b0a1d0238a4ced93116d3b085d5b20e4c54453d85ca0c747c84f73b3449292456a26d2c8354a24c4b26a5359
it is 64 byte buffer , but If I using bitcoinjs-Message I got like this1f6407f716337d301b7439ff52e37e829f2d35b51589632e575f203bce9ba4cb526a656faf826a417557753a14b397a8d696520b4dd13cd8e1258ec04e2625ddcb
,when I convert to hex string . it is 65 byte buffer, and then I .slice(1) I got6407f716337d301b7439ff52e37e829f2d35b51589632e575f203bce9ba4cb526a656faf826a417557753a14b397a8d696520b4dd13cd8e1258ec04e2625ddcb
it different.when I broadcast the .slice(1) result buffer I got error with
Error: mandatory-script-verify-flag-failed (Non-canonical DER signature)
here is my code
Can you tell me what reason and how to fix it ? thank you
The text was updated successfully, but these errors were encountered: