0

I have tried several ~2-4 year-old answers for this question, but none of them work right now. My question is simple: how can I get get the sender's public key from a signed transaction object such as those gotten from Quicknode or Alchemy responses({nonce, gasLimit, r, s, v, data, value...}). Hopefully with Ethers library for javascript?.

I have tried with the \x19Ethereum Signed Message:\n prefix and without it, but not sure if this prefix still applies (August 2022).

I am going craaaazy. Any help would be really appreciated.

0

1 Answer 1

1

For this task I would suggest referring to Ether.js documentation https://docs.ethers.io/v4/api-utils.html#elliptic-curve

The function you are looking for is recoverPublicKey ( digest , signature ) which uses ecrecover to give you the public key used to sign a transaction. The digest will be the transaction signature hash you get from Quicknode/Alchemy. The signature will be the r + s + v values you receive from the same.

EDIT: Digest will be provided in the signed transaction data.

Not the answer you're looking for? Browse other questions tagged or ask your own question.