This question already has an answer here:

How is it possible for wallets like MetaMask or libraries like web3js to find public key by only providing private key? AFAIK this is not possible generally in elliptic curve.

marked as duplicate by Ismael, Richard Horrocks, Community Feb 14 '18 at 8:27

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.


AFAIK this is not possible generally in elliptic curve.

In elliptic-curve cryptography, the public key is derived from the private key, not the other way round. The clue is in the name: the private key is the thing you need to keep secret (or share with something you are sure you can trust, like Metamask).

See this graphical representation of how Ethereum uses EC cryptography to create a public key (and subsequently an address) from a private key.


Here is some math behind it:

P = G ⋅ K


  • G - some basic point with two coordinates

Gx = 55066263022277343669578718895168534326250603453777594175500187360389116729240
Gy = 32670510020758816978083085130507043184471273380659243275938904335757337482424
G = (Gx, Gy)

  • K - private key

  • P - public key

After multiplication you will have two coordinates of public key which later should be aligned to 32 byte sets and concatenated.

There is example of implementation of this algorithm in ethereum/py_ecc. Have a look.

  • Can you explain your magic numbers for Gx and Gy? Or, if you know fully how ECDSA works with secp256k1, can you update your answer to be fully complete (i.e., add the curve parameters) and add the Keccak256 hashing for the final address? – hakusaro Feb 12 '18 at 22:40

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