Bitcoin Forum
November 08, 2024, 06:11:45 AM *
News: Latest Bitcoin Core release: 28.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: « 1 2 3 [4] 5 6 »  All
  Print  
Author Topic: .05BTC (~$1,700) to whoever helps me successfully extract my BTC from CLI wallet  (Read 1845 times)
21XO (OP)
Jr. Member
*
Offline Offline

Activity: 57
Merit: 29


View Profile
January 17, 2021, 03:30:25 PM
 #61

Delete .blockstack folder if you have it inside your HOME.

https://ibb.co/NKdwrZm
PawGo
Legendary
*
Offline Offline

Activity: 952
Merit: 1385


View Profile
January 17, 2021, 03:44:51 PM
 #62

You must have somewhere the folder in which blockstack keeps configuration and wallet.
Maybe try from the console:
Code:
 rm -rf ~/.blockstack/ 
21XO (OP)
Jr. Member
*
Offline Offline

Activity: 57
Merit: 29


View Profile
January 17, 2021, 03:48:30 PM
 #63

Code:
parallels@parallels-Parallels-Virtual-Platform:~$ rm -rf ~/.blockstack/
parallels@parallels-Parallels-Virtual-Platform:~$
NotATether
Legendary
*
Offline Offline

Activity: 1778
Merit: 7372


Top Crypto Casino


View Profile WWW
January 17, 2021, 11:12:51 PM
 #64

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!)

███████████████████████
████▐██▄█████████████████
████▐██████▄▄▄███████████
████▐████▄█████▄▄████████
████▐█████▀▀▀▀▀███▄██████
████▐███▀████████████████
████▐█████████▄█████▌████
████▐██▌█████▀██████▌████
████▐██████████▀████▌████
█████▀███▄█████▄███▀█████
███████▀█████████▀███████
██████████▀███▀██████████

███████████████████████
.
BC.GAME
▄▄▀▀▀▀▀▀▀▄▄
▄▀▀░▄██▀░▀██▄░▀▀▄
▄▀░▐▀▄░▀░░▀░░▀░▄▀▌░▀▄
▄▀▄█▐░▀▄▀▀▀▀▀▄▀░▌█▄▀▄
▄▀░▀░░█░▄███████▄░█░░▀░▀▄
█░█░▀░█████████████░▀░█░█
█░██░▀█▀▀█▄▄█▀▀█▀░██░█
█░█▀██░█▀▀██▀▀█░██▀█░█
▀▄▀██░░░▀▀▄▌▐▄▀▀░░░██▀▄▀
▀▄▀██░░▄░▀▄█▄▀░▄░░██▀▄▀
▀▄░▀█░▄▄▄░▀░▄▄▄░█▀░▄▀
▀▄▄▀▀███▄███▀▀▄▄▀
██████▄▄▄▄▄▄▄██████
.
..CASINO....SPORTS....RACING..


▄▄████▄▄
▄███▀▀███▄
██████████
▀███▄░▄██▀
▄▄████▄▄░▀█▀▄██▀▄▄████▄▄
▄███▀▀▀████▄▄██▀▄███▀▀███▄
███████▄▄▀▀████▄▄▀▀███████
▀███▄▄███▀░░░▀▀████▄▄▄███▀
▀▀████▀▀████████▀▀████▀▀
21XO (OP)
Jr. Member
*
Offline Offline

Activity: 57
Merit: 29


View Profile
January 17, 2021, 11:51:20 PM
 #65

Do I just search /home/parallels/.local/bin/blockstack in Finder? Sorry please excuse my ignorance.

https://ibb.co/6nSw2Pv
NotATether
Legendary
*
Offline Offline

Activity: 1778
Merit: 7372


Top Crypto Casino


View Profile WWW
January 17, 2021, 11:53:12 PM
 #66

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.

███████████████████████
████▐██▄█████████████████
████▐██████▄▄▄███████████
████▐████▄█████▄▄████████
████▐█████▀▀▀▀▀███▄██████
████▐███▀████████████████
████▐█████████▄█████▌████
████▐██▌█████▀██████▌████
████▐██████████▀████▌████
█████▀███▄█████▄███▀█████
███████▀█████████▀███████
██████████▀███▀██████████

