<p><a href="https://github.com/bitcoin/bips/blob/master/bip-0143.mediawiki" rel="nofollow noreferrer">BIP143</a> implies it is possible per the <a href="https://github.com/bitcoin/bips/blob/master/bip-0143.mediawiki#no-findanddelete" rel="nofollow noreferrer">No FindAndDelete</a> example.</p>
<p>I think the following pseudocode would do it</p>
<pre class="lang-python prettyprint-override"><code>pubkey = get_pubkey(generate_key())
while not verify_sig(signature, pubkey, msg_hash):
  pubkey = get_pubkey(generate_key())
</code></pre>
<p>and as David suggested, I suppose not necessarily identical but equivalent for signature verification purposes.</p>

CC BY-SA 4.0
2023-02-22T23:48:43.773Z
2023-02-22T23:48:43.773Z
jason
<p>It is possible to create <em>a</em> public key from the signature. It will be equivalent to the key used to generate the signature but not necessarily identical.</p>

<p>You can find an example implementation <a href="https://github.com/ScripterRon/BitcoinCore/blob/master/src/main/java/org/ScripterRon/BitcoinCore/ECKey.java#L595-L615" rel="nofollow noreferrer">here</a>.</p>

CC BY-SA 3.0
2017-09-21T22:59:48.600Z
I think you not right
Denis Leonov
CC BY-SA 3.0
2017-09-21T23:14:14.183Z
I guess that's possible. Do you have some reason to think that I'm not right? Or maybe [this link](https://crypto.stackexchange.com/questions/18105/how-does-recovering-the-public-key-from-an-ecdsa-signature-work/18106#18106) will convince you. Or perhaps section 4.1.6 of [this link](http://www.secg.org/sec1-v2.pdf).
David Schwartz
CC BY-SA 3.0
2017-09-22T00:32:47.147Z
proove it please
Denis Leonov
CC BY-SA 3.0
2017-09-22T00:36:42.190Z
Read David's links.
Pieter Wuille
CC BY-SA 3.0
2017-09-22T00:39:57.927Z
so the answer is ... `yes` or `not`?
Denis Leonov
CC BY-SA 3.0
2017-09-22T01:37:36.657Z
Read David's answer.
Pieter Wuille
CC BY-SA 3.0
2017-09-21T21:36:48.920Z
2017-09-21T21:36:48.920Z
David Schwartz
<p>Is it possible to calculate a public key from the message hash and signature?</p>

<blockchain><bitcoin-core><bitcoin-core-development>
Is it possible to calculate a public key from the message hash and signature?
Denis Leonov
# Is it possible to calculate a public key from the message hash and signature?

(Asked by: username_0 on 2017-09-21)

Is it possible to calculate a public key from the message hash and signature?

**Tags:** blockchain, bitcoin-core, bitcoin-core-development


---

## 2 answers

### Answer by username_2 on 2017-09-21. Score: 4 | Accepted answer

It is possible to create *a* public key from the signature. It will be equivalent to the key used to generate the signature but not necessarily identical.

You can find an example implementation [here](https://github.com/ScripterRon/BitcoinCore/blob/master/src/main/java/org/ScripterRon/BitcoinCore/ECKey.java#L595-L615).

> **Comments:**
> **username_0**: I think you not right  
> **username_2**: I guess that's possible. Do you have some reason to think that I'm not right? Or maybe [this link](https://crypto.stackexchange.com/questions/18105/how-does-recovering-the-public-key-from-an-ecdsa-signature-work/18106#18106) will convince you. Or perhaps section 4.1.6 of [this link](http://www.secg.org/sec1-v2.pdf).  
> **username_0**: proove it please  
> **username_3**: Read David's links.  
> **username_0**: so the answer is ... `yes` or `not`?  
> **username_3**: Read David's answer.  

---

### Answer by username_1 on 2023-02-22. Score: 0

BIP143 implies it is possible per the No FindAndDelete example.
I think the following pseudocode would do it
pubkey = get_pubkey(generate_key())
while not verify_sig(signature, pubkey, msg_hash):
  pubkey = get_pubkey(generate_key())

and as David suggested, I suppose not necessarily identical but equivalent for signature verification purposes.


---

