There is a difference between the nodejs bitcoinjs signature text information and the python-bitcoin-utils signature text information
The final length of the nodejs signature is 128 bits, why is the final length of the python-bitcoin-utils signature 130 bits? What causes this difference?
Hi @wyq000 ,
The sizes of valid signatures can vary, even for the same txs. Are the txs you are comparing legacy or segwit/toproot?
Also, I always use bitcoin-core as reference (other libraries typically to the same). Iirc, there is only one case that bitcoin-utils' library produces different (valid!) signatures than bitcoin-core.
I could try to check this further if you provide the tx for me to check.
Yes, I am using bitcoinjs for testing.this is my code var mnemonic = "mnemonic xxxx"; var seed = bip39.mnemonicToSeedSync(mnemonic); var network = bitcoin.networks.testnet; bitcoin.initEccLib(ecc);
var root = bip32.fromSeed(seed, network); var account = root.derivePath("m/84'/1'/0'"); var keyPair = account; var message = ''; var messageHash = bitcoin.crypto.sha256(Buffer.from(message)); console.log("Signature: ",keyPair.sign(messageHash).toString('hex')); keyPair.sign keyPair.sign has a length of 128
Hi @wyq000 ,
Just back from holidays.
I need the signature as generated from bitcoin-utils and bitcoin-core. This is because bitcoin core is the only reference that I can use. E.g. I can investigate further if the signatures bitcoin-utils produces is different that bitcoin core.