iancoleman / bip39

A web tool for converting BIP39 mnemonic codes
https://iancoleman.io/bip39/
MIT License
3.41k stars 1.42k forks source link

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

Open Bravewildheart opened 11 months ago

Bravewildheart commented 11 months ago

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 commented 11 months ago

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 commented 11 months ago

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 commented 11 months ago

Oh boy, I was worried for a moment you shared your private keys to everyone here. :disappointed_relieved: 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 commented 11 months ago

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 commented 11 months ago

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 commented 11 months ago

++++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 commented 11 months ago

DOnt you ever send money to anyone, any mistake you make on blockchain is irreversible.

Sent from Yahoo Mail for iPhone

On Sunday, July 23, 2023, 6:02 PM, cryptopivot @.***> wrote:

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++++

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you are subscribed to this thread.Message ID: @.***>