0

I know my Ethereum address, my Metamask wallet will give it to me, and I can run :

web3.eth.coinbase

But I want to know what my public key is.
Is there any way I can find that ?

(the reason I want to know a public key because I believe I need it to verify if a particular signed message was truely signed by that key)

  • If the message signature includes the v value (in addition to r and s)—which is the norm for signatures in Ethereum—then you can recover the public key, hash it to get the address, and see if the address matches. (You don't need to know the public key in advance.) – smarx Feb 23 '18 at 3:23
  • programtheblockchain.com/posts/2018/02/17/… may help. – smarx Feb 23 '18 at 3:30
0

I know it's been a while, but this should work https://web3js.readthedocs.io/en/1.0/web3-eth-accounts.html#privatekeytoaccount

  • You can use recover to verify a signed message. But otherwise the public key is not exposed by web3. – Ismael Jun 21 at 4:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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