Pages:
Author

Topic: .05BTC (~$1,700) to whoever helps me successfully extract my BTC from CLI wallet - page 2. (Read 1802 times)

legendary
Activity: 1568
Merit: 6660
bitcoincleanup.com / bitmixlist.org
Thnx NotATether, Ive tested it with few mpk/passwords generated with 3 old blockstack versions  (0.10.x) and with that simple code I got the same public/privkey (also added WIF for easy import to electrum).

I am having difficulty installing the required dependencies of your script (module registrar and all its dependencies) alongside blockstack, and as I predicted it is very difficult to find a virtualenv for python2 in the ubuntu apt repositories  Sad

Can we not make this script use python3? Yours doesn't depend on blockstack-client so it's possible as long as registrar has a Python 3 module.
member
Activity: 154
Merit: 39
I rebooted my system and tried again, but now it is creating yet another wallet.

So it seems like the
Code:
blockstack wallet
command just creates new wallets even after I run
Code:
python2 restore-wallet.py wallet.json ~/.blockstack/wallet.json

Interesting. I'll inspect the code that implements the wallet command and run escobol's code later and report the results.

Thnx NotATether, Ive tested it with few mpk/passwords generated with 3 old blockstack versions  (0.10.x) and with that simple code I got the same public/privkey (also added WIF for easy import to electrum).
legendary
Activity: 1568
Merit: 6660
bitcoincleanup.com / bitmixlist.org
I rebooted my system and tried again, but now it is creating yet another wallet.

So it seems like the
Code:
blockstack wallet
command just creates new wallets even after I run
Code:
python2 restore-wallet.py wallet.json ~/.blockstack/wallet.json

Interesting. I'll inspect the code that implements the wallet command and run escobol's code later and report the results.
jr. member
Activity: 57
Merit: 29
What happens if you try deleting the /home/parallels/.blockstack/api_endpoint.pid file? (type rm /home/parallels/.blockstack/api_endpoint.pid and then try to open the wallet again.)

If that doesn't help then reboot the Parallels VM and open the terminal again, set it to the desktop folder and run blockstack wallet once again.

Yes that worked but the address has 0 btc. So I think maybe a new wallet was created...


Here is the address it gave me for the wallet: 1KWkUvMxU7PripJ6K2xp2ab1eqUjXvXMrV


But this is the address with coins: 194zW3CDXCuhx24quQcDaJBKwmonxxkK7N

I rebooted my system and tried again, but now it is creating yet another wallet.

So it seems like the
Code:
blockstack wallet
command just creates new wallets even after I run
Code:
python2 restore-wallet.py wallet.json ~/.blockstack/wallet.json
jr. member
Activity: 57
Merit: 29
Can someone confirm that Escobol's code is safe for me to try?
member
Activity: 154
Merit: 39
name code as dirty.py

wallet.json with master private_key and wallet_password

dirty.py with wallet.json in one place

in Terminal:
Code:
python2 dirty.py wallet.json wallet2.json
Will print all info in terminal (wallet address, priv key, wif)

If you see 194zW3CDXCuhx24quQcDaJBKwmonxxkK7N, copy WIF - import to Electrum and have fun Smiley



dirty.py
Code:
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
    Blockstack Legacy wallet crack

