<p>I'm afraid you have a bug in your mining software, and your coins are gone.</p>

<p>Instead of sending to the P2SH address, a block was created with a P2PKH output script, reinterpreting the script hash from the P2SH address as a public key hash. This happens somewhere in broken software that doesn't support P2SH and additionally also fails to check the address version byte.</p>

<p>If this is the case, it is unrecoverable and those coins are lost forever. You can't find a public key whose hash matches that script.</p>

CC BY-SA 4.0
2018-08-29T22:38:31.817Z
2018-08-29T22:38:31.817Z
Pieter Wuille
<p><strong>The situation</strong></p>

<p>Hello. Our company running BTC pool. We've been mining BTC for a while and used segwit address <code>32Z3eXSPgxcHj2fnQy8d6dg66eVtZfxrBM</code> as pool adress.</p>

<p>But when we finally found a first block (actually - two blocks) for some reason block reward got sent to different address:<code>1s2iywx94HudryMHsU2g1K9x8DB1cahGc</code></p>

<p>Here are links for both generation transactions with rewards: <a href="https://btc.com/12a1910bbc1fd95410045e86fecf90a601d1c9c93ea338e884e7188cdb54a3d4" rel="nofollow noreferrer">the first</a> and 
 <a href="https://btc.com/820734a13f155105d16d46f939ec7e61f0172c1e4857a9ff6346233ff35beafc" rel="nofollow noreferrer">the second</a></p>

<p><strong>The problem</strong></p>

<p>We cannot get access to funds on <code>1s2iywx94HudryMHsU2g1K9x8DB1cahGc</code> - we simple can't see that balance on the wallet.</p>

<p><strong>The question</strong></p>

<p>How can we access those funds on <code>1s2iywx94HudryMHsU2g1K9x8DB1cahGc</code>?</p>

<p><strong>More info</strong></p>

<p>Using <a href="https://bitcoincore.org/en/about/" rel="nofollow noreferrer">Bitcoin Core</a> client command <code>validateaddress</code> we can inspect both addresses:</p>

<p>Output for <code>32Z3eXSPgxcHj2fnQy8d6dg66eVtZfxrBM</code> is </p>

<pre><code>{
  "isvalid": true,
  "address": "32Z3eXSPgxcHj2fnQy8d6dg66eVtZfxrBM",
  "scriptPubKey": "a91409763cb05dcea0f98f53b0f08651f92c5d2d2f3887",
  "ismine": true,
  "iswatchonly": false,
  "isscript": true,
  "iswitness": false,
  "script": "witness_v0_keyhash",
  "hex": "00142ee67d879ccf17daec87b4ed4a6cecdd9b3f64a0",
  "pubkey": "02835613e6e22843ce7dafc5d22a2763a8428b81f3d44dced0fd860f08be7a29df",
  "embedded": {
    "isscript": false,
    "iswitness": true,
    "witness_version": 0,
    "witness_program": "2ee67d879ccf17daec87b4ed4a6cecdd9b3f64a0",
    "pubkey": "02835613e6e22843ce7dafc5d22a2763a8428b81f3d44dced0fd860f08be7a29df",
    "address": "bc1q9mn8mpuueuta4my8knk55m8vmkdn7e9qmezkgv",
    "scriptPubKey": "00142ee67d879ccf17daec87b4ed4a6cecdd9b3f64a0"
  },
  "addresses": [
    "bc1q9mn8mpuueuta4my8knk55m8vmkdn7e9qmezkgv"
  ],
  "account": "",
  "timestamp": 1533473707,
  "hdkeypath": "m/0'/0'/0'",
  "hdmasterkeyid": "35e9670da1b28efe5621eb9cee2cf3e88b929968"
}
</code></pre>

<p>Output for <code>1s2iywx94HudryMHsU2g1K9x8DB1cahGc</code> is</p>

<pre><code>{
"isvalid": true,
"address": "1s2iywx94HudryMHsU2g1K9x8DB1cahGc",
"scriptPubKey": "76a91409763cb05dcea0f98f53b0f08651f92c5d2d2f3888ac",
"ismine": false,
"iswatchonly": false,
"isscript": false,
"iswitness": false
}
</code></pre>

<p>I can see three interesting points here:</p>

<ol>
<li><code>scriptPubKey</code> for both addresses contains <code>09763cb05dcea0f98f53b0f08651f92c5d2d2f38</code> part, which is, afaik, actuall public key. First byte differs, which makes sense, since it's prefix, 00 for legacy and 05 for segwit respectively.</li>
</ol>

<p>regarding output for <code>1s2iywx94HudryMHsU2g1K9x8DB1cahGc</code> :</p>

<ol start="2">
<li><p><code>pubkey</code> property is missing, which is weird, because usually its included for legacy addresses</p></li>
<li><p><code>isMine</code> property equals false, wich means that wallet does not recognize this address relation to wallet PK.</p></li>
</ol>

<p><strong>So, can anyone please provide some insight and tell us if (and how?) we can access those funds, or we've lost them for good?</strong></p>

<p><strong>P.S.</strong></p>

<p>When I use base58 decode on both <code>32Z3eXSPgxcHj2fnQy8d6dg66eVtZfxrBM</code> and <code>1s2iywx94HudryMHsU2g1K9x8DB1cahGc</code> I get </p>

