trezor / python-trezor

:snake: Don't use this repo, use the new monorepo instead:
https://github.com/trezor/trezor-firmware
GNU Lesser General Public License v3.0
201 stars 194 forks source link

Is there a way to restore seed words in scrambled order? #373

Closed cculianu closed 5 years ago

cculianu commented 5 years ago

Hi,

Electron Cash dev here. I pass the recover type Scrambled to the lib -- but the seed recovery process still asks for the words in sequential order (1, 2, 3... etc).

Is there a way to make the recovery process actually use a scrambled word order like the website does?

I'm on a Model T and on the little white Trezor. Both have the same problem using trezorlib.

prusnak commented 5 years ago

Show us your code, please

cculianu commented 5 years ago

Wait -- so it's supposed to work? Maybe there is a bug in the code then. This is the Electron Cash project -- the codebase to the trezor support is huge and contorted. Here where you can look:

https://github.com/Electron-Cash/Electron-Cash/blob/master/plugins/trezor/clientbase.py#L222

Electrum has the same problem though.

https://github.com/spesmilo/electrum/tree/master/electrum/plugins/trezor

cculianu commented 5 years ago

I even hard-coded 'ScrambledWords' in there to test:

    def recover_device(self, recovery_type, *args, **kwargs):
        input_callback = self.mnemonic_callback(recovery_type)
        with self.run_flow():
            kwargs.pop('type', None)
            print("HARD CODED RECOVERY TYPE", RecoveryDeviceType.ScrambledWords)
            return trezorlib.device.recover(
                self.client,
                *args,
                input_callback=input_callback,
                type=RecoveryDeviceType.ScrambledWords,
                **kwargs)

And it's still not scrambled...

The output of the above is :

| 14.434| |12| [DeviceMgr] scanning devices...
HARD CODED RECOVERY TYPE 0

So it definitely gets there and hangs there waiting for the user to do the recovery -- but the words are not scrambled.

cculianu commented 5 years ago

FYI: I'm using trezorlib 0.11.2 release..

cculianu commented 5 years ago

Update: This works perfectly on a Trezor One (the little white one) but not on a Model T.

prusnak commented 5 years ago

On Model T you enter the words on the device, not on the computer. No need to scramble them.

cculianu commented 5 years ago

Gotcha. Thanks.