Bitcoin Forum
November 16, 2024, 05:34:20 PM *
News: Check out the artwork 1Dq created to commemorate this forum's 15th anniversary
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Access funds on legacy address related to segwit addr to which I got access to  (Read 378 times)
Vaunakiller (OP)
Newbie
*
Offline Offline

Activity: 3
Merit: 8


View Profile
August 29, 2018, 10:10:26 PM
Merited by Foxpup (4), LoyceV (2), ABCbits (1)
 #1

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: https://btc.com/12a1910bbc1fd95410045e86fecf90a601d1c9c93ea338e884e7188cdb54a3d4 and https://btc.com/12a1910bbc1fd95410045e86fecf90a601d1c9c93ea338e884e7188cdb54a3d4

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 client command
Code:
validateaddress
we can inspect both addresses:

Output for 32Z3eXSPgxcHj2fnQy8d6dg66eVtZfxrBM is

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"
}

Output for 1s2iywx94HudryMHsU2g1K9x8DB1cahGc is

Code:
{
"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? Thanks in advance.

P.S.

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

Code:
0509763CB05DCEA0F98F53B0F08651F92C5D2D2F385CCEC0F4
and

Code:
0009763CB05DCEA0F98F53B0F08651F92C5D2D2F3861372301
respectively.

Again, you can clearly see same bytes, so addresses are definitely related.
Thirdspace
Hero Member
*****
Offline Offline

Activity: 1232
Merit: 738


Mixing reinvented for your privacy | chipmixer.com


View Profile
August 29, 2018, 10:59:54 PM
Last edit: August 30, 2018, 01:11:40 PM by Thirdspace
 #2

your segwit address:  32Z3eXSPgxcHj2fnQy8d6dg66eVtZfxrBM
your fund in: 1s2iywx94HudryMHsU2g1K9x8DB1cahGc

I can only provide some insight,
your current private key works only for segwit address and compressed legacy address
I played around with your redeem script, and found 15GzCaKf9Bd5DEvJpLnStzt4aL2QDBuTwW
while the address you mentioned (1s2iywx9...) is an uncompressed legacy address  
so you need to find the uncompressed private key to access your fund
you can use bitaddress tool to find it, or some other tools that can convert several types of private keys


edit: my bad... I just realized my mistake, I believe Coding Enthusiast is in the right direction
it seems you can't recover your bitcoin unless you can find private key for 1s2iywx9...

Abdussamad
Legendary
*
Offline Offline

Activity: 3682
Merit: 1580



View Profile
August 29, 2018, 11:31:10 PM
Last edit: August 30, 2018, 12:40:12 AM by Abdussamad
 #3

Core should be keeping track of all addresses including p2pkh ones. If it isn't you can always dump the private key and import it into another wallet like electrum.

edit: AFAICT the uncompressed p2pkh address of the public key of 32Z3eXSPgxcHj2fnQy8d6dg66eVtZfxrBM is 1GY6bTT89Vw4DAzKsJ43g2CoDzDpE8JxKx so it turns out that the private key for 32Z.. does not unlock the outputs sent to 1s2iywx94HudryMHsU2g1K9x8DB1cahGc . So you need to find out which pubkey was used

Note scriptPubKey is not the same as public key.

I wrote a script to convert between the various key types using the electrum libraries. If you install electrum and python3 you can use it: http://termbin.com/jm3l
Vaunakiller (OP)
Newbie
*
Offline Offline

Activity: 3
Merit: 8


View Profile
August 30, 2018, 01:28:31 AM
 #4

Everybody, thanks a lot for the answers. We are currently looking into suggestions and solutions you've proposed. I'll post an update on this thread later, when things will get clear, so that if anybody encounters such problem in future could use that topic as the starting point.
nc50lc
Legendary
*
Offline Offline

Activity: 2604
Merit: 6416


Self-proclaimed Genius


View Profile
August 30, 2018, 03:40:27 AM
Last edit: August 30, 2018, 05:17:37 AM by nc50lc
 #5

-snip-
Leave a huge tip of this helps 3KNZC6uCWpU6zpDJZQtqEEY1t7SHNUSMQc
Unfortunately, this is not the case.
The output will be 15GzCaKf9Bd5DEvJpLnStzt4aL2QDBuTwW for Compressed and 1GY6bTT89Vw4DAzKsJ43g2CoDzDpE8JxKx for Uncompressed.


Again, you can clearly see same bytes, so addresses are definitely related.
Indeed and also, when you click the HASH 160 link of the SegWit Address format from a blockexplorer that didn't support SegWit like blockchain.com,
it will redirect you to address: 1s2iywx94HudryMHsU2g1K9x8DB1cahGc.

In my opinion, it was the pool's fault why it was sent to that address.

Your funds may be recoverable, try Abdussamad's tool.

█▀▀▀











█▄▄▄
▀▀▀▀▀▀▀▀▀▀▀
e
▄▄▄▄▄▄▄▄▄▄▄
█████████████
████████████▄███
██▐███████▄█████▀
█████████▄████▀
███▐████▄███▀
████▐██████▀
█████▀█████
███████████▄
████████████▄
██▄█████▀█████▄
▄█████████▀█████▀
███████████▀██▀
████▀█████████
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
c.h.
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
▀▀▀█











▄▄▄█
▄██████▄▄▄
█████████████▄▄
███████████████
███████████████
███████████████
███████████████
███░░█████████
███▌▐█████████
█████████████
███████████▀
██████████▀
████████▀
▀██▀▀
Coding Enthusiast
Legendary
*
Offline Offline

Activity: 1043
Merit: 2818


Bitcoin and C♯ Enthusiast


View Profile WWW
August 30, 2018, 04:23:40 AM
Last edit: August 31, 2018, 05:30:22 AM by Coding Enthusiast
Merited by Abdussamad (2), Lucius (1), nc50lc (1), bob123 (1)
 #6

I am not an expert but here is what I see, your program was broken and made a mistake.
You have a private key which has the public key:
Code:
02835613e6e22843ce7dafc5d22a2763a8428b81f3d44dced0fd860f08be7a29df

The hash160 of your public key is:
Code:
2ee67d879ccf17daec87b4ed4a6cecdd9b3f64a0

Which means your ScriptPubKey is if you use P2WPKH (bc1q9mn8mp.... address):
Code:
00 14 2ee67d879ccf17daec87b4ed4a6cecdd9b3f64a0


Edit:
This part was indeed wrong. So here is the fix, thanks to achow101 (below comment)

The  P2WPKH nested in P2SH is going to hash the ScriptPubKey of P2WPKH
So RIPEMD160(SHA256(00142ee67d879ccf17daec87b4ed4a6cecdd9b3f64a0)) and the result is: 0976<...>2f38 and the scriptPubKey will be:
Code:
a9 14 09763cb05dcea0f98f53b0f08651f92c5d2d2f38 87


If you treat 0976... as a hash160 then you get the following address:
Code:
1s2iywx94HudryMHsU2g1K9x8DB1cahGc
Which is why blockchain.info shows it, and probably why your program sent the funds there.

Projects List+Suggestion box
Donate: 1Q9s or bc1q
|
|
|
FinderOuter(0.20.0)Ann-git
Denovo(0.7.0)Ann-git
Bitcoin.Net(0.26.0)Ann-git
|
|
|
BitcoinTransactionTool(0.11.0)Ann-git
WatchOnlyBitcoinWallet(3.2.1)Ann-git
SharpPusher(0.12.0)Ann-git
achow101
Moderator
Legendary
*
Offline Offline

Activity: 3542
Merit: 6886


Just writing some code


View Profile WWW
August 30, 2018, 03:52:12 PM
Merited by Foxpup (6), LoyceV (1), ABCbits (1), Coding Enthusiast (1)
 #7

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.
No, this is wrong.

First of all, 0x05 does not mean segwit, it means P2SH. Bitcoin Core by default creates addresses that are P2WPKH nested inside of a P2SH address. That is why you see embedded in the getaddressinfo output.

Your pool software is incorrect here, and that is the source of the problems. The scriptPubKey that you should have used is a91409763cb05dcea0f98f53b0f08651f92c5d2d2f3887 which maps to the address 32Z3eXSPgxcHj2fnQy8d6dg66eVtZfxrBM. The 09763cb05dcea0f98f53b0f08651f92c5d2d2f38 part is the hash160 of the redeemScript. Since this is a P2WPKH nested in a P2SH, the redeemScript is 00142ee67d879ccf17daec87b4ed4a6cecdd9b3f64a0. However, what your pool software did was it ignored the version byte (the 0x05) which indicates that the hash160 encoded in the address should use a P2SH scriptPubKey. Instead, it made a P2PKH scriptPubKey using the provided hash160 which is why you see that the coins were sent to 1s2iywx94HudryMHsU2g1K9x8DB1cahGc.

regarding output for 1s2iywx94HudryMHsU2g1K9x8DB1cahGc :

2. pubkey property is missing, which is weird, because usually its included for legacy addresses
It is missing because the pubkey does not exist in your wallet. What it is looking for is a pubkey that has a hash160 of 09763cb05dcea0f98f53b0f08651f92c5d2d2f38. But what you have is a redeemScript that has a hash160  of 09763cb05dcea0f98f53b0f08651f92c5d2d2f38. The pubkey that is in that redeemScript is unrelated to this address entirely.

3. isMine property equals false, wich means that wallet does not recognize this address relation to wallet PK.
The address is unrelated to the pubkey.

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? Thanks in advance.
Your coins are lost, you cannot recover them. You would need a public key which hashes to 09763cb05dcea0f98f53b0f08651f92c5d2d2f38 and its associated private key. All you have is a redeemScript that has that hash. That redeemScript is not a public key. Thus you cannot get those coins as you cannot spend them.


Which means your ScriptPubKey is if you use P2WPKH (bc1q9mn8mp.... address):
Code:
00 14 2ee67d879ccf17daec87b4ed4a6cecdd9b3f64a0

Or it is the following if you use P2WPKH nested in P2SH
Code:
a9 14 2ee67d879ccf17daec87b4ed4a6cecdd9b3f64a0 87

But what your program was doing to create your address (32Z3eXSPgxcHj2fnQy8d6dg66eVtZfxrBM) is the following:
Code:
a9 14 09763cb05dcea0f98f53b0f08651f92c5d2d2f38 87
0976... is your ScriptHash which means it was a "redeem script" that got hashed not a public key. Possibly means more than 1 key was used but I may be mistaken about that.
No No No! You are horribly mistaken and completely wrong. That is not how P2WPKH is nested in P2SH. Doing this will cause your coins to be lost. P2WPKH nested in P2SH uses the scriptPubKey of the P2WPKH output as the redeemScript. It does not use the keyhash as the hash in the P2SH scriptPubKey. The P2SH address OP has is correct, his pool software is just broken.

Thirdspace
Hero Member
*****
Offline Offline

Activity: 1232
Merit: 738


Mixing reinvented for your privacy | chipmixer.com


View Profile
August 30, 2018, 09:59:18 PM
 #8

Your coins are lost, you cannot recover them. You would need a public key which hashes to 09763cb05dcea0f98f53b0f08651f92c5d2d2f38 and its associated private key. All you have is a redeemScript that has that hash. That redeemScript is not a public key. Thus you cannot get those coins as you cannot spend them.
Quote
The P2SH address OP has is correct, his pool software is just broken.
a fatal mistake on his pool software Lips sealed about 25 BTC worth of $175,000 currently
we should add this address to the list of lost bitcoin for "collider group" out there  
do we have a maintained list of such thing yet?

Coding Enthusiast
Legendary
*
Offline Offline

Activity: 1043
Merit: 2818


Bitcoin and C♯ Enthusiast


View Profile WWW
August 31, 2018, 05:30:49 AM
 #9

No No No! You are horribly mistaken and completely wrong.

Oh, man. I though I've got the hang of Scripts in bitcoin. I have to go back and review things now.
Thanks, I fixed the comment too.

Projects List+Suggestion box
Donate: 1Q9s or bc1q
|
|
|
FinderOuter(0.20.0)Ann-git
Denovo(0.7.0)Ann-git
Bitcoin.Net(0.26.0)Ann-git
|
|
|
BitcoinTransactionTool(0.11.0)Ann-git
WatchOnlyBitcoinWallet(3.2.1)Ann-git
SharpPusher(0.12.0)Ann-git
bob123
Legendary
*
Offline Offline

Activity: 1624
Merit: 2481



View Profile WWW
August 31, 2018, 07:41:28 AM
Merited by Foxpup (3)
 #10

Your coins are lost, you cannot recover them. You would need a public key which hashes to 09763cb05dcea0f98f53b0f08651f92c5d2d2f38 and its associated private key. All you have is a redeemScript that has that hash. That redeemScript is not a public key. Thus you cannot get those coins as you cannot spend them.
Quote
The P2SH address OP has is correct, his pool software is just broken.

a fatal mistake on his pool software Lips sealed about 25 BTC worth of $175,000 currently


Thats the problem with low quality software which hasn't been tested properly and extensively.
A lot of people are looking to save a few hundred/thousand bucks when hiring a developer to create a software.

Unfortunately those people will never understand that investing a few more bucks into the software will safe you way more money in the later run  Roll Eyes

Additionally it seemed like the software hasn't been tested at all  Huh  A simple unit test would have shown the inconsistency in the first run..


@OP: If you have a purchase contract regarding the software, you probably can claim damages towards the developer.
Each software has to be tested properly before being delivered. And such a mistake definitely stands out..

But, if you tried to save a few bucks.. well.. that was your own fault then i'd say..  Undecided

TheArchaeologist
Sr. Member
****
Offline Offline

Activity: 310
Merit: 727


---------> 1231006505


View Profile WWW
August 31, 2018, 08:40:53 AM
 #11

Funny to see the address "1s2iywx94HudryMHsU2g1K9x8DB1cahGc" pop up here. I had it already flagged since my block parser choked on the coinbase transaction where this address is used. These two transactions were the only cases where I saw the OP_RETURN in the output before the actual payout. So I already figured this was some custom made script for the coinbase transaction. A message in the coinbase refers to "MiningCore".

Reading the entire topic: this seems to be an expensive mistake!

OP: Were you using this: https://github.com/coinfoundry/miningcore ?

Sooner or later you're going to realize, just as I did, that there's a difference between knowing the path and walking the path
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!