Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v2.6 - Trezor file won't load on startup #1637

Closed
ELM4Ever opened this issue Jan 17, 2016 · 17 comments
Closed

v2.6 - Trezor file won't load on startup #1637

ELM4Ever opened this issue Jan 17, 2016 · 17 comments
Assignees

Comments

@ELM4Ever
Copy link

OSX 10.11.2 (El Capitan) - Electrum latest git pull (v2.6).

Upon starting Electrum, if the default wallet is a Trezor type - Electrum crashes with:

v2.5.4 works ok.

Traceback (most recent call last):
File "/usr/local/bin/electrum", line 5, in
pkg_resources.run_script('Electrum==2.6', 'electrum')
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py", line 492, in run_script
self.require(requires)[0].run_script(script_name, ns)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py", line 1350, in run_script
execfile(script_filename, namespace, namespace)
File "/Library/Python/2.7/site-packages/Electrum-2.6-py2.7.egg/EGG-INFO/scripts/electrum", line 350, in
gui.main()
File "/Library/Python/2.7/site-packages/Electrum-2.6-py2.7.egg/electrum_gui/qt/init.py", line 185, in main
self.config.get('url')):
File "/Library/Python/2.7/site-packages/Electrum-2.6-py2.7.egg/electrum_gui/qt/init.py", line 157, in start_new_window
wallet = self.daemon.load_wallet(path, self.get_wizard)
File "/Library/Python/2.7/site-packages/Electrum-2.6-py2.7.egg/electrum/daemon.py", line 131, in load_wallet
wallet = Wallet(storage)
File "/Library/Python/2.7/site-packages/Electrum-2.6-py2.7.egg/electrum/wallet.py", line 1948, in new
wallet = WalletClass(storage)
File "/Library/Python/2.7/site-packages/Electrum-2.6-py2.7.egg/electrum/plugins.py", line 125, in dynamic_constructor
return self.wallet_plugin_loader(name).wallet_class(storage)
File "/Library/Python/2.7/site-packages/Electrum-2.6-py2.7.egg/electrum/plugins.py", line 135, in wallet_plugin_loader
return self.plugins[name]
KeyError: 'trezor'

@kyuupichan kyuupichan self-assigned this Jan 17, 2016
@kyuupichan
Copy link
Contributor

Can you try again or provide the backtrace that appeared before that one? When a plugin fails to load there are typically 2, and the 1st is the interesting one. I just tried opening a trezor wallet and it was fine (with commit 144f53b on HEAD).

@ELM4Ever
Copy link
Author

Sorry about that. Here it is, after performing the latest pull this morning:

Traceback (most recent call last):
File "/Library/Python/2.7/site-packages/Electrum-2.6-py2.7.egg/electrum/plugins.py", line 71, in load_plugin
p = pkgutil.find_loader(full_name).load_module(full_name)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/pkgutil.py", line 246, in load_module
mod = imp.load_module(fullname, self.file, self.filename, self.etc)
File "/Library/Python/2.7/site-packages/Electrum-2.6-py2.7.egg/electrum_plugins/trezor/qt.py", line 1, in
from ..trezor.qt_generic import qt_plugin_class
File "/Library/Python/2.7/site-packages/Electrum-2.6-py2.7.egg/electrum_plugins/trezor/qt_generic.py", line 3, in
from PIL import Image
ImportError: No module named PIL
Traceback (most recent call last):
File "/Library/Python/2.7/site-packages/Electrum-2.6-py2.7.egg/electrum_gui/qt/init.py", line 157, in start_new_window
wallet = self.daemon.load_wallet(path, self.get_wizard)
File "/Library/Python/2.7/site-packages/Electrum-2.6-py2.7.egg/electrum/daemon.py", line 131, in load_wallet
wallet = Wallet(storage)
File "/Library/Python/2.7/site-packages/Electrum-2.6-py2.7.egg/electrum/wallet.py", line 1946, in new
wallet = WalletClass(storage)
File "/Library/Python/2.7/site-packages/Electrum-2.6-py2.7.egg/electrum/plugins.py", line 125, in dynamic_constructor
return self.wallet_plugin_loader(name).wallet_class(storage)
File "/Library/Python/2.7/site-packages/Electrum-2.6-py2.7.egg/electrum/plugins.py", line 135, in wallet_plugin_loader
return self.plugins[name]
KeyError: 'trezor'

@ELM4Ever
Copy link
Author