███████████████████████
.
BC.GAME
▄▄▀▀▀▀▀▀▀▄▄
▄▀▀░▄██▀░▀██▄░▀▀▄
▄▀░▐▀▄░▀░░▀░░▀░▄▀▌░▀▄
▄▀▄█▐░▀▄▀▀▀▀▀▄▀░▌█▄▀▄
▄▀░▀░░█░▄███████▄░█░░▀░▀▄
█░█░▀░█████████████░▀░█░█
█░██░▀█▀▀█▄▄█▀▀█▀░██░█
█░█▀██░█▀▀██▀▀█░██▀█░█
▀▄▀██░░░▀▀▄▌▐▄▀▀░░░██▀▄▀
▀▄▀██░░▄░▀▄█▄▀░▄░░██▀▄▀
▀▄░▀█░▄▄▄░▀░▄▄▄░█▀░▄▀
▀▄▄▀▀███▄███▀▀▄▄▀
██████▄▄▄▄▄▄▄██████
.
..CASINO....SPORTS....RACING..


▄▄████▄▄
▄███▀▀███▄
██████████
▀███▄░▄██▀
▄▄████▄▄░▀█▀▄██▀▄▄████▄▄
▄███▀▀▀████▄▄██▀▄███▀▀███▄
███████▄▄▀▀████▄▄▀▀███████
▀███▄▄███▀░░░▀▀████▄▄▄███▀
▀▀████▀▀████████▀▀████▀▀
21XO (OP)
Jr. Member
*
Offline Offline

Activity: 57
Merit: 29


View Profile
January 17, 2021, 11:55:54 PM
 #67

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
NotATether
Legendary
*
Offline Offline

Activity: 1778
Merit: 7372


Top Crypto Casino


View Profile WWW
January 18, 2021, 01:15:04 AM
 #68

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.

███████████████████████
████▐██▄█████████████████
████▐██████▄▄▄███████████
████▐████▄█████▄▄████████
████▐█████▀▀▀▀▀███▄██████
████▐███▀████████████████
████▐█████████▄█████▌████
████▐██▌█████▀██████▌████
████▐██████████▀████▌████
█████▀███▄█████▄███▀█████
███████▀█████████▀███████
██████████▀███▀██████████

███████████████████████
.
BC.GAME
▄▄▀▀▀▀▀▀▀▄▄
▄▀▀░▄██▀░▀██▄░▀▀▄
▄▀░▐▀▄░▀░░▀░░▀░▄▀▌░▀▄
▄▀▄█▐░▀▄▀▀▀▀▀▄▀░▌█▄▀▄
▄▀░▀░░█░▄███████▄░█░░▀░▀▄
█░█░▀░█████████████░▀░█░█
█░██░▀█▀▀█▄▄█▀▀█▀░██░█
█░█▀██░█▀▀██▀▀█░██▀█░█
▀▄▀██░░░▀▀▄▌▐▄▀▀░░░██▀▄▀
▀▄▀██░░▄░▀▄█▄▀░▄░░██▀▄▀
▀▄░▀█░▄▄▄░▀░▄▄▄░█▀░▄▀
▀▄▄▀▀███▄███▀▀▄▄▀
██████▄▄▄▄▄▄▄██████
.
..CASINO....SPORTS....RACING..


▄▄████▄▄
▄███▀▀███▄
██████████
▀███▄░▄██▀
▄▄████▄▄░▀█▀▄██▀▄▄████▄▄
▄███▀▀▀████▄▄██▀▄███▀▀███▄
███████▄▄▀▀████▄▄▀▀███████
▀███▄▄███▀░░░▀▀████▄▄▄███▀
▀▀████▀▀████████▀▀████▀▀
21XO (OP)
Jr. Member
*
Offline Offline

Activity: 57
Merit: 29


View Profile
January 18, 2021, 02:49:59 AM
Merited by NotATether (2)
 #69

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.
HCP
Legendary
*
Offline Offline

Activity: 2086
Merit: 4361

<insert witty quote here>


View Profile
January 18, 2021, 04:14:38 AM
 #70

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

█████████████████████████
████▐██▄█████████████████
████▐██████▄▄▄███████████
████▐████▄█████▄▄████████
████▐█████▀▀▀▀▀███▄██████
████▐███▀████████████████
████▐█████████▄█████▌████
████▐██▌█████▀██████▌████
████▐██████████▀████▌████
█████▀███▄█████▄███▀█████
███████▀█████████▀███████
██████████▀███▀██████████
█████████████████████████
.
BC.GAME
▄▄░░░▄▀▀▄████████
▄▄▄
██████████████
█████░░▄▄▄▄████████
▄▄▄▄▄▄▄▄▄██▄██████▄▄▄▄████
▄███▄█▄▄██████████▄████▄████
███████████████████████████▀███
▀████▄██▄██▄░░░░▄████████████
▀▀▀█████▄▄▄███████████▀██
███████████████████▀██
███████████████████▄██
▄███████████████████▄██
█████████████████████▀██
██████████████████████▄
.
..CASINO....SPORTS....RACING..
█░░░░░░█░░░░░░█
▀███▀░░▀███▀░░▀███▀
▀░▀░░░░▀░▀░░░░▀░▀
░░░░░░░░░░░░
▀██████████
░░░░░███░░░░
░░█░░░███▄█░░░
░░██▌░░███░▀░░██▌
░█░██░░███░░░█░██
░█▀▀▀█▌░███░░█▀▀▀█▌
▄█▄░░░██▄███▄█▄░░▄██▄
▄███▄
░░░░▀██▄▀


▄▄████▄▄
▄███▀▀███▄
██████████
▀███▄░▄██▀
▄▄████▄▄░▀█▀▄██▀▄▄████▄▄
▄███▀▀▀████▄▄██▀▄███▀▀███▄
███████▄▄▀▀████▄▄▀▀███████
▀███▄▄███▀░░░▀▀████▄▄▄███▀
▀▀████▀▀████████▀▀████▀▀
21XO (OP)
Jr. Member
*
Offline Offline

Activity: 57
Merit: 29


View Profile
January 18, 2021, 04:27:05 AM
 #71

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
PawGo
Legendary
*
Offline Offline

Activity: 952
Merit: 1385


View Profile
January 18, 2021, 07:31:56 AM
 #72

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...
NotATether
Legendary
*
Offline Offline

Activity: 1778
Merit: 7372


Top Crypto Casino


View Profile WWW
January 18, 2021, 10:06:53 AM
 #73

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.

███████████████████████
████▐██▄█████████████████
████▐██████▄▄▄███████████
████▐████▄█████▄▄████████
████▐█████▀▀▀▀▀███▄██████
████▐███▀████████████████
████▐█████████▄█████▌████
████▐██▌█████▀██████▌████
████▐██████████▀████▌████
█████▀███▄█████▄███▀█████
███████▀█████████▀███████
██████████▀███▀██████████

███████████████████████
.
BC.GAME
▄▄▀▀▀▀▀▀▀▄▄
▄▀▀░▄██▀░▀██▄░▀▀▄
▄▀░▐▀▄░▀░░▀░░▀░▄▀▌░▀▄
▄▀▄█▐░▀▄▀▀▀▀▀▄▀░▌█▄▀▄
▄▀░▀░░█░▄███████▄░█░░▀░▀▄
█░█░▀░█████████████░▀░█░█
█░██░▀█▀▀█▄▄█▀▀█▀░██░█
█░█▀██░█▀▀██▀▀█░██▀█░█
▀▄▀██░░░▀▀▄▌▐▄▀▀░░░██▀▄▀
▀▄▀██░░▄░▀▄█▄▀░▄░░██▀▄▀
▀▄░▀█░▄▄▄░▀░▄▄▄░█▀░▄▀
▀▄▄▀▀███▄███▀▀▄▄▀
██████▄▄▄▄▄▄▄██████
.
..CASINO....SPORTS....RACING..


▄▄████▄▄
▄███▀▀███▄
██████████
▀███▄░▄██▀
▄▄████▄▄░▀█▀▄██▀▄▄████▄▄
▄███▀▀▀████▄▄██▀▄███▀▀███▄
███████▄▄▀▀████▄▄▀▀███████
▀███▄▄███▀░░░▀▀████▄▄▄███▀
▀▀████▀▀████████▀▀████▀▀
PawGo
Legendary
*
Offline Offline

Activity: 952
Merit: 1385


View Profile
January 18, 2021, 10:09:11 AM
 #74

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://bitcointalk.org/index.php?topic=5306458.msg56040837#msg56040837
NotATether
Legendary
*
Offline Offline

Activity: 1778
Merit: 7372


Top Crypto Casino


View Profile WWW
January 19, 2021, 07:05:52 PM
Merited by ABCbits (3), PawGo (2)
 #75

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."




I actually don't need that but thanks anyway Smiley

███████████████████████
████▐██▄█████████████████
████▐██████▄▄▄███████████
████▐████▄█████▄▄████████
████▐█████▀▀▀▀▀███▄██████
████▐███▀████████████████
████▐█████████▄█████▌████
████▐██▌█████▀██████▌████
████▐██████████▀████▌████
█████▀███▄█████▄███▀█████
███████▀█████████▀███████
██████████▀███▀██████████

███████████████████████
.
BC.GAME
▄▄▀▀▀▀▀▀▀▄▄
▄▀▀░▄██▀░▀██▄░▀▀▄
▄▀░▐▀▄░▀░░▀░░▀░▄▀▌░▀▄
▄▀▄█▐░▀▄▀▀▀▀▀▄▀░▌█▄▀▄
▄▀░▀░░█░▄███████▄░█░░▀░▀▄
█░█░▀░█████████████░▀░█░█
█░██░▀█▀▀█▄▄█▀▀█▀░██░█
█░█▀██░█▀▀██▀▀█░██▀█░█
▀▄▀██░░░▀▀▄▌▐▄▀▀░░░██▀▄▀
▀▄▀██░░▄░▀▄█▄▀░▄░░██▀▄▀
▀▄░▀█░▄▄▄░▀░▄▄▄░█▀░▄▀
▀▄▄▀▀███▄███▀▀▄▄▀
██████▄▄▄▄▄▄▄██████
.
..CASINO....SPORTS....RACING..


▄▄████▄▄
▄███▀▀███▄
██████████
▀███▄░▄██▀
▄▄████▄▄░▀█▀▄██▀▄▄████▄▄
▄███▀▀▀████▄▄██▀▄███▀▀███▄
███████▄▄▀▀████▄▄▀▀███████
▀███▄▄███▀░░░▀▀████▄▄▄███▀
▀▀████▀▀████████▀▀████▀▀
PawGo
Legendary
*
Offline Offline

Activity: 952
Merit: 1385


View Profile
January 19, 2021, 07:13:51 PM
 #76



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.


NotATether
Legendary
*
Offline Offline

Activity: 1778
Merit: 7372


Top Crypto Casino


View Profile WWW
January 19, 2021, 07:26:25 PM
 #77

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

███████████████████████
████▐██▄█████████████████
████▐██████▄▄▄███████████
████▐████▄█████▄▄████████
████▐█████▀▀▀▀▀███▄██████
████▐███▀████████████████
████▐█████████▄█████▌████
████▐██▌█████▀██████▌████
████▐██████████▀████▌████
█████▀███▄█████▄███▀█████
███████▀█████████▀███████
██████████▀███▀██████████

███████████████████████
.
BC.GAME
▄▄▀▀▀▀▀▀▀▄▄
▄▀▀░▄██▀░▀██▄░▀▀▄
▄▀░▐▀▄░▀░░▀░░▀░▄▀▌░▀▄
▄▀▄█▐░▀▄▀▀▀▀▀▄▀░▌█▄▀▄
▄▀░▀░░█░▄███████▄░█░░▀░▀▄
█░█░▀░█████████████░▀░█░█
█░██░▀█▀▀█▄▄█▀▀█▀░██░█
█░█▀██░█▀▀██▀▀█░██▀█░█
▀▄▀██░░░▀▀▄▌▐▄▀▀░░░██▀▄▀
▀▄▀██░░▄░▀▄█▄▀░▄░░██▀▄▀
▀▄░▀█░▄▄▄░▀░▄▄▄░█▀░▄▀
▀▄▄▀▀███▄███▀▀▄▄▀
██████▄▄▄▄▄▄▄██████
.
..CASINO....SPORTS....RACING..


▄▄████▄▄
▄███▀▀███▄
██████████
▀███▄░▄██▀
▄▄████▄▄░▀█▀▄██▀▄▄████▄▄
▄███▀▀▀████▄▄██▀▄███▀▀███▄
███████▄▄▀▀████▄▄▀▀███████
▀███▄▄███▀░░░▀▀████▄▄▄███▀
▀▀████▀▀████████▀▀████▀▀
PawGo
Legendary
*
Offline Offline

Activity: 952
Merit: 1385


View Profile
January 19, 2021, 07:35:53 PM
 #78

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.
escobol
Member
**
Offline Offline

Activity: 158
Merit: 39


View Profile
January 20, 2021, 01:39:28 AM
Merited by ABCbits (2), NotATether (1)
 #79

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.



21XO (OP)
Jr. Member
*
Offline Offline

Activity: 57
Merit: 29


View Profile
January 20, 2021, 05:25:41 AM
 #80

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).
Pages: « 1 2 3 [4] 5 6 »  All
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!