Pages:
Author

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

legendary
Activity: 952
Merit: 1385


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.


legendary
Activity: 1568
Merit: 6660
bitcoincleanup.com / bitmixlist.org
And the show goes on guys! I made a script that will dump the wallet.json into the encrypted format. The deciding routines were hidden inside an internal function, but Python lets us call any function whether it is internal or not.

I haven't written Python 2 in a long time, because how long it's been (rightfully) unsupported. Over a year now and I don't miss it!  Cheesy

This file has to be saved as restore-wallet.py.

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.

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 blockstack_client.wallet import make_wallet, HDWallet
import json
import sys
import os.path

if __name__ == "__main__":
    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..."
    prvbytes = jwallet["master_private_key"]
    tmpwallet = HDWallet(prvbytes)
    hex_privkey = tmpwallet.get_master_privkey()
    password = jwallet["wallet_password"]
    config_path = os.path.join(os.path.expanduser("~"), ".blockstack", "config.ini")

    print "Decoding wallet..."
    wallet = make_wallet(password, hex_privkey=hex_privkey, config_path=config_path, owner_privkey_info=None, payment_privkey_info=None, data_privkey_info=None )
 
    print "Writing decoded wallet to %s" % dest
    f_dest = open(dest, "w")
    json.dump(wallet, f_dest)
    print "Wallet dump successful."



Could you try to launch manually that script: https://bitcointalksearch.org/topic/m.56040837

I actually don't need that but thanks anyway Smiley
legendary
Activity: 952
Merit: 1385
However, blockstack is using these two pieces of information to make a different wallet.json file that is located inside the .blockstack folder. It has many different fields than master_private_key and wallet_password but if I write some python that derives these extra fields and fills in the .blockstack/wallet.json manually then we should be able to get wallet information after that.

Could you try to launch manually that script: https://bitcointalksearch.org/topic/m.56040837
legendary
Activity: 1568
Merit: 6660
bitcoincleanup.com / bitmixlist.org
I must say I am not able to import given wallet.json as well.
After I installed blockstack-client I had this same error like @OP. Then I deleted .blockstack folder from HOME.
Each time I use import it ends generating new wallet.
I have made the change you mentioned in blockstack script (interactive false/true) and now I am asked for Blockstack server data during first start.
I still have not found the way how to import given master_private_key...


Same here. It appears that the output I showed earlier is actually for a new wallet, not for the one I tried to import.

However, blockstack is using these two pieces of information to make a different wallet.json file that is located inside the .blockstack folder. It has many different fields than master_private_key and wallet_password but if I write some python that derives these extra fields and fills in the .blockstack/wallet.json manually then we should be able to get wallet information after that.
legendary
Activity: 952
Merit: 1385
I must say I am not able to import given wallet.json as well.
After I installed blockstack-client I had this same error like @OP. Then I deleted .blockstack folder from HOME.
Each time I use import it ends generating new wallet.
I have made the change you mentioned in blockstack script (interactive false/true) and now I am asked for Blockstack server data during first start.
I still have not found the way how to import given master_private_key...
jr. member
Activity: 57
Merit: 29
Code:
parallels@parallels-Parallels-Virtual-Platform:~$ blockstack import wallet.json
/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
{
    "address": "19SCLaztzW6yacMeBaDJhhZRj9MoETyRG3",
    "message": "Send the name you want to receive to the address specified."
}
parallels@parallels-Parallels-Virtual-Platform:~$


Basically it's reading the
Code:
blockstack import wallet.json
command as just
Code:
blockstack import


Here is my wallet.json file which is saved on my desktop: https://ibb.co/0yLb7TY
HCP
legendary
Activity: 2086
Merit: 4361
I saved my wallet.json file on my Ubuntu desktop in the following format: https://ibb.co/BwXd7rN
That format is incorrect. You've got an extra "{" in the middle... and some extra stuff on the end... it should just be:
Code:
{
"master_private_key": "ef242kfjj24ekf3223jesdkhefsfhk324wuefhw38fhrypofhtr34d342132d34jsd49",
"wallet_password": “kljsef9832nkfssf”
}
Obviously, you fill in the "master_private_key" and the "wallet_password" with the info you have from your original wallet.



However when I run
Code:
blockstack import wallet wallet.json
, I get the following:
NotATether mentioned a couple of posts back that they wrote the wrong command... they should hopefully go back and edit the original post... the correct command is just:
Code:
blockstack import wallet.json
jr. member
Activity: 57
Merit: 29
Okay just updated Ubuntu and now am able to run this command successfully:
Code:
blockstack set_advanced_mode


I saved my wallet.json file on my Ubuntu desktop in the following format: https://ibb.co/BwXd7rN

However when I run
Code:
blockstack import wallet wallet.json
, I get the following:

Quote
parallels@parallels-Parallels-Virtual-Platform:~$ blockstack import wallet wallet.json
/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
Initializing new wallet ...
Enter new password:
Confirm new password:
Wallet created. Make sure to backup the following:
{
    "master_private_key": "03dee845c4fee4b24a1d84950f4a9aa7a4a5e193ac7cd94c9a7c8474446a7d1001",
    "wallet_password": "kjlsfjalfvsq2"
}
Have you backed up the above private key? (y/n):


Basically it's creating a new wallet instead of importing.
legendary
Activity: 1568
Merit: 6660
bitcoincleanup.com / bitmixlist.org
Do I just search /home/parallels/.local/bin/blockstack in Finder? Sorry please excuse my ignorance.

