multibit_recovery icon indicating copy to clipboard operation
multibit_recovery copied to clipboard

Line 156 in Windows - Wont work.

Open frederickmorty opened this issue 7 years ago • 5 comments

Loads allright, runs and finds 2 wallets with balance but then gets this error:

Traceback (most recent call last): File "find_unspent_multibitHD_txes.py", line 256, in wallet = load_wallet(wallet_file, get_password) File "find_unspent_multibitHD_txes.py", line 156, in load_wallet faddr = bitcoin.bin_to_b58check(bitcoin.deserialize_script(out.script_bytes) [2]) File "c:\python27\lib\site-packages\bitcoin\py2specials.py", line 43, in bin_t o_b58check inp_fmtd = chr(int(magicbyte)) + inp TypeError: cannot concatenate 'str' and 'int' objects

And makes file but its all mangled: encrypted_private_key: "\306\211\241\334\231(\027\241s****

Everything looks this way, like encrypted over encryption.

Tested on Windows 7 and windows 10

frederickmorty avatar Jul 08 '17 23:07 frederickmorty

Very curious, it would appear that the "output" in one of the unspent transactions is not what the script is expecting.

Specifically, it is failing when attempting to extract the output address from the transactions output script.

I suspect that one of the unspent transactions was sending money to a multiSig address and getting some change back and the script may be choking when it is attempting to deal with the MultiSig output...

here is a modded "debug" version of the script that dumps out the the raw transaction output so we can see exactly what data it is "choking". https://pastebin.com/1EUMusyR

Can you provide the "script_bytes" that it outputs? It doesn't contain anything sensitive... it is the same information that is stored in the blockchain for that transaction :) The transactionID would also be helpful 👍

Also, the file data isn't "mangled" as such... that is just the binary data representation in ASCII form. But yes, it is indeed stored encrypted... hence "encrypted_private_key" ;)

HardCorePawn avatar Jul 10 '17 02:07 HardCorePawn

Just ran into the same issue:

Traceback (most recent call last):
  File "find_unspent_multibitHD_txes.py", line 257, in <module>
    wallet = load_wallet(wallet_file, get_password)
  File "find_unspent_multibitHD_txes.py", line 156, in load_wallet
    faddr = bitcoin.bin_to_b58check(bitcoin.deserialize_script(out.script_bytes)[2])
  File "/Users/ulises/Downloads/decrypt_bitcoinj_seed-master/venv/lib/python2.7/site-packages/bitcoin/py2specials.py", line 43, in bin_to_b58check
    inp_fmtd = chr(int(magicbyte)) + inp
TypeError: cannot concatenate 'str' and 'int' objects

Will try with the debug version of the script.

ulises avatar Aug 24 '17 19:08 ulises

I just ran into this same problem:

C:\Users\travi\Desktop\multibit_recovery-master\multibit_recovery-master>debug_find_unspent_multibithd_txes.py mbhd.wallet.aes
terminal does not support UTF; passwords with non-ASCII chars might not work
This wallet file is encrypted, please enter its password:
--------------------------------------------------------------------------------
TXID: 9a52abf94a63907544e195228f7b5a1fc7a8a40a66b4984ec7c1cd7e89cf86ab

value: 148770666
script_bytes: "\251\024\365#E2A****"

Traceback (most recent call last):
  File "C:\Users\travi\Desktop\multibit_recovery-master\multibit_recovery-master\debug_find_unspent_multibithd_txes.py", line 257, in <module>
    wallet = load_wallet(wallet_file, get_password)
  File "C:\Users\travi\Desktop\multibit_recovery-master\multibit_recovery-master\debug_find_unspent_multibithd_txes.py", line 157, in load_wallet
    faddr = bitcoin.bin_to_b58check(bitcoin.deserialize_script(out.script_bytes)[2])
  File "C:\Python27\lib\site-packages\bitcoin\py2specials.py", line 43, in bin_to_b58check
    inp_fmtd = chr(int(magicbyte)) + inp
TypeError: cannot concatenate 'str' and 'int' objects

C:\Users\travi\Desktop\multibit_recovery-master\multibit_recovery-master>

How can I decrypt the information that is in the parsed_wallet.txt file that looks like this (\251\024\365#E2AA****)?

grnqrtr avatar Dec 11 '17 13:12 grnqrtr

AWESOME... thanks for the output! That is exactly what I needed.

Ok... so looking at that, it seems the code is not handling a certain type of transaction correctly... it is expecting the address to be the THIRD item in the out.script_bytes array...

(out.script_bytes)[2]

But by decoding those script_bytes manually, we can see the address is actually the SECOND item in the out.script_bytes array:

script_bytes output is just "binary" data... it decodes to: 'a914f523453241411514e194c8422e604769013abc8087'

which deserialises from bitcoin script as: bitcoin.deserialize_script(out.script_bytes) => [169, 'f523453241411514e194c8422e604769013abc80', 135]

This translastes as: OP_HASH160 f523453241411514e194c8422e604769013abc80 OP_EQUAL

f523453241411514e194c8422e604769013abc80 converts to address: '1PMAod4V8n5DBe4C8SjEJHnxsHdyvzXvcu'

Is that address one of yours?

Also, can you try THIS debug version and see if it works: https://pastebin.com/VsgdfqV7

I've tried to make it a bit "smarter" ;)

HardCorePawn avatar Dec 11 '17 14:12 HardCorePawn

Hey, thanks for the quick reply! I ended up figuring out what I needed, but I ran your debug2 and captured the output if you would like to see it. Could I send it to you privately over email since it may contain sensitive information? [email protected]

grnqrtr avatar Dec 12 '17 12:12 grnqrtr