@NotATether, @escobol @PawGo: I want to Merit the right posts, but I don't really want to analyze all posts in details. Can you tell me which of your posts lead to the solution, so I can easily lazily Merit them?
I can but it's going to be in the form of quotes and not direct links, I think that'll be more useful.
Long post warning
Any update?
Did OP open the wallet and forgot about his promise?
I was able to download Blockstack .18 on Ubuntu thanks to the instructions PawGo gave my via DM (thanks PawGo).
The wallet has 3 keys (data, payment, owner). But I only have a "master key". So I'm not sure if I need to download an even earlier version of Blockstack or if I need to extract the payment key from the master key somehow in version .18.
I emailed Blockstack support but they still haven't responded.
If I install an earlier version of Blockstack, I need to delete Blockstack .18 first right?
So, it looks like Blockstack has it's own private key format that is 64 to 66 characters long. Apparently, even the address types in Blockstack are different from bitcoin addresses but can be converted to and from them.
You should try using blockstack-client (it is a python binding of blockstack
https://pypi.org/project/blockstack-client/, it's the one that makes a json file like the one you showed, when a wallet is created and pesters the user to export it to a file).
It needs Python 2 to work.1. Install Python 2
sudo apt install -y python2
2. Install pip for python 2 (yes we run this as root user)
sudo curl https://bootstrap.pypa.io/get-pip.py --output get-pip.py
sudo python2 get-pip.py
2. Install blockstsck-client
pip2 install blockstack-client virtualchain==0.14.0
3. Save this wallet JSON you posted to a file, like
wallet.json for example.
{
"master_private_key": "ef242kfjj24ekf3223jesdkhefsfhk324wuefhw38fhrypofhtr34d342132d34jsd49",
"wallet_password": “kljsef9832nkfssf”
}
4. Run
blockstack set_advanced_mode
and type "on" to access the inport_wallet command.
5. Run
blockstack import_wallet wallet.json
, it will import your wallet from
wallet.json and display your addresses.
6. To get the private keys run
It will show you output like this:
Enter wallet password: PUT THE wallet_password HERE, IT IS NOT ENCRYPTED
------------------------------------------------------------
Payment address: 1HxJ767HSYyvPzHKBVP1JUHfefNzg53Hp6
Owner address: 1PcCxR81Y5BrrD4FnwoWuJ8tH7kURTe1nv
Data public key: 035d999986a0de6e61a20dfa2b92b22daf451303e7b34a4b34103c33d712cfc1fd
------------------------------------------------------------
Balance:
1HxJ767HSYyvPzHKBVP1JUHfefNzg53Hp6: 0.0
------------------------------------------------------------
Names Owned:
1PcCxR81Y5BrrD4FnwoWuJ8tH7kURTe1nv: []
------------------------------------------------------------
------------------------------------------------------------
Payment private key info: 5K2qrQ36ZiJRdViu8BJpnizVxkFEr2ZFzxycW6VL1NAbTD3GLXy
Owner private key info: 5JybVGERkbVCPNXSRnBBxkch68o2D39hrrYw4h8VXX8QEUsKjcQ
Data private key info: L4Z7X5s1v5Tpt6CZZBfLzRVsZpEkJoRuxwRGpe4xD8C28hwjeXun
{
"data_privkey": "dad7d349dff5637d20192396c6fa31f957c22e261c333aeb5ed5101751031afa01",
"data_pubkey": "035d999986a0de6e61a20dfa2b92b22daf451303e7b34a4b34103c33d712cfc1fd",
"owner_address": "1PcCxR81Y5BrrD4FnwoWuJ8tH7kURTe1nv",
"owner_privkey": "5JybVGERkbVCPNXSRnBBxkch68o2D39hrrYw4h8VXX8QEUsKjcQ",
"payment_address": "1HxJ767HSYyvPzHKBVP1JUHfefNzg53Hp6",
"payment_privkey": "5K2qrQ36ZiJRdViu8BJpnizVxkFEr2ZFzxycW6VL1NAbTD3GLXy"
}
Note: this is data for a sample wallet I created using blockstack. Do not send any bitcoins to these addresses; you will lose your money.
apt-get install python-dev
name code as dirty.py
wallet.json with master private_key and wallet_password
dirty.py with wallet.json in one place
in Terminal:
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
dirty.py
#!/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
check
pip2 install registrar==0.0.3.4
------
Checked on new/clean Ubuntu 18.04 LTS
In terminal:
sudo apt-get update
sudo apt-get upgrade
sudo apt install python-minimal
sudo apt install python-pip
sudo apt-get install libssl-dev libffi-dev
pip2 install registrar==0.0.3.4
then (navigate in terminal to the place where is dirty.py (code) and wallet.json)
python2 dirty.py wallet.json wallet_tesporesset.json
Got all pubs/privs
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
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.
escobol has sent me an updated script that works. The previous version malfunctions and terminates with a Python error, nothing malicious or anything, so don't use that one.
Use this updated one instead:
#!/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_privkey_1 = BitcoinPrivateKey(hex_privkey_1)
wif_1 = btc_privkey_1.to_wif()
hex_privkey_2 = wallet.get_child_privkey(0)
btc_privkey_2 = BitcoinPrivateKey(hex_privkey_2)
wif_2 = btc_privkey_2.to_wif()
hex_privkey_3 = wallet.get_child_privkey(2)
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_key_hex:", hex_privkey_1
print "WIF owner:", wif_1
print "-----"
print "payment_addresses:", [child[0]]
print "payment_key_hex", hex_privkey_2
print "WIF payment:", wif_2
print "-----"
print "payment_addresses:", [child[2]]
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
I confirm that it outputs the private keys for a sample wallet I created.
payment_addresses: ['194zW3CDXCuhx24quQcDaJBKwmonxxkK7N']
payment_key_hex xxx
WIF payment: xxxOmg I think it worked...
parallels@parallels-Parallels-Virtual-Platform:~/Desktop$ python2 dirty.py wallet.json wallet2.json
Blockstack Legacy wallet crack
-----
Opening wallet file wallet.json...
Deriving master private key...
Wallet created. Make sure to backup the following:
-----
master_private_key: xxx
wallet_password: xxx
-----
-----
encrypted_master_private_key: xxx
-----
owner_addresses: ['146qagi4RScaREcgvxyzXuc8JBJ6T48e5J']
owner_key_hex: xxx
WIF owner: xxx
-----
payment_addresses: ['194zW3CDXCuhx24quQcDaJBKwmonxxkK7N']
payment_key_hex xxx
WIF payment: xxx
-----
payment_addresses: ['179s8CGfRVwjoLtNbd9a4HMoTYon4vsoyv']
payment_key_hex xxx
WIF payment: xxx
-----
FROM MASTER
Address: 1MCU3cw8bSnaoaCTywx5HgHkL8Vn3dzkd6
Priv HEX: xxx
WIF Master: xxx
parallels@parallels-Parallels-Virtual-Platform:~/Desktop$
What do I need to import into Electrum? The WIF master?
I tried not be biased, and only picked the posts that directly lead OP to the solution in sequential order. But none of this should be necessary once I finish modding blockstack-client.
Obviously keep a maximum cap of merit for each user