"""
from registrar.wallet import HDWallet
from registrar.crypto.utils import aes_encrypt, aes_decrypt
from registrar.crypto.utils import get_address_from_privkey, get_pubkey_from_privkey
from binascii import hexlify
from pybitcoin import BitcoinPrivateKey
import json
import sys
import os.path
import os
import base64


if __name__ == "__main__":
  
    result = {}
    print "Blockstack Legacy wallet crack"
    print "-----"
    print ""
    if len(sys.argv) != 3:
         print "Usage: python2 %s /path/to/wallet.json /path/to/destination/wallet.json" % sys.argv[0]
         sys.exit(1)

    src = sys.argv[1]
    dest = sys.argv[2]

    print "Opening wallet file %s..." % src
    f_src = open(src)
    jwallet = json.load(f_src)
    print "Deriving master private key..."
    hex_privkey = jwallet["master_private_key"]
    password = jwallet["wallet_password"]
    hex_password = hexlify(password)

    wallet = HDWallet(hex_privkey)
    child = wallet.get_child_keypairs(count=3, include_privkey=False)
  

    hex_privkey_1 = wallet.get_child_privkey(1)
    btc_1 = get_address_from_privkey(hex_privkey_1)
    btc_privkey_1 = BitcoinPrivateKey(hex_privkey_1)
    wif_1 = btc_privkey_1.to_wif()
  
    hex_privkey_2 = wallet.get_child_privkey(0)
    btc_2 = get_address_from_privkey(hex_privkey_2)
    btc_privkey_2 = BitcoinPrivateKey(hex_privkey_2)
    wif_2 = btc_privkey_2.to_wif()

    hex_privkey_3 = wallet.get_child_privkey(2)
    btc_3 = get_address_from_privkey(hex_privkey_3)
    btc_privkey_3 = BitcoinPrivateKey(hex_privkey_3)
    wif_3 = btc_privkey_3.to_wif()

  
    master = wallet.get_master_privkey()
    btc_privkey = BitcoinPrivateKey(hex_privkey)
    priv_hex = btc_privkey.to_hex()
    priv_wif = btc_privkey.to_wif()

    btc = get_address_from_privkey(hex_privkey)
    btc_pub = get_pubkey_from_privkey(hex_privkey)

    data = {}
    encrypted_key = aes_encrypt(hex_privkey, hex_password)
    data['encrypted_master_private_key'] = encrypted_key
    data['payment_addresses'] = [child[0]]
    data['owner_addresses'] = [child[1]]

    file = open(dest, 'w')
    file.write(json.dumps(data))
    file.close()
    print ""
    print "Wallet created. Make sure to backup the following:"
    print ""
    print "-----"
    print "master_private_key:", hex_privkey
    print "wallet_password:", password
    print "-----"
    print ""
    print "-----"
    print "encrypted_master_private_key:", encrypted_key
    print "-----"
    print "owner_addresses:", [child[1]]
    print "owner_addresses:", btc_1
    print "owner_key_hex:", hex_privkey_1
    print "WIF owner:", wif_1
    print "-----"
    print "payment_addresses:", [child[0]]
    print "payment_addresses:", btc_2
    print "payment_key_hex", hex_privkey_2
    print "WIF payment:", wif_2
    print "-----"
    print "payment_addresses:", [child[2]]
    print "payment_addresses:", btc_3
    print "payment_key_hex", hex_privkey_3
    print "WIF payment:", wif_3
    print "-----"
    print ""
    print "FROM MASTER"
    print "Address:", btc
    print "Priv HEX:", priv_hex
    print "WIF Master:", priv_wif

jr. member
Activity: 57
Merit: 29
What happens if you try deleting the /home/parallels/.blockstack/api_endpoint.pid file? (type rm /home/parallels/.blockstack/api_endpoint.pid and then try to open the wallet again.)

If that doesn't help then reboot the Parallels VM and open the terminal again, set it to the desktop folder and run blockstack wallet once again.

Yes that worked but the address has 0 btc. So I think maybe a new wallet was created...


Here is the address it gave me for the wallet: 1KWkUvMxU7PripJ6K2xp2ab1eqUjXvXMrV


But this is the address with coins: 194zW3CDXCuhx24quQcDaJBKwmonxxkK7N
legendary
Activity: 1568
Merit: 6660
bitcoincleanup.com / bitmixlist.org
What happens if you try deleting the /home/parallels/.blockstack/api_endpoint.pid file? (type rm /home/parallels/.blockstack/api_endpoint.pid and then try to open the wallet again.)

If that doesn't help then reboot the Parallels VM and open the terminal again, set it to the desktop folder and run blockstack wallet once again.
jr. member
Activity: 57
Merit: 29
Code:
Opening wallet file wallet.json...
Deriving master private key...
Decoding wallet...
Writing decoded wallet to /home/parallels/.blockstack/wallet.json
Wallet dump successful.
parallels@parallels-Parallels-Virtual-Platform:~/Desktop$ blockstack wallet
/home/parallels/.local/lib/python2.7/site-packages/jsontokens/token_signer.py:15: CryptographyDeprecationWarning: Python 2 is no longer supported by the Python core team. Support for it is now deprecated in cryptography, and will be removed in the next release.
  from cryptography.hazmat.backends import default_backend
/home/parallels/.local/lib/python2.7/site-packages/jsontokens/token_signer.py:15: CryptographyDeprecationWarning: Python 2 is no longer supported by the Python core team. Support for it is now deprecated in cryptography, and will be removed in the next release.
  from cryptography.hazmat.backends import default_backend
API endpoint already running (PID 5159, /home/parallels/.blockstack/api_endpoint.pid)
Failed to start RPC endpoint (in working directory /home/parallels/.blockstack).
Please check your password, and verify that the working directory exists and is writeable.
parallels@parallels-Parallels-Virtual-Platform:~/Desktop$
legendary
Activity: 1568
Merit: 6660
bitcoincleanup.com / bitmixlist.org
Okay I have both files located on my desktop, but here is the message I am getting: https://ibb.co/Wvh6y3b

Here is what I pasted: https://ibb.co/vcyb8g0

Since you put the files on the desktop, you need to change the terminal to the Desktop/ folder before running the command.

Run cd ~/Desktop/ and then run the command you were trying to run.



~snip

Hang on, I'll have a solution for that soon.
jr. member
Activity: 57
Merit: 29
Hey guys thanks so much for all your support.

I'm not sure what I need to do...Excuse my ignorance, I'm not very good with working in Terminal and also not too familiar with what a script is (besides from what I read from a quick google search).

All you have to do is copy the code in my post to a text file using an editor, save the file as restore-wallet.py, ensure that it's located in the same folder as your wallet.json (or whatever the file that has your blockstack secret data is called) and then run python2 restore-wallet.py PUT_THE_BLOCKSTACK_FILE_HERE ~/.blockstack/wallet.json

Then you run the blockstack wallet command to access your private keys.

The wallet code is not using multisig so the private keys should be immediately spendable.

Okay I have both files located on my desktop, but here is the message I am getting: https://ibb.co/Wvh6y3b

Here is what I pasted: https://ibb.co/vcyb8g0
member
Activity: 154
Merit: 39
Click wallet details.
In field "Enter Private Key" put ef242kfjj24ekf3223jesdkhefsfhk324wuefhw38fhrypofhtr34d342132d34jsd

You should get addrress, WIF and priv (maybe this will work).

This isn't going to work because it appears that blockstack is creating 2-of-3 multisig keys for the payment and owner "private keys" using virtualchain. It checks for the current block height, and if it's greater than 436650 (it's well over that height by now), it creates multisig wallets for them. Otherwise it just creates regular private keys for them. Data key AFAIK is always using a single private key.

The question now is, which one holds the wallet's money? And why are only one of each owner and private key shown when you run blockstack wallet?

Based on Your code - Ive created similar for version pre0.13 (OP provided password longer than 16, and min 15 chart was requested by Blockstack cli version 0.0.12.4 - so maybe version pre13)
Blockstack cli version 0.0.12.4 use registrar for encrypted_key = (aes_encrypt(hex_privkey, hex_password)).

I got it to work on blockstack_client 0.14.0.2. The source code has been obliterated from Github but you can still download a copy hosted at PyPI located at https://files.pythonhosted.org/packages/3b/33/b0be01806a3503f8fbbaee22477b40c23682bfbde0285695e6d9474aa305/blockstack-client-0.14.0.2.tar.gz

I experienced difficulties with dependency errors trying to get newer versions to work. They require a function that has been removed from virtualchain.


436650 date is 30/10/2016 (so question to OP - when wallet was created?)
member
Activity: 154
Merit: 39
go to:
https://www.bitaddress.org/ (it is known and safe - you can turn off internet if you like)

No, it is not safe.
Stop making such retarded statements.

It is never safe to enter private information into a website, regardless of whether you "turn off the internet" or not..

You are right - deleted.
legendary
Activity: 1624
Merit: 2481
go to:
https://www.bitaddress.org/ (it is known and safe - you can turn off internet if you like)

No, it is not safe.
Stop making such retarded statements.

It is never safe to enter private information into a website, regardless of whether you "turn off the internet" or not..
legendary
Activity: 1568
Merit: 6660
bitcoincleanup.com / bitmixlist.org
Click wallet details.
In field "Enter Private Key" put ef242kfjj24ekf3223jesdkhefsfhk324wuefhw38fhrypofhtr34d342132d34jsd

You should get addrress, WIF and priv (maybe this will work).

This isn't going to work because it appears that blockstack is creating 2-of-3 multisig keys for the payment and owner "private keys" using virtualchain. It checks for the current block height, and if it's greater than 436650 (it's well over that height by now), it creates multisig wallets for them. Otherwise it just creates regular private keys for them. Data key AFAIK is always using a single private key.

The question now is, which one holds the wallet's money? And why are only one of each owner and private key shown when you run blockstack wallet?

Based on Your code - Ive created similar for version pre0.13 (OP provided password longer than 16, and min 15 chart was requested by Blockstack cli version 0.0.12.4 - so maybe version pre13)
Blockstack cli version 0.0.12.4 use registrar for encrypted_key = (aes_encrypt(hex_privkey, hex_password)).

I got it to work on blockstack_client 0.14.0.2. The source code has been obliterated from Github but you can still download a copy hosted at PyPI located at https://files.pythonhosted.org/packages/3b/33/b0be01806a3503f8fbbaee22477b40c23682bfbde0285695e6d9474aa305/blockstack-client-0.14.0.2.tar.gz

I experienced difficulties with dependency errors trying to get newer versions to work. They require a function that has been removed from virtualchain.
legendary
Activity: 1568
Merit: 6660
bitcoincleanup.com / bitmixlist.org
Hey guys thanks so much for all your support.

I'm not sure what I need to do...Excuse my ignorance, I'm not very good with working in Terminal and also not too familiar with what a script is (besides from what I read from a quick google search).

All you have to do is copy the code in my post to a text file using an editor, save the file as restore-wallet.py, ensure that it's located in the same folder as your wallet.json (or whatever the file that has your blockstack secret data is called) and then run python2 restore-wallet.py PUT_THE_BLOCKSTACK_FILE_HERE ~/.blockstack/wallet.json

Then you run the blockstack wallet command to access your private keys.

The wallet code is not using multisig so the private keys should be immediately spendable.
jr. member
Activity: 57
Merit: 29
Hey guys thanks so much for all your support.

I'm not sure what I need to do...Excuse my ignorance, I'm not very good with working in Terminal and also not too familiar with what a script is (besides from what I read from a quick google search).
member
Activity: 154
Merit: 39
Nice one NotATether.

Based on Your code - Ive created similar for version pre0.13 (OP provided password longer than 16, and min 15 chart was requested by Blockstack cli version 0.0.12.4 - so maybe version pre13)
Blockstack cli version 0.0.12.4 use registrar for encrypted_key = (aes_encrypt(hex_privkey, hex_password)).

Code:
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
    Blockstack-client wallet restore script
    by NotATether

    Usage: python2 restore-wallet.py /path/to/wallet.json /path/to/destination/wallet.json
    Due to legacy blockstack_client dependencies, Python 2 is REQUIRED.

    This script does not overwrite the destination file until after the wallet JSON is decoded successfully.

    Please move your coins off of blockstack-client, it is abandoned wallet software!
"""
from registrar.wallet import HDWallet
from registrar.crypto.utils import aes_encrypt, aes_decrypt
from binascii import hexlify
import json
import sys
import os.path