<p><code>0509763CB05DCEA0F98F53B0F08651F92C5D2D2F385CCEC0F4</code> and </p>

<p><code>0009763CB05DCEA0F98F53B0F08651F92C5D2D2F3861372301</code> respectively.</p>

<p>Again, you can clearly see same bytes, so addresses are definitely related.</p>

<bitcoin-core><blockchain><segregated-witness><p2sh><p2pkh>
Access funds on legacy address related to segwit address from which I have private key
user3166379
# Access funds on legacy address related to segwit address from which I have private key

(Asked by: username_0 on 2018-08-29)

**The situation**

Hello. Our company running BTC pool. We've been mining BTC for a while and used segwit address `32Z3eXSPgxcHj2fnQy8d6dg66eVtZfxrBM` as pool adress.

But when we finally found a first block (actually - two blocks) for some reason block reward got sent to different address:`1s2iywx94HudryMHsU2g1K9x8DB1cahGc`

Here are links for both generation transactions with rewards: [the first](https://btc.com/12a1910bbc1fd95410045e86fecf90a601d1c9c93ea338e884e7188cdb54a3d4) and
[the second](https://btc.com/820734a13f155105d16d46f939ec7e61f0172c1e4857a9ff6346233ff35beafc)

**The problem**

We cannot get access to funds on `1s2iywx94HudryMHsU2g1K9x8DB1cahGc` - we simple can't see that balance on the wallet.

**The question**

How can we access those funds on `1s2iywx94HudryMHsU2g1K9x8DB1cahGc`?

**More info**

Using [Bitcoin Core](https://bitcoincore.org/en/about/) client command `validateaddress` we can inspect both addresses:

Output for `32Z3eXSPgxcHj2fnQy8d6dg66eVtZfxrBM` is

```
{
  "isvalid": true,
  "address": "32Z3eXSPgxcHj2fnQy8d6dg66eVtZfxrBM",
  "scriptPubKey": "a91409763cb05dcea0f98f53b0f08651f92c5d2d2f3887",
  "ismine": true,
  "iswatchonly": false,
  "isscript": true,
  "iswitness": false,
  "script": "witness_v0_keyhash",
  "hex": "00142ee67d879ccf17daec87b4ed4a6cecdd9b3f64a0",
  "pubkey": "02835613e6e22843ce7dafc5d22a2763a8428b81f3d44dced0fd860f08be7a29df",
  "embedded": {
    "isscript": false,
    "iswitness": true,
    "witness_version": 0,
    "witness_program": "2ee67d879ccf17daec87b4ed4a6cecdd9b3f64a0",
    "pubkey": "02835613e6e22843ce7dafc5d22a2763a8428b81f3d44dced0fd860f08be7a29df",
    "address": "bc1q9mn8mpuueuta4my8knk55m8vmkdn7e9qmezkgv",
    "scriptPubKey": "00142ee67d879ccf17daec87b4ed4a6cecdd9b3f64a0"
  },
  "addresses": [
    "bc1q9mn8mpuueuta4my8knk55m8vmkdn7e9qmezkgv"
  ],
  "account": "",
  "timestamp": 1533473707,
  "hdkeypath": "m/0'/0'/0'",
  "hdmasterkeyid": "35e9670da1b28efe5621eb9cee2cf3e88b929968"
}

```

Output for `1s2iywx94HudryMHsU2g1K9x8DB1cahGc` is

```
{
"isvalid": true,
"address": "1s2iywx94HudryMHsU2g1K9x8DB1cahGc",
"scriptPubKey": "76a91409763cb05dcea0f98f53b0f08651f92c5d2d2f3888ac",
"ismine": false,
"iswatchonly": false,
"isscript": false,
"iswitness": false
}

```

I can see three interesting points here:

1. `scriptPubKey` for both addresses contains `09763cb05dcea0f98f53b0f08651f92c5d2d2f38` part, which is, afaik, actuall public key. First byte differs, which makes sense, since it's prefix, 00 for legacy and 05 for segwit respectively.

regarding output for `1s2iywx94HudryMHsU2g1K9x8DB1cahGc` :

2. `pubkey` property is missing, which is weird, because usually its included for legacy addresses
3. `isMine` property equals false, wich means that wallet does not recognize this address relation to wallet PK.

**So, can anyone please provide some insight and tell us if (and how?) we can access those funds, or we've lost them for good?**

**P.S.**

When I use base58 decode on both `32Z3eXSPgxcHj2fnQy8d6dg66eVtZfxrBM` and `1s2iywx94HudryMHsU2g1K9x8DB1cahGc` I get

`0509763CB05DCEA0F98F53B0F08651F92C5D2D2F385CCEC0F4` and

`0009763CB05DCEA0F98F53B0F08651F92C5D2D2F3861372301` respectively.

Again, you can clearly see same bytes, so addresses are definitely related.

**Tags:** bitcoin-core, blockchain, segregated-witness, p2sh, p2pkh


---

## 1 answers

### Answer by username_1 on 2018-08-29. Score: 2

I'm afraid you have a bug in your mining software, and your coins are gone.

Instead of sending to the P2SH address, a block was created with a P2PKH output script, reinterpreting the script hash from the P2SH address as a public key hash. This happens somewhere in broken software that doesn't support P2SH and additionally also fails to check the address version byte.

If this is the case, it is unrecoverable and those coins are lost forever. You can't find a public key whose hash matches that script.


---

