3

I need to find the public key of a list of Ethereum addresses. Is it possible to do this only with the transaction hash of one of their transactions? Per Get public key of any ethereum account the v, r and s values of the signature when a transaction is sent is also required. Using web3.eth.getTransactionReceipt for example doesn't bring back this information.

ZhouW
  • 1,348
  • 2
  • 18
  • 35

1 Answers1

5

Without a signature, there's no way to get the public key (short of someone giving it to you). So for an address that has never made a transaction, this can't be done.

(I'm not sure where getTransactionReceipt comes in. If you're calling that, then surely the account has made a transaction, so you can recover the public key.)

user19510
  • 27,999
  • 2
  • 30
  • 48
  • These would be for addresses that have made a transaction somewhere at some point (so I could find a transaction hash to look at for them) but I don't know how to get the v, r and s value for any transaction which seems to be required for finding the public key. Of course using web3.eth.sign returns v, r and s values but these accounts wouldn't be interacting with my website, I only have already-existing publicly viewable transactions to work with. – ZhouW Mar 11 '18 at 06:49
  • eth_getTransactionByHash will give you the v, r, and s values for a transaction. – user19510 Mar 11 '18 at 06:51
  • (That's web3.eth.getTransaction if you're using web3.js.) – user19510 Mar 11 '18 at 06:52
  • thanks - the docs at https://github.com/ethereum/wiki/wiki/JavaScript-API#web3ethgettransaction don't mention that as bringing back v, r and s values – ZhouW Mar 11 '18 at 07:02