if __name__ == "__main__":
    
    result = {}
    print "Blockstack legacy wallet restore tool by NotATether"
    print "-----"
    print ""
    if len(sys.argv) != 3:
         print "Usage: python2 %s /path/to/wallet.json /path/to/destination/wallet.json" % sys.argv[0]
         sys.exit(1)

    src = sys.argv[1]
    dest = sys.argv[2]

    print "Opening wallet file %s..." % src
    f_src = open(src)
    jwallet = json.load(f_src)
    print "Deriving master private key..."
    hex_privkey = jwallet["master_private_key"]
    password = jwallet["wallet_password"]
    hex_password = hexlify(password)

    wallet = HDWallet(hex_privkey)
    child = wallet.get_child_keypairs(count=2)

    data = {}
    encrypted_key = aes_encrypt(hex_privkey, hex_password)
    data['encrypted_master_private_key'] = encrypted_key
    data['payment_addresses'] = [child[0]]
    data['owner_addresses'] = [child[1]]

    file = open(dest, 'w')
    file.write(json.dumps(data))
    file.close()
    print ""
    print "Wallet created. Make sure to backup the following:"
    print ""
    print "-----"
    print "master_private_key:", hex_privkey
    print "wallet_password:", password
    print "-----"
    print ""
    print "-----"
    print "encrypted_master_private_key:", encrypted_key
    print "owner_addresses:", [child[1]]
    print "payment_addresses:", [child[0]]
    print "-----"
    print ""
    print ""
    print "-----"
    print "Backup - part of wallet.json"
    print(data)
    print ""
    print ""