https://ibb.co/6nSw2Pv

No it has to be done from within ubuntu.

https://ibb.co/jWpdsTN

Try opening "gedit" (the text editor in Ubuntu) and click on the button that reads "Open File" or something similar and then paste the path into the textbox at the bottom. Don't forget to type the slash at the beginning.
jr. member
Activity: 57
Merit: 29
Do I just search /home/parallels/.local/bin/blockstack in Finder? Sorry please excuse my ignorance.

https://ibb.co/6nSw2Pv

No it has to be done from within ubuntu.

https://ibb.co/jWpdsTN
legendary
Activity: 1568
Merit: 6660
bitcoincleanup.com / bitmixlist.org
Do I just search /home/parallels/.local/bin/blockstack in Finder? Sorry please excuse my ignorance.

https://ibb.co/6nSw2Pv

No it has to be done from within ubuntu.
jr. member
Activity: 57
Merit: 29
Do I just search /home/parallels/.local/bin/blockstack in Finder? Sorry please excuse my ignorance.

https://ibb.co/6nSw2Pv
legendary
Activity: 1568
Merit: 6660
bitcoincleanup.com / bitmixlist.org
Anyway: when I launch
Code:
 blockstack import_wallet wallet.json 

it asks me for
Code:
Payment private key ('payment_privkey'):
Name owner private key ('owner_privkey'):
optional: Data-signing private key ('data_privkey'):

Is it correct?

No, my bad. I actually ran blockstack import , not blockstack import_wallet. I just checked my command history and import_wallet does something different from importing the wallet.

I also had a local bitcoin core running on the same machine that I installed blockstack on. It seems that blockstack requires bitcoin core so it can do the actual importing and payment handling, and blockstack's just a strawman without it.

@PawGo did you have to do any hack or workaround to make blockstack run or did it work out of the box?





I am wondering why Interactive is set to False in this configure() function. It's supposed to be True by default, and it was in interactive mode for me.

If we can find a way to make blockstack run in interactive mode, it will ask for the parameters and it'll solve the obstacle he's facing because this is the section that's failing:

Code:
 
   blockchain_writer_opts['utxo_provider'] = blockchain_writer_defaults['utxo_provider']
   if not interactive and (len(missing_bitcoin_opts) > 0 or len(missing_writer_opts) > 0 or len(missing_reader_opts) > 0 or len(missing_blockstack_opts) > 0):

       # cannot continue
       raise Exception("Missing configuration fields: %s" % (",".join( missing_bitcoin_opts + missing_writer_opts + missing_reader_opts + missing_blockstack_opts )) )

As you can see it's only triggered if interactive mode is off. I remember during the first time I ran blockstack that the next step after this is that it prompts you if you want to subscribe an email to some mailing list.



OP, you have to open /home/parallels/.local/bin/blockstack in a text editor and edit line 91 and change it from:

Code:
    res = configure(interactive=False, force=False)

To:

Code:
    res = configure(interactive=True, force=False)

Then try running the commands again (make a backup copy of wallet.json before running anything! It seems to overwrite the wallet file!)
jr. member
Activity: 57
Merit: 29
Code:
parallels@parallels-Parallels-Virtual-Platform:~$ rm -rf ~/.blockstack/
parallels@parallels-Parallels-Virtual-Platform:~$
legendary
Activity: 952
Merit: 1385
You must have somewhere the folder in which blockstack keeps configuration and wallet.
Maybe try from the console:
Code:
 rm -rf ~/.blockstack/ 
jr. member
Activity: 57
Merit: 29
legendary
Activity: 952
Merit: 1385
Delete .blockstack folder if you have it inside your HOME.

Then again:
Code:
blockstack set_advanced_mode
-> on


Anyway: when I launch
Code:
 blockstack import_wallet wallet.json 

it asks me for
Code:
Payment private key ('payment_privkey'):
Name owner private key ('owner_privkey'):
optional: Data-signing private key ('data_privkey'):

Is it correct?
jr. member
Activity: 57
Merit: 29
Quote
4. Run
Code:
blockstack set_advanced_mode
and type "on" to access the inport_wallet command.

Ubuntu: https://ibb.co/w4wQrC7
Debian: https://ibb.co/VqzNr39

Looks like it needs to create a config file. Can you post what happens if you run blockstack configure and press Enter through all the options it gives you to accept the defaults and make the configuration file?

Then try running 4., 5. and 6 again.

Ubuntu: https://ibb.co/0D7fQJ4
Debian: https://ibb.co/YNhPz4h
legendary
Activity: 1568
Merit: 6660
bitcoincleanup.com / bitmixlist.org
Quote
4. Run
Code:
blockstack set_advanced_mode
and type "on" to access the inport_wallet command.

Ubuntu: https://ibb.co/w4wQrC7
Debian: https://ibb.co/VqzNr39

Looks like it needs to create a config file. Can you post what happens if you run blockstack configure and press Enter through all the options it gives you to accept the defaults and make the configuration file?

Then try running 4., 5. and 6 again.
jr. member
Activity: 57
Merit: 29
Quote
4. Run
Code:
blockstack set_advanced_mode
and type "on" to access the inport_wallet command.

Ubuntu: https://ibb.co/w4wQrC7
Debian: https://ibb.co/VqzNr39
Pages:
Jump to: