<p>Unfortunately if we want to keep the software performant, we simply can't be implementing new logic that is expensive and we are absolutely certain will never be used. Your concern would be better placed elsewhere in software safety, reliability or operational security than in situations which we simply know are impossible.</p>

CC BY-SA 4.0
2021-02-24T08:58:00.687Z
2021-02-24T08:58:00.687Z
Claris
<p>You have pretty much answered your own question.</p>
<p>Yes, such a check would be possible, but it would have a cost (need a database lookup, at least). That cost isn't worth it, because the risk of actually finding an address that has been created by someone else before is so utterly mindbogglingly small - it just won't ever happen.</p>
<p>Furthermore, even if such a check would be done, it would have severe limitations:</p>
<ul>
<li>Only full nodes (which have access to their own unspent coin list) could do it directly; other wallets would need to query another service, which is inherently a privacy risk.</li>
<li>Hardware wallets are obviously unable to do this at all, as by definition they cannot access the internet.</li>
<li>Even on full nodes, generally no by-address index exists of the unspent coins list; only a list optimized for access by created-by-txid. Since it's an <em>unspent</em> coins list, it cannot account for addresses that were used in the past but don't currently have any coins assigned to them.</li>
<li>Even ignoring all that, such a check can only account for addresses that have actually been used. There are probably far more addresses created (and thus someone already has the key for) than have ever been sent to.</li>
</ul>

CC BY-SA 4.0
2021-02-24T08:56:43.993Z
2021-02-24T08:56:43.993Z
Pieter Wuille
<p>This may be a bad question, but I am just getting started and you have to start somewhere.</p>
<p>I have seen it discussed that generating the same public key as someone else is theoretically possible but has such a low probability that we don’t need to think about what would happen if this event occurred. I am content with this.</p>
<p>But, if I go and create a public key tomorrow (which I understand to be a completely offline thing) it seems that it could be simple to at least check and see if that public key has ever been used in a transaction before. I believe I have read that nodes keep a list of public keys with unspent Bitcoin for quick verification in processing transactions, this could theoretically be used for the check I describe. This would make me feel more certain that at that time I do indeed have a public key distinct from all other public keys (the only possibility being that someone might have that same public key, but has never received Bitcoin).</p>
<p>So I understand the probability is horrendously low, I’m not concerned about it actually happening, I just want to understand in a theoretical since but if that check would be simple enough to to perform as a just in case. Is such a check possible?</p>

<public-key>
Public Key in Use Verification
Prince M
# Public Key in Use Verification

(Asked by: username_0 on 2021-02-24)

This may be a bad question, but I am just getting started and you have to start somewhere.

I have seen it discussed that generating the same public key as someone else is theoretically possible but has such a low probability that we don’t need to think about what would happen if this event occurred. I am content with this.

But, if I go and create a public key tomorrow (which I understand to be a completely offline thing) it seems that it could be simple to at least check and see if that public key has ever been used in a transaction before. I believe I have read that nodes keep a list of public keys with unspent Bitcoin for quick verification in processing transactions, this could theoretically be used for the check I describe. This would make me feel more certain that at that time I do indeed have a public key distinct from all other public keys (the only possibility being that someone might have that same public key, but has never received Bitcoin).

So I understand the probability is horrendously low, I’m not concerned about it actually happening, I just want to understand in a theoretical since but if that check would be simple enough to to perform as a just in case. Is such a check possible?

**Tags:** public-key


---

## 2 answers

### Answer by username_2 on 2021-02-24. Score: 4 | Accepted answer

You have pretty much answered your own question.

Yes, such a check would be possible, but it would have a cost (need a database lookup, at least). That cost isn't worth it, because the risk of actually finding an address that has been created by someone else before is so utterly mindbogglingly small - it just won't ever happen.

Furthermore, even if such a check would be done, it would have severe limitations:

* Only full nodes (which have access to their own unspent coin list) could do it directly; other wallets would need to query another service, which is inherently a privacy risk.
* Hardware wallets are obviously unable to do this at all, as by definition they cannot access the internet.
* Even on full nodes, generally no by-address index exists of the unspent coins list; only a list optimized for access by created-by-txid. Since it's an *unspent* coins list, it cannot account for addresses that were used in the past but don't currently have any coins assigned to them.
* Even ignoring all that, such a check can only account for addresses that have actually been used. There are probably far more addresses created (and thus someone already has the key for) than have ever been sent to.


---

### Answer by username_1 on 2021-02-24. Score: 1

Unfortunately if we want to keep the software performant, we simply can't be implementing new logic that is expensive and we are absolutely certain will never be used. Your concern would be better placed elsewhere in software safety, reliability or operational security than in situations which we simply know are impossible.


---