How to use?

in Ubuntu Terminal
Code:
pip2 install registrar==0.0.3.3

Save code (the long one, first one above) as restoreold.py

Create file old.json with:
Code:
{
"master_private_key": "ef242kfjj24ekf3223jesdkhefsfhk324wuefhw38fhrypofhtr34d342132d34jsd49",
"wallet_password": “kljsef9832nkfssf”
}

Put old.json to the same folder with restoreold.py
Ubuntu terminal - navigate to the folder where two above files are.

Commands (use one)
Code:
python2 restoreold.py old.json wallet.json
Will create new file wallet.json in the folder of the code (next to old.json and restoreold.py) and print in terminal all keys, passwords etc.

Code:
python2 restoreold.py old.json ~/.blockstack/wallet.json
Will create wallet.json in blockstack folder (and also print every keys in terminal).

Maybe it will help.



legendary
Activity: 952
Merit: 1367
I have tried your script twice (with a different wallets generated by blockstack) and all was fine.
Once I had to delete file .blockstack/api_endpoint.pid, I do not know why it was generated.
In the past I have seen output you showed (None/None...), when I played with 'import' param.
legendary
Activity: 1568
Merit: 6660
bitcoincleanup.com / bitmixlist.org
For this particular problem, you need to run it as python2 restore-wallet.py wallet.json ~/.blockstack/wallet.json , and then put the wallet.json file with master_private_key and wallet_password fields in the same folder as restore-wallet.py.

Bravo!
I confirm it works with a new wallet (dumped) from blockstack.

Can you see if you get output that looks like this when you run blockstack wallet? It used to work but I am 100% sure this is not a problem with the wallet.json, but something else is malfunctioning in this wallet software.

Code:
Enter wallet password: 
------------------------------------------------------------
Payment address:��������None
Owner address:����������None
Failed to look up balance
Failed to look up names owned
------------------------------------------------------------
Payment private key info: None
Owner private key info:   None
Data private key info:    None
Failed to get wallet
Pages:
Jump to: