-
Notifications
You must be signed in to change notification settings - Fork 754
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Util: Add support for EIP-1559 in ecsign() method #1597
Comments
Hi, you are right that Please take a look at our EIP1559 transaction as well to see how we use this. |
@jochem-brouwer we thought of doing that thanks! |
Out of interest: for what reason would you like to use ecsign directly? For production purposes this usually uses our library and not the utility library (which is low/mid level) directly. I agree the interface should be enhanced, but I am really wondering about a practical purpose of this feature. |
Can you provide the link to the other library? Maybe I don't know there was an alternative for production. |
See also my comment here: #1607 (comment) If you want, you can also just use the ethereum-cryptography library directly, please double check but the code in your case should be as simple as: import { ecdsaSign } from 'ethereum-cryptography/secp256k1'
const { signature, recid: v } = ecdsaSign(msgHash, privateKey)
const r = Buffer.from(signature.slice(0, 32))
const s = Buffer.from(signature.slice(32, 64)) (maybe usage is also a bit simpler, in doubt have a closer look and experiment a bit with the |
@holgerd77 so if we work with legacy tx we have to add 27 to |
@jonathansmirnoff ah, you do also want to work with legacy txs and the like? Then it might be better if you do use the Util library, and then for now just subtract 27 for the typed tx cases until we have a bit cleaner version of this released |
For EIP-1559, the signature v value is now a simple parity bit ("signature Y parity"), which is either 0 or 1, depending on which point on the elliptic curve should be used.
The
ecsign
does not support EIP-1559 because the it never returns the corresponding v value.The text was updated successfully, but these errors were encountered: