Bitcoin Forum

Bitcoin => Bitcoin Technical Support => Topic started by: 21XO on January 03, 2021, 02:56:16 PM



Title: .05BTC (~$1,700) to whoever helps me successfully extract my BTC from CLI wallet
Post by: 21XO on January 03, 2021, 02:56:16 PM
Here is the wallet version I need:

https://pypi.org/project/blockstack/0.18.0.10/



I have the private key but I'm not very technical and am not able to download it to my computer.

My private key looks like the following (I changed some characters of course):
"master_private_key": "ef242kfjj24ekf3223jesdkhefsfhk324wuefhw38fhrypofhtr34d342132d34jsd49",
"wallet_password": “kljsef9832nkfssf”



Here are GitHub instructions for a newer Blockstack version but I need to download the older one (0.18.0.10):

https://github.com/blockstack/cli-blockstack


Title: Re: .05BTC (~$1,700) to whoever helps me successfully extract my BTC from CLI wallet
Post by: PawGo on January 03, 2021, 04:14:10 PM
Do you have python installed on your computer?

https://www.python.org/downloads/
Pip?

https://phoenixnap.com/kb/install-pip-windows

then to command
Code:
pip install blockstack==0.18.0.10
should work.

The other way is to download files:
https://pypi.org/project/blockstack/0.18.0.10/#files

and then install from the downloaded package:
pip install ./downloaded/blockstack-0.18.0.10.tar.gz
like described here: https://packaging.python.org/tutorials/installing-packages/


Title: Re: .05BTC (~$1,700) to whoever helps me successfully extract my BTC from CLI wallet
Post by: 21XO on January 03, 2021, 04:55:50 PM
Yes I do and I got an error message...If you're able to download the wallet on your computer, I can then pay you to help me download it on my computer over Zoom, etc.

I have Mac and Parallels (Windows, and Ubuntu) so can download it to any OS.


FYI my private key starts with "ef" so not sure if that means anything? Maybe I can also extract it from an old Electrum wallet also...?




Title: Re: .05BTC (~$1,700) to whoever helps me successfully extract my BTC from CLI wallet
Post by: ranochigo on January 03, 2021, 05:17:02 PM
Yes I do and I got an error message...If you're able to download the wallet on your computer, I can then pay you to help me download it on my computer over Zoom, etc.

I have Mac and Parallels (Windows, and Ubuntu) so can download it to any OS.


I'm not particularly familiar with that seed format, but Electrum shouldn't accept it. It'll accept MPK that starts with xpriv.

FYI my private key starts with "ef" so not sure if that means anything? Maybe I can also extract it from an old Electrum wallet also...?



Please do not give anyone control of your computer, no matter how trusted they seem. If something happens to the wallet or your computer, it's your words against theirs. And for that matter, your wallet file as well.

What error message are you getting? Let us know.

Electrum accepts MPKs with the prefix of xpriv only so you likely cannot import it there.



Title: Re: .05BTC (~$1,700) to whoever helps me successfully extract my BTC from CLI wallet
Post by: 21XO on January 03, 2021, 05:24:01 PM
Here is the error message:
https://ibb.co/qrBRrmp


Also is anyone familiar with the private key? Maybe it can be imported into another wallet...it's 66 characters and starts with "ef". I think it is also encrypted but I have the password to decrypt it.


Title: Re: .05BTC (~$1,700) to whoever helps me successfully extract my BTC from CLI wallet
Post by: PawGo on January 03, 2021, 05:26:27 PM
check if you are using python3. Probably 2.
Maybe you must install python 3 or launch using command
Code:
python3
and/or
Code:
pip3


Edit:
ah, yes, you are using python 2.7
Try with 3.x


Title: Re: .05BTC (~$1,700) to whoever helps me successfully extract my BTC from CLI wallet
Post by: 21XO on January 03, 2021, 05:30:52 PM
Yes I tried that, also didn't work.

https://ibb.co/KmyV8rv


Title: Re: .05BTC (~$1,700) to whoever helps me successfully extract my BTC from CLI wallet
Post by: PawGo on January 03, 2021, 05:40:36 PM
Yes I tried that, also didn't work.

https://ibb.co/KmyV8rv

ah, weird
Some people used that workaround: https://github.com/OneDrive/onedrive-sdk-python/issues/167

At least you know you must use python 3.


Title: Re: .05BTC (~$1,700) to whoever helps me successfully extract my BTC from CLI wallet
Post by: bob123 on January 03, 2021, 07:53:31 PM
At least you know you must use python 3.

Blockstack v 0.18 only works with python 2. It is incompatible with python 3.



Yes I tried that, also didn't work.

https://ibb.co/KmyV8rv

Somehow the onedrivesdk pip package is broken.
As mentioned in the above posted github, use:
Code:
pip2 install https://github.com/OneDrive/onedrive-sdk-python/archive/master.zip


Title: Re: .05BTC (~$1,700) to whoever helps me successfully extract my BTC from CLI wallet
Post by: PawGo on January 03, 2021, 08:02:08 PM
At least you know you must use python 3.

Blockstack v 0.18 only works with python 2. It is incompatible with python 3.


Mea culpa, I did not know - I just took a look at python output.


I just thought that if blockstack requires python2 and dependency migrated to python3, using master from git will not work, it will be needed to find the last correct version for python2.
But let he first try to install from master...


Title: Re: .05BTC (~$1,700) to whoever helps me successfully extract my BTC from CLI wallet
Post by: PawGo on January 04, 2021, 11:57:20 AM

1. According to https://learnmeabitcoin.com/technical/wif, ef is tesnet prefix which used when you create WIF from private key in HEX format. Do you open correct file / see correct line ?


Information if it is testnet or not is not included in private key itself. Only in prefix which is used to generate WIF.

Quote

2. Looking at https://docs.blockstack.org/understand-stacks/accounts (https://docs.blockstack.org/understand-stacks/accounts), especially example of their private key when generating account also 66 characters. Although i don't know why their example use prefix 03 (maybe it's standard for Stacks 2.0 network)

npx -q stacks-gen sk --testnet

{
  "phrase": "guide air pet hat friend anchor harvest dog depart matter deny awkward sign almost speak short dragon rare private fame depart elevator snake chef",
  "private": "0351764dc07ee1ad038ff49c0e020799f0a350dd0769017ea09460e150a6401901",
  "public": "022d82baea2d041ac281bebafab11571f45db4f163a9e3f8640b1c804a4ac6f662",
  "stacks": "ST16JQQNQXVNGR8RZ1D52TMH5MFHTXVPHRV6YE19C",
  "stacking": "{ hashbytes: 0x4d2bdeb7eeeb0c231f0b4a2d5225a3e3aeeed1c6, version: 0x00 }",
  "btc": "mnYzsxxW271GkmyMnRfiopEkaEpeqLtDy8",
  "wif": "cMh9kwaCEttgTQYkyMUYQVbdm5ZarZdBHErcq7mXUChXXCo7CFEh"
}


In this example the private key is 0351764dc07ee1ad038ff49c0e020799f0a350dd0769017ea09460e150a64019. 01 at the end is a flag to indicate to use compressed address.
Because the program was launched with --testnet the generated WIF is "cMh9"... - which is created by adding "ef" at the beginning.
This same private key (with compressed flag) for the real network will produce WIF KwLAJ2aLoqCRHy5VawfR3B6a8rGBC7XVDCi9ihK1y63XGTgP3VbR


Title: Re: .05BTC (~$1,700) to whoever helps me successfully extract my BTC from CLI wallet
Post by: PawGo on January 04, 2021, 12:20:53 PM

Since the private key length is 66 character (rather than 64 character), know ef used as prefix which is used to generate WIF from private key in HEX format and example by OP doesn't end with 01, i simply assume ef is the identifier whether the private key meant for testnet wallet/network and 03 as custom prefix.

Thanks for the correction.

