Closed tre-dev closed 1 year ago
Hi.
Not interested in debugging this. You should switch fully to noble instead of using legacy libraries and compat layers. Our extraEntropy is fully compatible with C libsecp256k1 BTC, for example.
Hey, I'm actually only using noble libraries for hashing. Was setting up a clean example and was able to fix it. Thought I tried that before, but maybe something else was the problem when I did that. Anyway, here's the fix in my code:
const h = hash.sha256(new Uint8Array([...message, ...a]));
const { signature, recid } = ecdsaSign(message, key, h);
OT question: the code is still relying on ByteBuffer. (bytebuffer.js) Do you have any thoughts on how to best replace it?
bytebuffer is basically uint8array with a few fancy methods. replace those methods and that should be it.
I'm trying to replace the
secp256k1
npm package (v3) with this one, but am running into issues where the signSync result is different.Original code:
(link to code repo: https://gitlab.syncad.com/hive/dhive/-/blob/master/src/crypto.ts#L266-280)
Noble code:
I took the ecdsaSign function from your ethereum-js lib and modified it to fit my use-case. But my guess is that the extraEntropy is handled different within
secp256k1
. Below is the code that handles the nouncefn & extraData.https://github.com/cryptocoinjs/secp256k1-node/blob/v3.x/lib/js/index.js#L140-L175
Please let me know if the provided code is enough for you to debug this. Thank you!