Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sending BTC to segwit bc1 adres generated under the ETH tab #638

Open
Bravewildheart opened this issue Jul 19, 2023 · 7 comments
Open

Sending BTC to segwit bc1 adres generated under the ETH tab #638

Bravewildheart opened this issue Jul 19, 2023 · 7 comments

Comments

@Bravewildheart
Copy link

Hi,

I made a foolish mistake. I generated wallets to deposit BTC and ETH with the BIP39 tool.
I accidently forgot to change the coin tab to BTC and left it on ETH and send BTC to the ETH generated bc1 address.
I have a screen print of all the public keys and private keys.
The can see the BTC laying at the BTC address on the Blockchain explorer.
It is a BIP84 address.
Are there any way I would be able to access the BTC on that address?

Any help would be greatly appreciated.

@wigy-opensource-developer

If you know the seed phrase, you can derive the private key that belongs to that BIP84 address. Now you just need to find a segwit wallet that supports importing that single private key (many wallets nowadays only support BIP39 though). This application shows the private key according to WIF (wallet import format). As an example (but not as a recommendation) Electrum wallet supports importing WIF private keys:

Electrum wallet screenshot for importing an individual private key

On the next screen add something like p2wpkh:KwPUB...q9YfFWLL on a single line and you will be able to control the bc1... address you generated here.

@Bravewildheart
Copy link
Author

Thank for you reply.
I have generated the BTC address as attached.
I chose the ETH tab instead of the BTC.
The private keys are not compatible with a BTC wallet.
Fout

@wigy-opensource-developer
Copy link

Oh boy, I was worried for a moment you shared your private keys to everyone here. 😥 Fortunately based on blockchain explorers you just recreated the scenario with a new phrase.

So this 0xcf55c152aca2a387578bbac33f801d7313d1d3b508e175cca407da8397b8180c is derived as m/84'/60'/0'/0/0 from your seed, and formatted using the Ethereum rules to show private keys, which is just plain lower-case hexadecimal formatting, not the WIF rules.

If you have the BIP39 mnemonic (pupil alter...) or the seed (dd5587...), you can choose BTC as the coin, and use the BIP32 tab to use the m/84'/60'/0'/0 custom derivation path. And then the 1st private key will be WIF formatted (L4Ak...4QwE) that you can use with Electrum. But as I understand, you do not have the mnemonic?

If you only have the 0xcf55... saved, you can use a small Python program on your trusted machine to convert it to WIF format. Save the script into a file called hex2wif.py and run it with python3 hex2wif.py 0xcf55... from a command line.

#!/usr/bin/env python3
import base58
import hashlib
import sys

def b58(b):
    return base58.b58encode(b)

def sha256(b):
    return hashlib.sha256(b).digest()

def hex2wif(arg):
    if arg.startswith('0x'):
      arg = arg[2:]
    key = '80' + arg + '01'
    key_b = bytes.fromhex(key)
    sum_b = sha256(sha256(key_b))
    sum = sum_b[0:4].hex()
    return b58(bytes.fromhex(key + sum)).decode('utf-8')

if __name__ == '__main__':
    print(hex2wif(sys.argv[1]))

@ghscuuo
Copy link

ghscuuo commented Jul 21, 2023

I found this very helpful for recently teaching myself derivation paths and descriptors:
https://waterst0ne.github.io/bdk-cli-basics/
They are a little mind-boggling, but if you can get the descriptor right, I think you maybe should be ok.
(Note the typo on that page, the errant space in "$SIGNED_ PSBT".)
Can you replicate what you did on testnet so we can all play along at home?
Here's some testnet bitcoin I was able to spend using bdk-cli with errant derivation paths: https://mempool.space/testnet/address/tb1ql7anupur9amg4f25caa0g3pyup9eusk66sr0q6
Maybe I'll get lucky and be able to spend your testnet bitcoin as well?

@Bravewildheart
Copy link
Author

Oh boy, I was worried for a moment you shared your private keys to everyone here. 😥 Fortunately based on blockchain explorers you just recreated the scenario with a new phrase.

So this 0xcf55c152aca2a387578bbac33f801d7313d1d3b508e175cca407da8397b8180c is derived as m/84'/60'/0'/0/0 from your seed, and formatted using the Ethereum rules to show private keys, which is just plain lower-case hexadecimal formatting, not the WIF rules.

If you have the BIP39 mnemonic (pupil alter...) or the seed (dd5587...), you can choose BTC as the coin, and use the BIP32 tab to use the m/84'/60'/0'/0 custom derivation path. And then the 1st private key will be WIF formatted (L4Ak...4QwE) that you can use with Electrum. But as I understand, you do not have the mnemonic?

If you only have the 0xcf55... saved, you can use a small Python program on your trusted machine to convert it to WIF format. Save the script into a file called hex2wif.py and run it with python3 hex2wif.py 0xcf55... from a command line.

#!/usr/bin/env python3
import base58
import hashlib
import sys

def b58(b):
    return base58.b58encode(b)

def sha256(b):
    return hashlib.sha256(b).digest()

def hex2wif(arg):
    if arg.startswith('0x'):
      arg = arg[2:]
    key = '80' + arg + '01'
    key_b = bytes.fromhex(key)
    sum_b = sha256(sha256(key_b))
    sum = sum_b[0:4].hex()
    return b58(bytes.fromhex(key + sum)).decode('utf-8')

if __name__ == '__main__':
    print(hex2wif(sys.argv[1]))

Thank you so much.
The code worked prefectly.

@cryptopivot
Copy link

cryptopivot commented Jul 23, 2023

++++SCAM+++++. Anyone who does not realize this = ++++GREEN LIGHT++++

Hi,
I made a foolish mistake. I generated wallets to deposit BTC and ETH with the BIP39 tool. I accidently forgot to change the coin tab to BTC and left it on ETH and send BTC to the ETH generated bc1 address. I have a screen print of all the public keys and private keys. The can see the BTC laying at the BTC address on the Blockchain explorer. It is a BIP84 address. Are there any way I would be able to access the BTC on that address?
Any help would be greatly appreciated.

Same thing happened to me but thanks to Blackhathacker111 who helped me get recovered my lost funds,message him on telegram his telegram username is https://t.me/Blackhathacker110

++++SCAM+++++. Anyone who does not realize this = ++++GREEN LIGHT++++

@Jp-Goodness
Copy link

Jp-Goodness commented Jul 23, 2023 via email

Repository owner deleted a comment Nov 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants
@wigy-opensource-developer @cryptopivot @Jp-Goodness @Bravewildheart @ghscuuo and others