I have never seen this module "PIL" being mentioned before... I went and installed py-pil, but it didn't change anything.

@usezfsyo
Copy link

Try installing from http://pythonware.com/products/pil/

On Jan 17, 2016, at 1:38 PM, ELM4Ever notifications@github.com wrote:

I have never seen this module "PIL" being mentioned before... I went and installed py-pil, but it didn't change anything.


Reply to this email directly or view it on GitHub.

@usezfsyo
Copy link

Here is the commit that added the PIL import: a3bced2

On Jan 17, 2016, at 1:38 PM, ELM4Ever notifications@github.com wrote:

I have never seen this module "PIL" being mentioned before... I went and installed py-pil, but it didn't change anything.


Reply to this email directly or view it on GitHub.

@ELM4Ever
Copy link
Author

Ok - installed PIL directly from pythonware. Got rid of the errors above, but now it can't see the Trezor when I try to load the wallet. I have checked the communication independently with the python-trezor commands and it works - but not with Electrum. I get this instead:

Traceback (most recent call last):
File "/Library/Python/2.7/site-packages/Electrum-2.6-py2.7.egg/electrum/plugins.py", line 160, in run_hook
r = f(_args)
File "/Library/Python/2.7/site-packages/Electrum-2.6-py2.7.egg/electrum_plugins/trezor/qt_generic.py", line 235, in load_wallet
self.get_client(wallet)
File "/Library/Python/2.7/site-packages/Electrum-2.6-py2.7.egg/electrum_plugins/trezor/plugin.py", line 242, in get_client
raise DeviceDisconnectedError(msg)
DeviceDisconnectedError: Could not connect to your Trezor. Verify the cable is connected and that no other app is using it.
Continuing in watching-only mode until the device is re-connected.
Traceback (most recent call last):
File "/Library/Python/2.7/site-packages/Electrum-2.6-py2.7.egg/electrum_gui/qt/main_window.py", line 511, in timer_actions
self.update_wallet()
File "/Library/Python/2.7/site-packages/Electrum-2.6-py2.7.egg/electrum_gui/qt/main_window.py", line 588, in update_wallet
self.check_next_account()
File "/Library/Python/2.7/site-packages/Electrum-2.6-py2.7.egg/electrum_gui/qt/main_window.py", line 1953, in check_next_account
self.create_next_account()
File "/Library/Python/2.7/site-packages/Electrum-2.6-py2.7.egg/electrum_gui/qt/main_window.py", line 1154, in request_password
return func(self, *args, *_kwargs)
File "/Library/Python/2.7/site-packages/Electrum-2.6-py2.7.egg/electrum_gui/qt/main_window.py", line 1960, in create_next_account
self.wallet.create_next_account(password)
File "/Library/Python/2.7/site-packages/Electrum-2.6-py2.7.egg/electrum/wallet.py", line 1726, in create_next_account
xpub, xprv = self.derive_xkeys(root_name, derivation, password)
File "/Library/Python/2.7/site-packages/Electrum-2.6-py2.7.egg/electrum_plugins/trezor/plugin.py", line 104, in derive_xkeys
xpub = self.get_public_key(derivation)
File "/Library/Python/2.7/site-packages/Electrum-2.6-py2.7.egg/electrum_plugins/trezor/plugin.py", line 108, in get_public_key
client = self.get_client()
File "/Library/Python/2.7/site-packages/Electrum-2.6-py2.7.egg/electrum_plugins/trezor/plugin.py", line 90, in get_client
return self.plugin.get_client(self, force_pair)
File "/Library/Python/2.7/site-packages/Electrum-2.6-py2.7.egg/electrum_plugins/trezor/plugin.py", line 242, in get_client
raise DeviceDisconnectedError(msg)
electrum_plugins.trezor.plugin.DeviceDisconnectedError: Could not connect to your Trezor. Verify the cable is connected and that no other app is using it.
Continuing in watching-only mode until the device is re-connected.

@kyuupichan
Copy link
Contributor

I thought PIL was already a dependency. I'll look into avoiding that.

The disconnected exception happens after it asks for your PIN. Can you confirm you are being asked for your PIN and that you're not cancelling the request? Sometimes the device gets in a funny state that is solved by reinserting it.

The watching only warning is misleading as after you enter your PIN it goes out of watching only mode - check the window title bar.

@ELM4Ever
Copy link
Author