He said his key is like "ef242kfjj24ekf3223jesdkhefsfhk324wuefhw38fhrypofhtr34d342132d34jsd49", which is encoded form.
it does not look like hex which could be easily converted into WIF, so I would not worry about it as long as we do not know what is decoded hex form.


Title: Re: .05BTC (~$1,700) to whoever helps me successfully extract my BTC from CLI wallet
Post by: 21XO on January 04, 2021, 04:45:33 PM
My real private key starts with ef and ends in 01.

Code:
python2.7 -m pip install onedrivesdk==1.1.8
https://ibb.co/7gcd0ps

Code:
python2.7 -m pip install blockstack==0.18.0.10
https://ibb.co/Jj0LvnY
https://ibb.co/gzmf2KG
https://ibb.co/8s6mg5S



Thanks guys for all the help.






Title: Re: .05BTC (~$1,700) to whoever helps me successfully extract my BTC from CLI wallet
Post by: PawGo on January 04, 2021, 05:32:56 PM
Maybe you need to install xcode-libraries or Xcode Command Line Tools? Error is common:
https://www.google.be/search?q=mac+error+command+cc

Or switch to other system...



Title: Re: .05BTC (~$1,700) to whoever helps me successfully extract my BTC from CLI wallet
Post by: eibhear on January 04, 2021, 06:46:09 PM
I'm not familiar with blockstack wallet, but it seems its successfully installed on my Debian machine, without compiling anything. At least it prints help, and, I think, I managed to set up a wallet.
Exact commands I used to install:
Code:
virtualenv -p python2.7 blockstack
cd blockstack/
source bin/activate
python2.7 -m pip install jsonschema==2.5.1
python2.7 -m pip install onedrivesdk==1.1.8
python2.7 -m pip install blockstack==0.18.0.10
You may try it on your Ubuntu virtual machine.


Title: Re: .05BTC (~$1,700) to whoever helps me successfully extract my BTC from CLI wallet
Post by: PawGo on January 04, 2021, 07:15:43 PM
I managed to install it using cygwin, so on your linux machine it should work... Or on Windows... 
Remember that you will probably need packages libssl-devel (for cryptography/wheels) and python-devel.


Title: Re: .05BTC (~$1,700) to whoever helps me successfully extract my BTC from CLI wallet
Post by: MrFreeDragon on January 05, 2021, 01:31:59 AM
Have you resolved your issue?


Title: Re: .05BTC (~$1,700) to whoever helps me successfully extract my BTC from CLI wallet
Post by: bitcoinforktech on January 05, 2021, 03:55:42 AM
My real private key starts with ef and ends in 01.

Code:
python2.7 -m pip install onedrivesdk==1.1.8
https://ibb.co/7gcd0ps

Code:
python2.7 -m pip install blockstack==0.18.0.10
https://ibb.co/Jj0LvnY
https://ibb.co/gzmf2KG
https://ibb.co/8s6mg5S



Thanks guys for all the help.


It looks to me like you need the openssl libraries.  Normally I would 'sudo apt install libssl-dev' and you should be able to do a similar thing with brew. brew install openssl or brew install openssl@1.1.

Try this:

brew install openssl@1.1
cp /usr/local/opt/openssl@1.1/lib/pkgconfig/*.pc /usr/local/lib/pkgconfig/

Hopefully that will help move things along.

Are you sure you can/cannot convert the key to WIF or somesuch and import it?


Title: Re: .05BTC (~$1,700) to whoever helps me successfully extract my BTC from CLI wallet
Post by: 21XO on January 05, 2021, 04:18:24 AM
https://ibb.co/xfV3BBR


Code:
Are you sure you can/cannot convert the key to WIF or somesuch and import it?

Maybe I can, I'm just not very technical.



I also have Parallels, so maybe I can also try installing on Windows or Ubuntu.


Title: Re: .05BTC (~$1,700) to whoever helps me successfully extract my BTC from CLI wallet
Post by: bitcoinforktech on January 05, 2021, 04:29:50 AM
Please try

sudo cp /usr/local/opt/openssl@1.1/lib/pkgconfig/*.pc /usr/local/lib/pkgconfig/



Title: Re: .05BTC (~$1,700) to whoever helps me successfully extract my BTC from CLI wallet
Post by: bitcoinforktech on January 05, 2021, 05:22:24 AM
https://ibb.co/xfV3BBR
Code:
Are you sure you can/cannot convert the key to WIF or somesuch and import it?

Maybe I can, I'm just not very technical.

I also have Parallels, so maybe I can also try installing on Windows or Ubuntu.

It looks like the key as you have described can't easily be exported as a WIF.

I would try Ubuntu rather than Windows for this, if you need to use Parallels.  Windows is a huge pain.

We should be able to do this on Mac with brew.  Fingers crossed those compile issues will get fixed.


Title: Re: .05BTC (~$1,700) to whoever helps me successfully extract my BTC from CLI wallet
Post by: coin790 on January 05, 2021, 07:56:24 AM
try this download the cli blockstack 0.18.0.10/
instructions for installing a tar.gz file.
https://drive.google.com/file/d/1Rmm9Qq-SdNnAQHieCQjT-EwJbpQNW3-0/view?usp=sharing


Title: Re: .05BTC (~$1,700) to whoever helps me successfully extract my BTC from CLI wallet
Post by: NotATether on January 05, 2021, 09:11:58 AM
It looks to me like you need the openssl libraries.  Normally I would 'sudo apt install libssl-dev' and you should be able to do a similar thing with brew. brew install openssl or brew install openssl@1.1.

Try this:

brew install openssl@1.1
cp /usr/local/opt/openssl@1.1/lib/pkgconfig/*.pc /usr/local/lib/pkgconfig/

Hopefully that will help move things along.

bitcoinforktech is correct, you are missing the OpenSSL library on Mac which is why the pip installation fails with "cannot find <openssl/aes.h>" (last image). You need to use brew to install it.

If you don't currently have brew, you can install it using:

Code:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"


Are you sure you can/cannot convert the key to WIF or somesuch and import it?

He said his private key is 66 characters long and begins with ef, while bitcoin private keys are supposed to be 64 hex characters long. It is already out of range of a valid private key:

0x1 to 0xFFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFE BAAE DCE6 AF48 A03B BFD2 5E8C D036 4140

The blockstack JSON he posted suggests that this could be a master private key, but those are also 64 hex characters long and begin with xprv, but this hex number doesn't have either of these properties.

https://ibb.co/xfV3BBR

You are getting permission denied because you aren't running brew as Administrator, try running the brew install command with sudo.


@21XO, I think I asked you in your other thread what kind of address is this private key for, but I never got an answer AFAIK. Are you trying to recover a legacy address, or a segwit address?


Title: Re: .05BTC (~$1,700) to whoever helps me successfully extract my BTC from CLI wallet
Post by: PawGo on January 05, 2021, 09:16:54 AM
It was already discussed before. He has 66 characters because the last ones are 01 indicating compressed address.
He may convert his private key to WIF and import into any wallet like Electrum using for example this page https://learnmeabitcoin.com/technical/wif (and keeping some safety measures, like being offline etc).
The question is if he has his REAL key or encrypted. If it is real, the migration is easy and could be done in 1 minute. If it is encrypted he needs the program which is able to decrypt it - in this case the old version of blockstack.


Title: Re: .05BTC (~$1,700) to whoever helps me successfully extract my BTC from CLI wallet
Post by: NotATether on January 05, 2021, 09:30:52 AM
It was already discussed before. He has 66 characters because the last ones are 01 indicating compressed address.
He may convert his private key to WIF and import into any wallet like Electrum using for example this page https://learnmeabitcoin.com/technical/wif (and keeping some safety measures, like being offline etc).
The question is if he has his REAL key or encrypted. If it is real, the migration is easy and could be done in 1 minute. If is encrypted he need the program which is able to decrypt it - in this case the old version of blockstack.

So to be clear, according to that link you posted, the "ef" at the beginning is also bytes in the private key, since it's got to be 256-bit (and "01" is not part of the key)? They also have an example where they have a private key beginning with "ef" but has a prefix of "80" indicating mainnet that's put before the private key. I just want to make sure we're not dealing with a testnet private key since "ef" is also the prefix of testnet. My bad, testnet prefix is actually fe and somehow I thought it was ef.


Title: Re: .05BTC (~$1,700) to whoever helps me successfully extract my BTC from CLI wallet
Post by: PawGo on January 05, 2021, 09:35:10 AM
It was already discussed before. He has 66 characters because the last ones are 01 indicating compressed address.
He may convert his private key to WIF and import into any wallet like Electrum using for example this page https://learnmeabitcoin.com/technical/wif (and keeping some safety measures, like being offline etc).
The question is if he has his REAL key or encrypted. If it is real, the migration is easy and could be done in 1 minute. If is encrypted he need the program which is able to decrypt it - in this case the old version of blockstack.

So to be clear, according to that link you posted, the "ef" at the beginning is also bytes in the private key, since it's got to be 256-bit (and "01" is not part of the key)? They also have an example where they have a private key beginning with "ef" but has a prefix of "80" indicating mainnet that's put before the private key. I just want to make sure we're not dealing with a testnet private key since "ef" is also the prefix of testnet.

Take a look at comment https://bitcointalk.org/index.php?topic=5306458.msg56017277#msg56017277
If key for testnet starts not with "ef" and used on learnmeabitcoin page generates this same WIF for testnet like in comment I would like to believe that it is just a coincidence and (I hope) OP has a key for real network.


Title: Re: .05BTC (~$1,700) to whoever helps me successfully extract my BTC from CLI wallet
Post by: 21XO on January 06, 2021, 02:22:53 AM
Please try

sudo cp /usr/local/opt/openssl@1.1/lib/pkgconfig/*.pc /usr/local/lib/pkgconfig/




https://ibb.co/WVmPsq1


Title: Re: .05BTC (~$1,700) to whoever helps me successfully extract my BTC from CLI wallet
Post by: 21XO on January 06, 2021, 02:32:43 AM
Quote
You are getting permission denied because you aren't running brew as Administrator, try running the brew install command with sudo.


https://ibb.co/ky31Y7H


Quote
@21XO, I think I asked you in your other thread what kind of address is this private key for, but I never got an answer AFAIK. Are you trying to recover a legacy address, or a segwit address?


legacy address


Title: Re: .05BTC (~$1,700) to whoever helps me successfully extract my BTC from CLI wallet
Post by: 21XO on January 06, 2021, 02:54:48 AM
Quote
Fortunately https://learnmeabitcoin.com/technical/wif shows example code how to generate WIF key from HEX private key, i combine required code for convenience.

Code:
require 'digest'

# Checksums use hash256 (where data is hashed twice through sha256)
def hash256(hex)
    binary = [hex].pack("H*")
    hash1 = Digest::SHA256.digest(binary)
    hash2 = Digest::SHA256.digest(hash1)
    result = hash2.unpack("H*")[0]
    return result
end

# Checksums are used when creating addresses
def checksum(hex)
  hash = hash256(hex) # Hash the data through SHA256 twice
  return hash[0...8]  # Return the first 4 bytes (8 characters)
end

def base58_encode(hex)
  @chars = %w[
      1 2 3 4 5 6 7 8 9
    A B C D E F G H   J K L M N   P Q R S T U V W X Y Z
    a b c d e f g h i j k   m n o p q r s t u v w x y z
]
  @base = @chars.length

  i = hex.to_i(16)
  buffer = String.new

  while i > 0
    remainder = i % @base
    i = i / @base
    buffer = @chars[remainder] + buffer
  end

  #! Is it just the 00, or does 05 get converted to 3, etc.
  # add '1's to the start based on number of leading bytes of zeros
  leading_zero_bytes = (hex.match(/^([0]+)/) ? $1 : '').size / 2

  ("1"*leading_zero_bytes) + buffer
end

privatekey = "0351764dc07ee1ad038ff49c0e020799f0a350dd0769017ea09460e150a64019"
# "ef" for tesnet
# "80" for mainnet
extended = "ef" + privatekey + "01" #  you can remove 01 to make your wallet generate uncompressed public key
extendedchecksum = extended + checksum(extended)
wif = base58_encode(extendedchecksum)

puts wif

You need to install ruby, save the code on a file and run it with this command

Code:
ruby your_file_name.rb

I've tried it quickly, compare the result with bitaddress and check whether the generated WIF can be imported to Electrum (both testnet and mainnet).




Okay I just installed Ruby but can someone confirm exactly what code I should save in the "ruby your_file_name.rb" document if my private key is: ef242kfjj24ekf3223jesdkhefsfhk324wuefhw38fhrypofhtr34d342132d34jsd01 ?

And also do I just paste the code into Text edit or Microsoft Word? and then just save the file as ".rb"?


Title: Re: .05BTC (~$1,700) to whoever helps me successfully extract my BTC from CLI wallet
Post by: NotATether on January 06, 2021, 04:31:21 AM
Okay I just installed Ruby but can someone confirm exactly what code I should save in the "ruby your_file_name.rb" document if my private key is: ef242kfjj24ekf3223jesdkhefsfhk324wuefhw38fhrypofhtr34d342132d34jsd01 ?

And also do I just paste the code into Text edit or Microsoft Word? and then just save the file as ".rb"?

Paste it inside a text editor like Notepad because Microsoft Word and other word processors will mess up the code by adding formatting to it.

All you have to do is change the private key on this line:

Quote
privatekey = "0351764dc07ee1ad038ff49c0e020799f0a350dd0769017ea09460e150a64019"

To:

Quote
privatekey = "ef242kfjj24ekf3223jesdkhefsfhk324wuefhw38fhrypofhtr34d342132d34jsd"

Save it as "your_file_name.rb"


Title: Re: .05BTC (~$1,700) to whoever helps me successfully extract my BTC from CLI wallet
Post by: pooya87 on January 06, 2021, 04:41:25 AM
The blockstack JSON he posted suggests that this could be a master private key, but those are also 64 hex characters long and begin with xprv, but this hex number doesn't have either of these properties.
If the string starts with xprv then it is no longer encoded using hexadecimal characters. They use base58 instead. But 32 bytes can also be the seed that were used in BIP32 or BIP39. For example from BIP39 test vectors (https://github.com/trezor/python-mnemonic/blob/master/vectors.json#L88-L91):
Code:
68a79eaca2324873eacc50cb9c6eca8cc68ea5d936f98787c60c7ebc74e6ce7c

There is also a "passphrase" in BIP39 that can extend the mnemonic generated from the above seed to get entirely different set of child keys.


Title: Re: .05BTC (~$1,700) to whoever helps me successfully extract my BTC from CLI wallet
Post by: 21XO on January 06, 2021, 05:14:06 AM
Quote
You need to install ruby, save the code on a file and run it with this command


Code:
ruby your_file_name.rb


https://ibb.co/09S189V


Title: Re: .05BTC (~$1,700) to whoever helps me successfully extract my BTC from CLI wallet
Post by: ABCbits on January 06, 2021, 11:06:21 AM
Okay I just installed Ruby but can someone confirm exactly what code I should save in the "ruby your_file_name.rb" document if my private key is: ef242kfjj24ekf3223jesdkhefsfhk324wuefhw38fhrypofhtr34d342132d34jsd01 ?

If your private key length is 66 and end with 01, then you need to change these line

Code:
privatekey = "0351764dc07ee1ad038ff49c0e020799f0a350dd0769017ea09460e150a64019"
extended = "ef" + privatekey + "01" #  you can remove 01 to make your wallet generate uncompressed public key

into

Code:
privatekey = "ef242kfjj24ekf3223jesdkhefsfhk324wuefhw38fhrypofhtr34d342132d34jsd01"
extended = "80" + privatekey

Quote
You need to install ruby, save the code on a file and run it with this command


Code:
ruby your_file_name.rb


https://ibb.co/09S189V

Are you sure notepadwif.rb file is located on ~ ?


Title: Re: .05BTC (~$1,700) to whoever helps me successfully extract my BTC from CLI wallet
Post by: PawGo on January 06, 2021, 11:14:59 AM
I am lost...
Finally - does he have his DECODED private key, or ENCODED?
If it is ENCODED and he has password, he must use blockstack to decode it.

What he posted is not a private key HEX form (ef242kfjj24ekf3223...) and cannot be easily converted into WIF.

21XO: were you able to launch blockstack and retrieve your private key?


Title: Re: .05BTC (~$1,700) to whoever helps me successfully extract my BTC from CLI wallet
Post by: bob123 on January 06, 2021, 11:42:41 AM
Getting blockstack to run should be the easiest way.

If i were you, i'd try to use the software used to generate that key to retrieve the coins.
A few dependency problems shouldn't be holding you back, this can be fixed quite easily.


Title: Re: .05BTC (~$1,700) to whoever helps me successfully extract my BTC from CLI wallet
Post by: NotATether on January 06, 2021, 11:39:51 PM
I am lost...
Finally - does he have his DECODED private key, or ENCODED?
If it is ENCODED and he has password, he must use blockstack to decode it.

What he posted is not a private key HEX form (ef242kfjj24ekf3223...) and cannot be easily converted into WIF.

21XO: were you able to launch blockstack and retrieve your private key?

Maybe it's a base36 string.

Converting it into hex using javascript gives this:

Code:
parseInt("ef242kfjj24ekf3223jesdkhefsfhk324wuefhw38fhrypofhtr34d342132d34", 36).toString(16)
"14e5771b8ad8e800000000000000000000000000000000000000000000000000000000000000000000"

Not sure how to make sense of this number though. It's 82 characters long, to many to be a private key.


Title: Re: .05BTC (~$1,700) to whoever helps me successfully extract my BTC from CLI wallet
Post by: PawGo on January 07, 2021, 11:47:33 AM
I have same question, using blockstack should be far easier (since you've used it on past) than mess with the key when we don't know even how blockstack store user's key.

Code:
def aes_decrypt_legacy(payload, secret):
    """
    Legacy AES decryption (FROM INSECURE ENCRYPTION)!
    Return decrypted secret on success
    Return None on error
    """
    print "Falling back to legacy decryption"
   
    # DO NOT USE TO ENCRYPT
    # legacy hold-over for migrating to stronger encryption
    def ensure_length(secret):
        if len(secret) > 32:
            secret = secret[:32]

        elif len(secret) < 24:
            length = 24 - (len(secret) % 24)
            secret += chr(length)*length
        elif len(secret) > 24 and len(secret) < 32:
            length = 32 - (len(secret) % 32)
            secret += chr(length)*length

        return hexlify(secret)

    try:
        PADDING = '{'

        secret = ensure_length(secret)
        cipher = Cipher(algorithms.AES(unhexlify(secret)), modes.ECB(),
                        backend = default_backend())
        decryptor = cipher.decryptor()
        res = decryptor.update(base64.b64decode(payload)) + decryptor.finalize()
        res = res.rstrip(PADDING)
        return res
    except:
        return None


def aes_decrypt(payload, secret):
    """
    Decrypt a base64-encoded payload with a hex-encoded secret.
    Returns the plaintext on success
    Returns None on error
    """
    try:
        res = scrypt.decrypt(base64.b64decode(payload), unhexlify(secret))
        return res
    except scrypt.error:
        res = aes_decrypt_legacy(payload, secret)
        return res


Title: Re: .05BTC (~$1,700) to whoever helps me successfully extract my BTC from CLI wallet
Post by: TheBeardedBaby on January 08, 2021, 12:14:44 AM
Focus on installing the cli wallet.
Using a virtual machine gives you the conformity to start all over again very quickly if something goes wrong.
Make a backup of the clean installation.

Post here your steps, there are enough people around who would like to help in the process.

Just a note, Windows 10 comes with0 Ubuntu too, only the console versjon but it will be enough for you.

Good luck :)


Title: Re: .05BTC (~$1,700) to whoever helps me successfully extract my BTC from CLI wallet
Post by: 21XO on January 08, 2021, 12:36:52 AM
I managed to install it using cygwin, so on your linux machine it should work... Or on Windows... 
Remember that you will probably need packages libssl-devel (for cryptography/wheels) and python-devel.

Okay so I can install it on Windows, Debian, or Ubuntu....anyways so far I downloaded libssl-devel on Ubuntu using these instructions (https://zoomadmin.com/HowToInstall/UbuntuPackage/libssl-dev) but I'm not sure how to download python-devel?


Title: Re: .05BTC (~$1,700) to whoever helps me successfully extract my BTC from CLI wallet
Post by: 21XO on January 08, 2021, 12:38:09 AM
Okay I just installed Ruby but can someone confirm exactly what code I should save in the "ruby your_file_name.rb" document if my private key is: ef242kfjj24ekf3223jesdkhefsfhk324wuefhw38fhrypofhtr34d342132d34jsd01 ?

If your private key length is 66 and end with 01, then you need to change these line

Code:
privatekey = "0351764dc07ee1ad038ff49c0e020799f0a350dd0769017ea09460e150a64019"
extended = "ef" + privatekey + "01" #  you can remove 01 to make your wallet generate uncompressed public key

into

Code:
privatekey = "ef242kfjj24ekf3223jesdkhefsfhk324wuefhw38fhrypofhtr34d342132d34jsd01"
extended = "80" + privatekey

Quote
You need to install ruby, save the code on a file and run it with this command


Code:
ruby your_file_name.rb


https://ibb.co/09S189V

Are you sure notepadwif.rb file is located on ~ ?

I saved it on my desktop...not sure what you mean by "~"?


Title: Re: .05BTC (~$1,700) to whoever helps me successfully extract my BTC from CLI wallet
Post by: TheBeardedBaby on January 08, 2021, 12:49:47 AM
I saved it on my desktop...not sure what you mean by "~"?
~ represents the home directory in Linux I guess it's the same in Mac too.
The location of the file should be in the same place where you are trying to execute it.
You should navigate to where the file is located and then execute the command.


Use ls to list what you have in the directory.


Title: Re: .05BTC (~$1,700) to whoever helps me successfully extract my BTC from CLI wallet
Post by: 21XO on January 08, 2021, 01:10:09 AM
I saved it on my desktop...not sure what you mean by "~"?
~ represents the home directory in Linux I guess it's the same in Mac too.
The location of the file should be in the same place where you are trying to execute it.
You should navigate to where the file is located and then execute the command.


Use ls to list what you have in the directory.


Okay it worked! The private key is 52 characters and starts with cV and ends in gk


So now I should try to import it into Electrum?


Title: Re: .05BTC (~$1,700) to whoever helps me successfully extract my BTC from CLI wallet
Post by: HCP on January 08, 2021, 01:45:39 AM
Okay it worked! The private key is 52 characters and starts with cV and ends in gk

So now I should try to import it into Electrum?
That doesn't look like a Bitcoin private key... Bitcoin private keys (in WIF format) start with "5", "L" or "K".

I honestly think that your best chance of success is to get blockstack working and use that, as it would seem that it is using some sort of proprietary format or method of storing private keys. ??? :-\


Title: Re: .05BTC (~$1,700) to whoever helps me successfully extract my BTC from CLI wallet
Post by: 21XO on January 08, 2021, 02:03:00 AM
I managed to install it using cygwin, so on your linux machine it should work... Or on Windows... 
Remember that you will probably need packages libssl-devel (for cryptography/wheels) and python-devel.

Okay so I can install it on Windows, Debian, or Ubuntu....anyways so far I downloaded libssl-devel on Ubuntu using these instructions (https://zoomadmin.com/HowToInstall/UbuntuPackage/libssl-dev) but I'm not sure how to download python-devel?



Okay the above is my current status so far


Title: Re: .05BTC (~$1,700) to whoever helps me successfully extract my BTC from CLI wallet
Post by: PawGo on January 08, 2021, 09:17:56 AM
I saved it on my desktop...not sure what you mean by "~"?
~ represents the home directory in Linux I guess it's the same in Mac too.
The location of the file should be in the same place where you are trying to execute it.
You should navigate to where the file is located and then execute the command.


Use ls to list what you have in the directory.


Okay it worked! The private key is 52 characters and starts with cV and ends in gk


So now I should try to import it into Electrum?

cV... means the key is for testnet.

Take a look: https://learnmeabitcoin.com/technical/wif
This same key creates different WIFs - and testnet flag (prefix = ef) causes WIF to starts with cV.


Title: Re: .05BTC (~$1,700) to whoever helps me successfully extract my BTC from CLI wallet
Post by: 21XO on January 09, 2021, 12:09:09 AM
Okay it worked! The private key is 52 characters and starts with cV and ends in gk


So now I should try to import it into Electrum?

Have you changed the code as i mentioned (https://bitcointalk.org/index.php?topic=5306458.msg56032561#msg56032561)?

If this part code is

Code:
extended = "ef" + privatekey + "01"

or

Code:
extended = "ef" + privatekey

then you're generating WIF for testnet network


Oh sorry I didn't change the second line. Anyways I just changed it now to "extended = "80" + privatekey" and I got a 51 character key but this one starts with 5K and ends in 4k


Title: Re: .05BTC (~$1,700) to whoever helps me successfully extract my BTC from CLI wallet
Post by: HCP on January 09, 2021, 12:26:36 AM
Oh sorry I didn't change the second line. Anyways I just changed it now to "extended = "80" + privatekey" and I got a 51 character key but this one starts with 5K and ends in 4k
Starting with a "5" seems like it is an "uncompressed" WIF private key... try importing it into Electrum and see what you get. It should generate an address that starts with a "1".


Title: Re: .05BTC (~$1,700) to whoever helps me successfully extract my BTC from CLI wallet
Post by: 21XO on January 09, 2021, 12:33:59 AM
Oh sorry I didn't change the second line. Anyways I just changed it now to "extended = "80" + privatekey" and I got a 51 character key but this one starts with 5K and ends in 4k
Starting with a "5" seems like it is an "uncompressed" WIF private key... try importing it into Electrum and see what you get. It should generate an address that starts with a "1".

Okay under "create a new wallet" I chose "import bitcoin addresses or private keys"

then I pasted my private key and created the following address:

1L4aWTjsKJCwUN9aqUwtjDZvR1anXbvDNK


Although my balance says 0 though.


Title: Re: .05BTC (~$1,700) to whoever helps me successfully extract my BTC from CLI wallet
Post by: HCP on January 09, 2021, 01:35:12 AM
Try using bitaddress.org (download and run offline)... click on "wallet details" tab, paste in the "5" WIF key and get the "compressed" WIF that starts with a "K" or "L"... then import that into Electrum, see if that shows your funds.

If it doesn't, then blockstacks was doing something "weird" in regardless to private keys etc... or that key isn't the one that holds your coins.


Title: Re: .05BTC (~$1,700) to whoever helps me successfully extract my BTC from CLI wallet
Post by: math09183 on January 14, 2021, 01:33:50 PM
Any update?
Did OP open the wallet and forgot about his promise?


Title: Re: .05BTC (~$1,700) to whoever helps me successfully extract my BTC from CLI wallet
Post by: 21XO on January 15, 2021, 05:16:31 AM
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?


Title: Re: .05BTC (~$1,700) to whoever helps me successfully extract my BTC from CLI wallet
Post by: NotATether on January 15, 2021, 09:02:27 AM
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
Code:
sudo apt install -y python2

2. Install pip for python 2 (yes we run this as root user)
Code:
sudo curl https://bootstrap.pypa.io/get-pip.py --output get-pip.py
sudo python2 get-pip.py

2. Install blockstsck-client
Code:
pip2 install blockstack-client virtualchain==0.14.0

3. Save this wallet JSON you posted to a file, like wallet.json for example.
Code:
{
"master_private_key": "ef242kfjj24ekf3223jesdkhefsfhk324wuefhw38fhrypofhtr34d342132d34jsd49",
"wallet_password": “kljsef9832nkfssf”
}

4. Run
Code:
blockstack set_advanced_mode
and type "on" to access the inport_wallet command.

5. Run
Code:
blockstack import_wallet wallet.json
, it will import your wallet from wallet.json and display your addresses.

6. To get the private keys run
Code:
blockstack wallet

It will show you output like this:

Code:
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.


Title: Re: .05BTC (~$1,700) to whoever helps me successfully extract my BTC from CLI wallet
Post by: 21XO on January 16, 2021, 07:50:02 PM
Quote
2. Install blockstsck-client
Code:
pip2 install blockstack-client virtualchain==0.14.0


I'm getting lots of errors when I run this command: https://ibb.co/rfVqcbn


Title: Re: .05BTC (~$1,700) to whoever helps me successfully extract my BTC from CLI wallet
Post by: PawGo on January 16, 2021, 07:55:14 PM
Quote
2. Install blockstsck-client
Code:
pip2 install blockstack-client virtualchain==0.14.0


I'm getting lots of errors when I run this command: https://ibb.co/rfVqcbn

show us the bottom of error


Title: Re: .05BTC (~$1,700) to whoever helps me successfully extract my BTC from CLI wallet
Post by: 21XO on January 16, 2021, 08:40:43 PM
Quote
2. Install blockstsck-client
Code:
pip2 install blockstack-client virtualchain==0.14.0


I'm getting lots of errors when I run this command: https://ibb.co/rfVqcbn

show us the bottom of error

https://ibb.co/ySLHP2y


Title: Re: .05BTC (~$1,700) to whoever helps me successfully extract my BTC from CLI wallet
Post by: PawGo on January 16, 2021, 08:42:17 PM
Quote
2. Install blockstsck-client
Code:
pip2 install blockstack-client virtualchain==0.14.0


I'm getting lots of errors when I run this command: https://ibb.co/rfVqcbn

show us the bottom of error

https://ibb.co/ySLHP2y

Code:
apt-get install python-dev


Title: Re: .05BTC (~$1,700) to whoever helps me successfully extract my BTC from CLI wallet
Post by: 21XO on January 16, 2021, 09:11:57 PM
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


Title: Re: .05BTC (~$1,700) to whoever helps me successfully extract my BTC from CLI wallet
Post by: NotATether on January 16, 2021, 11:37:49 PM
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.


Title: Re: .05BTC (~$1,700) to whoever helps me successfully extract my BTC from CLI wallet
Post by: 21XO on January 17, 2021, 12:07:34 AM
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


Title: Re: .05BTC (~$1,700) to whoever helps me successfully extract my BTC from CLI wallet
Post by: PawGo on January 17, 2021, 10:38:02 AM
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?


Title: Re: .05BTC (~$1,700) to whoever helps me successfully extract my BTC from CLI wallet
Post by: 21XO on January 17, 2021, 03:30:25 PM
Delete .blockstack folder if you have it inside your HOME.

https://ibb.co/NKdwrZm


Title: Re: .05BTC (~$1,700) to whoever helps me successfully extract my BTC from CLI wallet
Post by: PawGo on January 17, 2021, 03:44:51 PM
You must have somewhere the folder in which blockstack keeps configuration and wallet.
Maybe try from the console:
Code:
 rm -rf ~/.blockstack/ 


Title: Re: .05BTC (~$1,700) to whoever helps me successfully extract my BTC from CLI wallet
Post by: 21XO on January 17, 2021, 03:48:30 PM
Code:
parallels@parallels-Parallels-Virtual-Platform:~$ rm -rf ~/.blockstack/
parallels@parallels-Parallels-Virtual-Platform:~$


Title: Re: .05BTC (~$1,700) to whoever helps me successfully extract my BTC from CLI wallet
Post by: NotATether on January 17, 2021, 11:12:51 PM
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?



https://i.ibb.co/r7jZvy8/Screen-Shot-2021-01-16-at-6-05-32-PM.png

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


Title: Re: .05BTC (~$1,700) to whoever helps me successfully extract my BTC from CLI wallet
Post by: 21XO on January 17, 2021, 11:51:20 PM
Do I just search /home/parallels/.local/bin/blockstack in Finder? Sorry please excuse my ignorance.

https://ibb.co/6nSw2Pv


Title: Re: .05BTC (~$1,700) to whoever helps me successfully extract my BTC from CLI wallet
Post by: NotATether on January 17, 2021, 11:53:12 PM
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.


Title: Re: .05BTC (~$1,700) to whoever helps me successfully extract my BTC from CLI wallet
Post by: 21XO on January 17, 2021, 11:55:54 PM
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


Title: Re: .05BTC (~$1,700) to whoever helps me successfully extract my BTC from CLI wallet
Post by: NotATether on January 18, 2021, 01:15:04 AM
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.


Title: Re: .05BTC (~$1,700) to whoever helps me successfully extract my BTC from CLI wallet
Post by: 21XO on January 18, 2021, 02:49:59 AM
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.


Title: Re: .05BTC (~$1,700) to whoever helps me successfully extract my BTC from CLI wallet
Post by: HCP on January 18, 2021, 04:14:38 AM
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 (https://bitcointalk.org/index.php?topic=5306458.msg56122343#msg56122343) 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


Title: Re: .05BTC (~$1,700) to whoever helps me successfully extract my BTC from CLI wallet
Post by: 21XO on January 18, 2021, 04:27:05 AM
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


Title: Re: .05BTC (~$1,700) to whoever helps me successfully extract my BTC from CLI wallet
Post by: PawGo on January 18, 2021, 07:31:56 AM
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...


Title: Re: .05BTC (~$1,700) to whoever helps me successfully extract my BTC from CLI wallet
Post by: NotATether on January 18, 2021, 10:06:53 AM
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.


Title: Re: .05BTC (~$1,700) to whoever helps me successfully extract my BTC from CLI wallet
Post by: PawGo on January 18, 2021, 10:09:11 AM
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


Title: Re: .05BTC (~$1,700) to whoever helps me successfully extract my BTC from CLI wallet
Post by: NotATether on January 19, 2021, 07:05:52 PM
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!  :D

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

I actually don't need that but thanks anyway :)


Title: Re: .05BTC (~$1,700) to whoever helps me successfully extract my BTC from CLI wallet
Post by: PawGo on January 19, 2021, 07:13:51 PM


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.




Title: Re: .05BTC (~$1,700) to whoever helps me successfully extract my BTC from CLI wallet
Post by: NotATether on January 19, 2021, 07:26:25 PM
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


Title: Re: .05BTC (~$1,700) to whoever helps me successfully extract my BTC from CLI wallet
Post by: PawGo on January 19, 2021, 07:35:53 PM
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.


Title: Re: .05BTC (~$1,700) to whoever helps me successfully extract my BTC from CLI wallet
Post by: escobol on January 20, 2021, 01:39:28 AM
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.





Title: Re: .05BTC (~$1,700) to whoever helps me successfully extract my BTC from CLI wallet
Post by: 21XO on January 20, 2021, 05:25:41 AM
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).


Title: Re: .05BTC (~$1,700) to whoever helps me successfully extract my BTC from CLI wallet
Post by: NotATether on January 20, 2021, 05:32:22 AM
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.


Title: Re: .05BTC (~$1,700) to whoever helps me successfully extract my BTC from CLI wallet
Post by: NotATether on January 20, 2021, 08:53:44 AM
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?

Quote from: blockstack_client/config.py
Code:
# epoch dates
EPOCH_1_END_BLOCK = 436650

# ...snip

EPOCH_HEIGHT_MINIMUM = EPOCH_1_END_BLOCK + 1

Quote from: blockstack_client/wallet.py
Code:
def make_wallet( password, hex_privkey=None, payment_privkey_info=None, owner_privkey_info=None, data_privkey_info=None, config_path=CONFIG_PATH ):
    """
    Make a wallet structure.
    By default, the owner and payment keys will be key bundles set up to require 2-of-3 signatures.
    @payment_privkey_info, @owner_privkey_info, and @data_privkey_info can either be individual private keys, or
    dicts with {'redeem_script': ..., 'private_keys': ...} defined.

    Return the new wallet on success.
    Return {'error': ...} on failure
    """

    # ... more stuff snipped

    multisig = False
    curr_height = get_block_height( config_path=config_path )
    if curr_height >= config.EPOCH_HEIGHT_MINIMUM:
        # safe to use multisig
        multisig = True

    # default to 2-of-3 multisig key info if data isn't given
    if payment_privkey_info is None:
        if multisig:
            payment_privkey_info = virtualchain.make_multisig_wallet( 2, 3 )
        else:
            payment_privkey_info = virtualchain.BitcoinPrivateKey().to_wif()

    if not is_singlesig(payment_privkey_info) and not is_multisig(payment_privkey_info):
        return {'error': 'Payment private key info must be either a single private key or a multisig bundle'}

    if not multisig and is_multisig(payment_privkey_info):
        return {'error': 'Multisig payment private key info is not supported'}

    if owner_privkey_info is None:
        if multisig:
            owner_privkey_info = virtualchain.make_multisig_wallet( 2, 3 )
        else:
            owner_privkey_info = virtualchain.BitcoinPrivateKey().to_wif()



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.


Title: Re: .05BTC (~$1,700) to whoever helps me successfully extract my BTC from CLI wallet
Post by: bob123 on January 20, 2021, 12:04:58 PM
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..


Title: Re: .05BTC (~$1,700) to whoever helps me successfully extract my BTC from CLI wallet
Post by: escobol on January 20, 2021, 06:04:15 PM
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.


Title: Re: .05BTC (~$1,700) to whoever helps me successfully extract my BTC from CLI wallet
Post by: escobol on January 20, 2021, 06:10:30 PM
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?

Quote from: blockstack_client/config.py
Code:
# epoch dates
EPOCH_1_END_BLOCK = 436650

# ...snip

EPOCH_HEIGHT_MINIMUM = EPOCH_1_END_BLOCK + 1

Quote from: blockstack_client/wallet.py
Code:
def make_wallet( password, hex_privkey=None, payment_privkey_info=None, owner_privkey_info=None, data_privkey_info=None, config_path=CONFIG_PATH ):
    """
    Make a wallet structure.
    By default, the owner and payment keys will be key bundles set up to require 2-of-3 signatures.
    @payment_privkey_info, @owner_privkey_info, and @data_privkey_info can either be individual private keys, or
    dicts with {'redeem_script': ..., 'private_keys': ...} defined.

    Return the new wallet on success.
    Return {'error': ...} on failure
    """

    # ... more stuff snipped

    multisig = False
    curr_height = get_block_height( config_path=config_path )
    if curr_height >= config.EPOCH_HEIGHT_MINIMUM:
        # safe to use multisig
        multisig = True

    # default to 2-of-3 multisig key info if data isn't given
    if payment_privkey_info is None:
        if multisig:
            payment_privkey_info = virtualchain.make_multisig_wallet( 2, 3 )
        else:
            payment_privkey_info = virtualchain.BitcoinPrivateKey().to_wif()

    if not is_singlesig(payment_privkey_info) and not is_multisig(payment_privkey_info):
        return {'error': 'Payment private key info must be either a single private key or a multisig bundle'}

    if not multisig and is_multisig(payment_privkey_info):
        return {'error': 'Multisig payment private key info is not supported'}

    if owner_privkey_info is None:
        if multisig:
            owner_privkey_info = virtualchain.make_multisig_wallet( 2, 3 )
        else:
            owner_privkey_info = virtualchain.BitcoinPrivateKey().to_wif()



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


Title: Re: .05BTC (~$1,700) to whoever helps me successfully extract my BTC from CLI wallet
Post by: 21XO on January 20, 2021, 07:31:50 PM
Quote
436650 date is 30/10/2016 (so question to OP - when wallet was created?)

April 2016


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


Title: Re: .05BTC (~$1,700) to whoever helps me successfully extract my BTC from CLI wallet
Post by: NotATether on January 20, 2021, 07:40:01 PM
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.


Title: Re: .05BTC (~$1,700) to whoever helps me successfully extract my BTC from CLI wallet
Post by: 21XO on January 20, 2021, 07:59:34 PM
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$


Title: Re: .05BTC (~$1,700) to whoever helps me successfully extract my BTC from CLI wallet
Post by: NotATether on January 20, 2021, 09:28:14 PM
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.


Title: Re: .05BTC (~$1,700) to whoever helps me successfully extract my BTC from CLI wallet
Post by: 21XO on January 20, 2021, 10:16:03 PM
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


Title: Re: .05BTC (~$1,700) to whoever helps me successfully extract my BTC from CLI wallet
Post by: escobol on January 21, 2021, 08:59:15 PM
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 :)

https://i.ibb.co/By8nX7Z/btc2.png (https://ibb.co/By8nX7Z)

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



Title: Re: .05BTC (~$1,700) to whoever helps me successfully extract my BTC from CLI wallet
Post by: 21XO on January 27, 2021, 09:21:53 PM
Can someone confirm that Escobol's code is safe for me to try?


Title: Re: .05BTC (~$1,700) to whoever helps me successfully extract my BTC from CLI wallet
Post by: 21XO on January 27, 2021, 09:30:48 PM
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


Title: Re: .05BTC (~$1,700) to whoever helps me successfully extract my BTC from CLI wallet
Post by: NotATether on January 28, 2021, 02:55:49 AM
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.


Title: Re: .05BTC (~$1,700) to whoever helps me successfully extract my BTC from CLI wallet
Post by: escobol on January 29, 2021, 04:41:55 PM
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).


Title: Re: .05BTC (~$1,700) to whoever helps me successfully extract my BTC from CLI wallet
Post by: NotATether on January 31, 2021, 05:26:08 AM
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.


Title: Re: .05BTC (~$1,700) to whoever helps me successfully extract my BTC from CLI wallet
Post by: escobol on January 31, 2021, 01:34:13 PM
check

Code:
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.


Title: Re: .05BTC (~$1,700) to whoever helps me successfully extract my BTC from CLI wallet
Post by: NotATether on February 04, 2021, 05:02:43 PM
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:

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


Title: Re: .05BTC (~$1,700) to whoever helps me successfully extract my BTC from CLI wallet
Post by: 21XO on February 04, 2021, 10:25:16 PM
Okay I pasted the updated code in text editor and saved it as 'dirty.py' on my desktop (where my wallet.json) file is. Here is what I got from Terminal:

Code:
parallels@parallels-Parallels-Virtual-Platform:~/Desktop$ python2 dirty.py wallet.json wallet2.json
Traceback (most recent call last):
  File "dirty.py", line 7, in <module>
    from registrar.wallet import HDWallet
ImportError: No module named registrar.wallet
parallels@parallels-Parallels-Virtual-Platform:~/Desktop$





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:

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


Title: Re: .05BTC (~$1,700) to whoever helps me successfully extract my BTC from CLI wallet
Post by: HCP on February 04, 2021, 10:37:09 PM
Did you do all of the steps that escobol mentioned in their earlier post:
check

Code:
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

The important one is:
Code:
pip2 install registrar==0.0.3.4


Title: Re: .05BTC (~$1,700) to whoever helps me successfully extract my BTC from CLI wallet
Post by: 21XO on February 04, 2021, 11:56:53 PM
Omg I think it worked...

Code:
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?


Title: Re: .05BTC (~$1,700) to whoever helps me successfully extract my BTC from CLI wallet
Post by: escobol on February 04, 2021, 11:57:34 PM
payment_addresses: ['194zW3CDXCuhx24quQcDaJBKwmonxxkK7N']
payment_key_hex xxx
WIF payment: xxx

Omg I think it worked...

Code:
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?


Title: Re: .05BTC (~$1,700) to whoever helps me successfully extract my BTC from CLI wallet
Post by: 21XO on February 05, 2021, 12:17:24 AM
VICTORY!!!!!!!!! Thank you all so much!!!


One last thing: all the forks (e.g. bitcoin cash) is also connected with my BTC...so when I send out BTC to anther wallet, will it also send out BCH?



And I will split the bounty with escobol and NotATether but let me know if anyone feels I should also send them some extra BTC for their help.






So grateful to all you guys.


Title: Re: .05BTC (~$1,700) to whoever helps me successfully extract my BTC from CLI wallet
Post by: NotATether on February 05, 2021, 04:06:23 AM
VICTORY!!!!!!!!! Thank you all so much!!!

Awesome, glad that it worked out for you. We almost got stumped at the part to extract the private keys but escobol gave us the final push!

One last thing: all the forks (e.g. bitcoin cash) is also connected with my BTC...so when I send out BTC to anther wallet, will it also send out BCH?

Sending the BTC to some other address will only send that BTC by itself and no forks. You should follow LoyceV's fork claiming guide (https://bitcointalk.org/index.php?topic=2836875.0) to claim your BCH and BSV.

And I will split the bounty with escobol and NotATether but let me know if anyone feels I should also send them some extra BTC for their help.

I personally feel that you should also share it with PawGo, he has corrected several steps in my process without which you wouldn't have blockstack installed in the first place. Just my two sats.

P.S. I'm also planning to fork the blockstack client legacy code and add those two commands to import a wallet and extract the private keys for anyone else trying to get their coins out of blockstack.


Title: Re: .05BTC (~$1,700) to whoever helps me successfully extract my BTC from CLI wallet
Post by: 21XO on February 05, 2021, 04:18:12 AM
Sorry PawGo, didn't mean to leave you out.

Okay I will send .033 to NotATether, .033 to escobol, and .033 to PawGo. I will keep .9 :)


Please PM me your addresses!


Title: Re: .05BTC (~$1,700) to whoever helps me successfully extract my BTC from CLI wallet
Post by: NotATether on February 05, 2021, 05:33:04 AM
Sorry PawGo, didn't mean to leave you out.

Okay I will send .033 to NotATether, .033 to escobol, and .033 to PawGo. I will keep .9 :)


Please PM me your addresses!

One last thing, which of the three private keys were your bitcoins in? Owner, payment, or that master key?


Title: Re: .05BTC (~$1,700) to whoever helps me successfully extract my BTC from CLI wallet
Post by: 21XO on February 05, 2021, 05:46:16 AM
Sorry PawGo, didn't mean to leave you out.

Okay I will send .033 to NotATether, .033 to escobol, and .033 to PawGo. I will keep .9 :)


Please PM me your addresses!

One last thing, which of the three private keys were your bitcoins in? Owner, payment, or that master key?

Payment


Title: Re: .05BTC (~$1,700) to whoever helps me successfully extract my BTC from CLI wallet
Post by: PawGo on February 05, 2021, 06:57:09 AM

One last thing: all the forks (e.g. bitcoin cash) is also connected with my BTC...so when I send out BTC to anther wallet, will it also send out BCH?


Congratulations!

Remember that now you have a lot of forks... You may check here: http://www.findmycoins.ninja/
Only BCH has some sensible value, but if you want to play, now you may collect many of them. Just be careful with software you install (maybe do it on virtual machine) and do it after you empty BTC.



Title: Re: .05BTC (~$1,700) to whoever helps me successfully extract my BTC from CLI wallet
Post by: LoyceV on February 05, 2021, 08:51:23 AM
Nice to see this resolved! I've added this topic to my [overview] Recover Bitcoin from any old storage format (https://bitcointalk.org/index.php?topic=4959742.0).

I was able to download Blockstack .18 on Ubuntu thanks to the instructions PawGo gave my via DM (thanks PawGo).
@PawGo: can you post your instructions here for future reference?

Okay I will send .033 to NotATether, .033 to escobol, and .033 to PawGo. I will keep .9 :)
It's great to see you keep your promise!

@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?

Remember that now you have a lot of forks... You may check here: http://www.findmycoins.ninja/
Only BCH has some sensible value, but if you want to play, now you may collect many of them. Just be careful with software you install (maybe do it on virtual machine) and do it after you empty BTC.
If there was 1 Bitcoin in the address, you're looking at appromately these amounts:
BCH: $400
BSV: $165
BCH-A: $15
BTG: $8
BCD: $5
Some of the others have some value too, but I haven't figured out yet how to claim them.
Don't forget there's no replay protection between the first 3. If you want, I can send you some BCH dust so you can move it without moving your BSV/BCH-A.


Title: Re: .05BTC (~$1,700) to whoever helps me successfully extract my BTC from CLI wallet
Post by: escobol on February 05, 2021, 09:53:29 AM
Started with #80
LAter #102 and #103

Nice to see this resolved! I've added this topic to my [overview] Recover Bitcoin from any old storage format (https://bitcointalk.org/index.php?topic=4959742.0).

I was able to download Blockstack .18 on Ubuntu thanks to the instructions PawGo gave my via DM (thanks PawGo).
@PawGo: can you post your instructions here for future reference?

Okay I will send .033 to NotATether, .033 to escobol, and .033 to PawGo. I will keep .9 :)
It's great to see you keep your promise!

@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?

Remember that now you have a lot of forks... You may check here: http://www.findmycoins.ninja/
Only BCH has some sensible value, but if you want to play, now you may collect many of them. Just be careful with software you install (maybe do it on virtual machine) and do it after you empty BTC.
If there was 1 Bitcoin in the address, you're looking at appromately these amounts:
BCH: $400
BSV: $165
BCH-A: $15
BTG: $8
BCD: $5
Some of the others have some value too, but I haven't figured out yet how to claim them.
Don't forget there's no replay protection between the first 3. If you want, I can send you some BCH dust so you can move it without moving your BSV/BCH-A.



Title: Re: .05BTC (~$1,700) to whoever helps me successfully extract my BTC from CLI wallet
Post by: escobol on February 05, 2021, 09:56:12 AM
@NotATether
[child[0]]

Sorry PawGo, didn't mean to leave you out.

Okay I will send .033 to NotATether, .033 to escobol, and .033 to PawGo. I will keep .9 :)


Please PM me your addresses!

One last thing, which of the three private keys were your bitcoins in? Owner, payment, or that master key?

Payment


Title: Re: .05BTC (~$1,700) to whoever helps me successfully extract my BTC from CLI wallet
Post by: PawGo on February 05, 2021, 01:33:27 PM
I was able to download Blockstack .18 on Ubuntu thanks to the instructions PawGo gave my via DM (thanks PawGo).
@PawGo: can you post your instructions here for future reference?

I used cygwin on Windows (https://www.cygwin.com/) but if you have Ubuntu, the actions should be this same. For me it was easier to emulate linux using cygwin, that's why I tried.
So, download the installation package and launch. It will connect to server and try to download needed packaged. You may select packages you want - or first install empty cygwin and then launch installation again just to add missing packages.
I send you the list of all packages I have - as I wrote before you will need python2-devel and libssl-devel packages. And python2.7 of course. The rest normally comes with the installation. Maybe I am missing something - I had this environment configured before - but I think it will be easy to find which package is required.
https://ibb.co/dPJ3sQz
https://ibb.co/b3mF0Ww
https://ibb.co/xjqxrQ7

then you receive access to console.
I have launched
Code:
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
Code:
python2.7 get-pip.py
Code:
python2.7 -m pip install --upgrade pip
Code:
python2.7 -m pip install onedrivesdk==1.1.8
Code:
python2.7 -m pip install blockstack==0.18.0.10

and now blockstack is installed

Code:
$ blockstack --version
/usr/lib/python2.7/site-packages/virtualchain/lib/ecdsalib.py:26: 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
0.18.0.10

--------

@NotATether: you may mark this post, and maybe also one of (already merited by ETFbitcoin):
https://bitcointalk.org/index.php?topic=5306458.msg56010431#msg56010431
https://bitcointalk.org/index.php?topic=5306458.msg56011477#msg56011477
https://bitcointalk.org/index.php?topic=5306458.msg56017358#msg56017358
My other posts you merited already ;)



Title: Re: .05BTC (~$1,700) to whoever helps me successfully extract my BTC from CLI wallet
Post by: NotATether on February 05, 2021, 03:59:04 PM
@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
Code:
sudo apt install -y python2

2. Install pip for python 2 (yes we run this as root user)
Code:
sudo curl https://bootstrap.pypa.io/get-pip.py --output get-pip.py
sudo python2 get-pip.py

2. Install blockstsck-client
Code:
pip2 install blockstack-client virtualchain==0.14.0

3. Save this wallet JSON you posted to a file, like wallet.json for example.
Code:
{
"master_private_key": "ef242kfjj24ekf3223jesdkhefsfhk324wuefhw38fhrypofhtr34d342132d34jsd49",
"wallet_password": “kljsef9832nkfssf”
}

4. Run
Code:
blockstack set_advanced_mode
and type "on" to access the inport_wallet command.

5. Run
Code:
blockstack import_wallet wallet.json
, it will import your wallet from wallet.json and display your addresses.

6. To get the private keys run
Code:
blockstack wallet

It will show you output like this:

Code:
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.



Quote
2. Install blockstsck-client
Code:
pip2 install blockstack-client virtualchain==0.14.0


I'm getting lots of errors when I run this command: https://ibb.co/rfVqcbn

show us the bottom of error

https://ibb.co/ySLHP2y

Code:
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:
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 :)

https://i.ibb.co/By8nX7Z/btc2.png (https://ibb.co/By8nX7Z)

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





check

Code:
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:

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_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: xxx

Omg I think it worked...

Code:
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 ::) :-[


Title: Re: .05BTC (~$1,700) to whoever helps me successfully extract my BTC from CLI wallet
Post by: NotATether on February 08, 2021, 05:57:43 PM
P.S. I'm also planning to fork the blockstack client legacy code and add those two commands to import a wallet and extract the private keys for anyone else trying to get their coins out of blockstack.

Unfortunately this is going to take a wee bit longer than I planned because I have to port escobol's code to Python 3. If I run it on Python 2, the registrar Python module introduces dependency hell which prevents it from being installed from a setup.py.


Title: Re: .05BTC (~$1,700) to whoever helps me successfully extract my BTC from CLI wallet
Post by: math09183 on February 10, 2021, 07:29:58 AM
Incredible story! Congratulations! Both to OP and to people who helped!

Please forgive me if I was sceptical, but in the past I had bad experience with user who needed help and at the end it was find out he was just a Russian fake wallet seller...
https://bitcointalk.org/index.php?topic=5245680.0


Title: Re: .05BTC (~$1,700) to whoever helps me successfully extract my BTC from CLI wallet
Post by: rama_rao on February 11, 2021, 09:03:04 AM
Incredible story! Congratulations! Both to OP and to people who helped!

Please forgive me if I was sceptical, but in the past I had bad experience with user who needed help and at the end it was find out he was just a Russian fake wallet seller...
https://bitcointalk.org/index.php?topic=5245680.0

Yes, I always think it's someone trying to scam someone. But this is the first thread I saw where people helped other people and got their fair share. Guess I'm browsing wrong kinda forums till now... 😂