Author

Topic: Import Android wallet to Trezor [SOLVED] (Read 161 times)

full member
Activity: 210
Merit: 101
“Create Your Decentralized Life”
December 28, 2017, 04:55:43 PM
#7
Oh... right, so you weren't actually after the key data...

Sure I was.  I wanted the Trezor to obtain the proper key data.  Never thought the Trezor would give that data to me.

Reason I went on the BIP39 route instead of the BIP32 route was the availability of decrypt_bitcoinj_seed.  I have a hate in my heart for Java, and there is a special spot in heaven for those that labor through it.  A python / nodejs solution was much more to my liking.

If you wanted to do the BIP32 route, I believe that the BIP32 xpriv is extractable from the protobuf as well.  I generated some random BIP32 nodes and verified that Trezor accepted them just fine.
HCP
legendary
Activity: 2086
Merit: 4314
December 28, 2017, 04:45:40 AM
#6
Oh... right, so you weren't actually after the key data... you just wanted to load a BIP39 seed with a custom derivation path and then use that in conjuction with your Trezor on an ongoing basis...

sorry, got confused when you said:
... Since both of these can be loaded into a Trezor, has anyone tried this to see if they get the proper key data?

Given that the "sign_transaction" command will also accept the m/0'/0 address argument, there should be no issues making your Trezor work like this... except of course the fact that you need to use trezorctl to do anything with it Tongue

Still, nice to know that it can be done... that's another plus for Trezor!
full member
Activity: 210
Merit: 101
“Create Your Decentralized Life”
December 27, 2017, 06:04:41 PM
#5
Yep... totally works...  Here's the howto.

Required tools:
  • The wallet backup file
  • A trezor your willing to wipe
  • A laptop with Python

Walk through

Code:
pip install git+git://github.com/trezor/python-trezor.git@888b6f9
pip install protobuf pylibscrypt
git clone https://github.com/gurnec/decrypt_bitcoinj_seed.git
cd decrypt_bitcoinj_seed
git checkout a9e6ae3
git checkout -b commit_a9e6ae3
pythonw decrypt_bitcoinj_seed.pyw


trezorctl wipe_device
trezorctl load_device -m ""
trezorctl get_address -n "m/0'/0/0"

Few things to note
  • The last step above should match the first receiving address you android wallet generated.
  • Decrypting a wallet exposes the keys to memory and a host of other attack vectors.  Know the risks, or try this on an empty wallet.
  • Wiping a trezor will force you to recover it through recovery.  If you forgot your trezor mnemonic, things will end poorly.
  • Trezor SW uses a different derivation path than this android wallet.  You will need to use trezor python tools or API libraries to do anything useful.
  • The above checks out the specific revisions on these repos as of Dec 24th (approx).  If you want new code, be aware.

HCP
legendary
Activity: 2086
Merit: 4314
December 26, 2017, 08:07:32 PM
#4
Unfortunately, I don't think it will work. Undecided

The "load_device" command will allow you to load the mnemonic or xprv...
Code:
Usage: trezorctl load_device [OPTIONS]

  Load custom configuration to the device.

Options:
  -m, --mnemonic TEXT
  -e, --expand
  -x, --xprv TEXT
  -p, --pin TEXT
  -r, --passphrase-protection
  -l, --label TEXT
  -i, --ignore-checksum
  -s, --slip0014
  --help                       Show this message and exit.

but there is no command that you can issue that will cough up private keys etc... The best I can see is get_address, command which will return an address for a specified coin type and derivation path, but I don't see a way to get the private key data... Sad
Code:
Usage: trezorctl get_address [OPTIONS]

  Get address for specified path.

Options:
  -c, --coin TEXT
  -n, --address TEXT              BIP-32 path, e.g. m/44'/0'/0'/0/0
                                  [required]
  -t, --script-type [address|segwit|p2shsegwit]
  -d, --show-display
  --help                          Show this message and exit.

Only the "pubkey" using get_public_node:
Code:
Usage: trezorctl get_public_node [OPTIONS]

  Get public node of given path.

Options:
  -c, --coin TEXT
  -n, --address TEXT  BIP-32 path, e.g. m/44'/0'/0'  [required]
  -e, --curve TEXT
  -d, --show-display
  --help              Show this message and exit.

which returns the following:
Code:
node.public_key: 03edc955f8d1d49d6fdc11c183063f58320c969c7b5d7e6f5705523b9ef19bbd24
node.depth: 2
node.chain_code: 7551a39e04e7fa60643409a92f5135240673c0a2ddf4970bd14ee22f6a953945
node.child_num: 0
node.fingerprint: df26a6b1
xpub: xpub6BQmKf6WWF63QP6zTEZF4cmbdfS7ziZWh3NECMeV69cFhD2u3aMZPb9ptVy8g1zx9WYwRMNzkxDs7s2vHiXyaGtagcy26XSXyk5vXC2838q
full member
Activity: 210
Merit: 101
“Create Your Decentralized Life”
December 23, 2017, 12:13:31 PM
#3
trezorctl allows any derivation
HCP
legendary
Activity: 2086
Merit: 4314
December 23, 2017, 08:44:31 AM
#2
I was under the impression that you cannot use a "custom derivation path" in a Trezor... for BTC it will always use m/44'/0'/0' as it is a BIP44 compatible hardware wallet.

Your seed will still likely work, as it is still a BIP39 seed...  but without the ability to specify the "non-BIP44" derivation path that Android Bitcoin Wallet uses, you will NOT be able to seed the same addresses as generated by the Android app.
full member
Activity: 210
Merit: 101
“Create Your Decentralized Life”
December 23, 2017, 12:11:55 AM
#1
Anyone try this.... thought it might be fun.

So I saw in decrypt threads that someone was able to extract the BIP32 key and derivation path.  Since both of these can be loaded into a Trezor, has anyone tried this to see if they get the proper key data?  I plan to... but not till next year.  Too much to do right now.  Maybe we can get a thread started to try to figure out the gotchas before I dig to deep.

Thx
Jump to: