<blockquote>
  <p>What if by accidently, prefix is set 0x05, then the address prefix becomes 3, which becomes a p2sh address. </p>
</blockquote>

<p>Then coins sent to that address would be lost forever.</p>

<blockquote>
  <p>would I am able to spent the balance provided that I own the private key? </p>
</blockquote>

<p>No because the semantics for verifying a spend of a P2SH output are different from those for P2PKH outputs. The private key that you have is unrelated to the P2SH output.</p>

<blockquote>
  <p>Is there a way to sign this kind of script?</p>
</blockquote>

<p>No. The public key would be interpreted as a script itself, not as a public key. So the private key you have for that would be useless. You would have to satisfy whatever script the bytes of the public key represents. This is likely to just be garbage and be a script that cannot actually execute.</p>

CC BY-SA 4.0
2018-09-13T15:12:41.760Z
2018-09-13T15:12:41.760Z
Ava Chow
<p>Normally, <code>p2pkh</code> address is generate by <code>Base58(Prefix+ PublicKeyHash + Checksum)</code>, and prefix is set 0x00.  </p>

<p>What if by accidently, prefix is set 0x05, then the address prefix becomes 3, which becomes a <code>p2sh</code> address.  </p>

<p>And unfortunately some btc already sends to the 3 prefixed address, would I am able to spent the balance provided that I own the private key?  </p>

<p>The very bad thing here is that I created a too special type pay to script:<br>
to be specific, <code>&lt;OP_HASH160&gt; &lt;ScriptHash&gt; &lt;OP_EQUAL&gt;</code> the <code>ScriptHash</code> is <code>hash160(public key)</code>. Is there a way to sign this kind of script?</p>

<transactions><signature><p2sh>
Retrieve money back from wrong prefix address
xuanzhui
# Retrieve money back from wrong prefix address

(Asked by: username_0 on 2018-09-13)

Normally, `p2pkh` address is generate by `Base58(Prefix+ PublicKeyHash + Checksum)`, and prefix is set 0x00.

What if by accidently, prefix is set 0x05, then the address prefix becomes 3, which becomes a `p2sh` address.

And unfortunately some btc already sends to the 3 prefixed address, would I am able to spent the balance provided that I own the private key?

The very bad thing here is that I created a too special type pay to script:  
to be specific, `<OP_HASH160> <ScriptHash> <OP_EQUAL>` the `ScriptHash` is `hash160(public key)`. Is there a way to sign this kind of script?

**Tags:** transactions, signature, p2sh


---

## 1 answers

### Answer by username_1 on 2018-09-13. Score: 2 | Accepted answer

> What if by accidently, prefix is set 0x05, then the address prefix becomes 3, which becomes a p2sh address.

Then coins sent to that address would be lost forever.

> would I am able to spent the balance provided that I own the private key?

No because the semantics for verifying a spend of a P2SH output are different from those for P2PKH outputs. The private key that you have is unrelated to the P2SH output.

> Is there a way to sign this kind of script?

No. The public key would be interpreted as a script itself, not as a public key. So the private key you have for that would be useless. You would have to satisfy whatever script the bytes of the public key represents. This is likely to just be garbage and be a script that cannot actually execute.


---