Electrum just doesn't see it. I tried to start Electrum, then connect the Trezor. I tried by connecting to USB port first, then starting Electrum. Nothing. I tried by starting with default_wallet (normal type wallet) and then switching to Trezor wallet - watch-only again. I can't create a new Trezor wallet either. I doesn't ask me for my PIN.

@ELM4Ever
Copy link
Author

Found something... If I revert to an older version of the python-trezor library (0.6.6 for example) - Trezor now works with Electrum v2.6 The python-library is now at 0.6.11. 0.6.6 uses protobuf 2.5.0 and 0.6.11 uses protobuf 2.6.1. Electrum uses protobuf 3.0.0 - don't know if this makes any difference.

@kyuupichan
Copy link
Contributor

Thanks for the info. FYI I have trezor 0.6.7 installed, protobuf 2.6.1. Once I've resolved other issues I'll look into updating my trezor library version and trying to reproduce. So I understand the following:

trezor 0.6.11 and protobuf 2.6.1 not working for ELM4Ever
trezor 0.6.7 and protobuf 2.6.1 is working for me

If you could test trezor 0.6.7 so we have a common good version that would be good.

@ELM4Ever
Copy link
Author

I don't have trezor 0.6.7 - they don't list older versions on their github repo. It just happened that I found a copy of 0.6.6 in my download folder. BTW, when you "sudo python setup.py install" Electrum, the setup.py will swap your protobuf to v.3.0.0 automatically.

  • Electrum 2.6, python-Trezor 0.6.6 and protobuf at any flavor (2.5.0 / 2.6.1 / 3.0.0) works for me
  • Electrum 2.6, python-Trezor 0.6.11 and protobuf at 2.6.1 or 3.0.0 does not work for me.
  • Command line for python-Trezor 0.6.11 and protobuf at 2.6.1 works for me (execute small python code listed in readme file of python-trezor repo).
  • Command line python-Trezor 0.6.11 and protobuf at 3.0.0 does not work for me

@kyuupichan
Copy link
Contributor

OK that's very useful thanks. Seeing as command line Trezor has an issue this seems to be more an incompatibility of protobuf 3 and newer Trezor rather than specifically an Electrum issue. Can you inform them?

@ELM4Ever
Copy link
Author

I can.

Protobuf 2.6.1 is the last stable version. It would be wise to also restrict Electrum to that version in the setup.py file.

@ELM4Ever
Copy link
Author

BTW: Electrum 2.5.4, Python-Trezor 0.6.11 and protobuf 2.6.1 work well together.

@kyuupichan
Copy link
Contributor

Yes trezor 0.6.11 seems to have a problem. Let me update and avoid the issue in Electrum

@kyuupichan
Copy link
Contributor

@ELM4Ever - please confirm if this solves the issue for you. I've updated to 0.6.11 locally and it is now fine. Unfortunately 0.6.10 is broken on the Mac, but I've made Electrum avoid the broken function so it works for me now on Mac.

@ELM4Ever
Copy link
Author

Excellent! Electrum 2.6 now works with phyton-trezor 0.6.11.

So many new functions available for Trezor!

Thanks.

Toporin pushed a commit to Toporin/electrum-satochip that referenced this issue Feb 16, 2021
…puts (spesmilo#1637)

In the case of nonminimal push forms in the scriptSig, we were parsing
those inputs then reconstructing them with the minimal push opcode, which
would result in weird things like the wrong TXID being shown in the
tx details dialog.
Toporin pushed a commit to Toporin/electrum-satochip that referenced this issue Feb 16, 2021
…tSig (spesmilo#1648)

fixes spesmilo#1628
continues the theme of spesmilo#1637 -- if an input has scriptSig, it *is*
essentially complete.

If people are doing smart contracts and need to save unsigned transactions,
my recommendation for the initial wallet:
- txin['type'] = 'unknown'
- set txin['scriptSig'] to anything you want, but I recommend making sure
  the first couple of bytes are 0000 or ffff, something like that, which
  ensures it won't get misinterpreted as one of the special input types.
  You can even embed metadata or signatures here, go wild.

Upon loading the transaction, Electron Cash will think that input is of
an unknown type (good) but also thinks it is complete (wrong). As a result,
the user will be presented with the ability to broadcast the tx, which
will of course fail. It's your job as smart contract author to do something
about that. Perhaps we can add a hook at the end of
`Transaction.deserialize()`?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants