Commit graph

49 commits

Author SHA1 Message Date
SomberNight
41aa50a3f3
coldcard: log exception traceback in create_client
related: https://github.com/Coldcard/ckcc-protocol/pull/9
2020-05-13 18:11:53 +02:00
SomberNight
2cfa3bd6c8
hww hidapi usage: try to mitigate some thread-safety issues
related: #6097
2020-04-17 19:53:39 +02:00
SomberNight
98d2ab5bd6
hww: fix HardwareClientBase not having reference to plugin
it was incorrectly documented that it did (previously only for some plugins)
2020-04-17 19:53:35 +02:00
SomberNight
e830ef309f
hww: factor out part of hid scan code to HW_PluginBase
so that bitbox02 can override it
2020-04-12 15:34:19 +02:00
SomberNight
0268b63fcb
bitbox02: rm some dead code 2020-04-12 15:34:19 +02:00
TheCharlatan
a4fe14bb82
BitBox02 Electrum plugin support
This commit adds support for the BitBox02 hardware wallet.
It supports both single and multisig for the electrum gui wallet.

To use the plugin a local installation of the BitBox02 python library is
required. It can be found on PiPy under the name 'bitbox02' and can be
installed from the bitbox02-firmware repository in the py/bitbox02
directory.

All communication to and from the BitBox02 is noise encrypted, the keys
required for this are stored in the wallet config file under the
bitbox02 key.

The BitBox02 registers a multisig configuration before allowing
transaction signing. This multisig configuration includes the threshold,
cosigner xpubs, keypath, a variable to indicate for mainnet and testnet,
and a name that the user can choose during configuration registration.
The user is asked to register the multisig configuration either during
address verification or during transaction signing.

The check the xpub of the BitBox02 for other hardware wallets, a button
is added in the wallet info dialog.

The wallet encryption key is fetched in a separate api call, requiring a
slightly tweaked override version of the wallet encryption password.
2020-04-12 15:34:37 +02:00
SomberNight
4b1d835304
wizard hww: scan devices fewer times and move away from GUI thread 2020-04-09 19:45:31 +02:00
SomberNight
4ef313a1ac
hww: smarter auto-selection of which device to pair with
scenario1:
- 2of2 multisig wallet with trezor1 and trezor2 keystores
- only trezor2 connected
- previously we would pair first keystore with connected device and then display error.
  now we will pair the device with the correct keystore on the first try

scenario2:
- standard wallet with trezor1 keystore
- trezor2 connected (different device)
- previously we would pair trezor2 with the keystore and then display error.
  now we will prompt the user to select which device to pair with (out of one)

related: #5789
2020-04-08 17:53:33 +02:00
SomberNight
caefea19dd
trezor pin dialog: only show PIN "strength" when creating/changing
fixes #4832
2020-04-07 18:58:45 +02:00
SomberNight
81fc3fcce2
hww: rm some code duplication: add "scan_and_create_client_for_device" 2020-04-01 21:09:14 +02:00
SomberNight
7f1c7955dc
DeviceMgr: clean-up locks a bit 2020-04-01 21:09:00 +02:00
SomberNight
6760c3f252
hw wallets: introduce HardwareHandlerBase
previously, client.handler was sometimes
- an InstallWizard
- a QtHandlerBase where win was an ElectrumWindow
- a QtHandlerBase where win was an InstallWizard
- a CmdLineHandler

That's just too much dynamic untyped undocumented polymorphism...
Now it will never be an InstallWizard (replaced with QtHandlerBase where win is an InstallWizard),
and now in all cases client.handler is an instance of HardwareHandlerBase, yay.

related: #6063
2020-03-31 14:40:25 +02:00
SomberNight
22861b70ee
Qt tx dialog: make "export with xpubs" option always available
not just if one of the keystores is a coldcard

related: https://github.com/spesmilo/electrum/issues/5969#issuecomment-591441399
2020-02-27 03:14:13 +01:00
SomberNight
fcd9752f19
keystore: change derive_pubkey API to return bytes 2019-12-10 20:41:47 +01:00
SomberNight
0ab88b821c
keystore: use abstract base classes, introduce MPKMixin 2019-12-10 00:31:01 +01:00
SomberNight
0c0a6b2145
TxDialog: fix hooks. only show psbt widgets when applicable.
users of 'transaction_dialog' were assuming that dialog.tx is already set
2019-11-12 23:05:01 +01:00
SomberNight
f8c84fbb1e
hardware wallets: create base class for HW Clients. add some type hints 2019-11-11 17:04:12 +01:00
SomberNight
c8c1ea9c86
qt tx dialog: add export options for coinjoins and for coldcard 2019-11-04 22:25:06 +01:00
SomberNight
d872be7f6b
psbt: don't put xpubs and full paths into tx by def; only while signing 2019-11-04 22:25:02 +01:00
SomberNight
e6c841d05f
psbt: put fake xpubs into globals. keystores handle xfp/der_prefix missing 2019-11-04 22:24:59 +01:00
SomberNight
bafe8a2fff
integrate PSBT support natively. WIP 2019-11-04 22:24:36 +01:00
Peter D. Gray
ec2bdbd02d
plugins/coldcard/qt.py: bugfix for API change on main_window.show_transaction 2019-11-04 09:21:41 -05:00
SomberNight
26ff7a6265
coldcard tx dialog: "export PSBT" button should not raise on foreign ks
tested trezor/coldcard mixed multisig and it worked; no reason to enforce
that the first keystore must be coldcard (order should not matter)
2019-09-18 18:29:33 +02:00
SomberNight
1236b07abf
coldcard: show multisig address: more intuitive error msg
cause of error is probably almost always what msg says
2019-09-18 18:29:32 +02:00
SomberNight
9c83bc1008
coldcard qt: change receive_menu to be similar to other hw plugins
you should not interact with the hw device in the GUI thread if possible...
right-click was lagging
2019-09-18 18:29:32 +02:00
SomberNight
4e6cc93746
coldcard: do link_wallet in load_wallet hook instead
make_unsigned_transaction might not run in some code paths
(e.g. when user uses "Load transaction" UI function)
2019-09-18 18:29:31 +02:00
SomberNight
47c3ac6f1b
coldcard: follow-up prev 2019-09-18 18:29:31 +02:00
Peter D. Gray
c77fe6aafd
build_psbt.py: provide witness vs redeem or both scripts 2019-09-18 18:29:30 +02:00
Peter D. Gray
1692584ae0
coldcard/build_psbt.py: bugfix: dont assume all keystores implement get_derivation, see BIP32Keystore 2019-09-18 18:29:30 +02:00
Peter D. Gray
4baab751a4
Add multisig support for Coldcard plugin
-----

Squashed commit of the following:

commit 69c0d48108314db6f0e100bea2ce5a9a3a0e9a1f
Author: Peter D. Gray <peter@conalgo.com>
Date:   Fri Aug 2 14:51:33 2019 -0400

    deterministic-build/requirements-hw.txt: update to version 0.7.9 of ckcc-protocol for Coldcard

commit 5cd2c528698dfb4ad248844be3c741c25aa33e38
Merge: 5e2a36a3e 537b35586
Author: Peter D. Gray <peter@conalgo.com>
Date:   Fri Aug 2 14:41:59 2019 -0400

    Merge branch 'multisig' of github.com:Coldcard/electrum into multisig

commit 5e2a36a3ee28780a11f789f69896e6e795621bfc
Author: Peter D. Gray <peter@conalgo.com>
Date:   Fri Aug 2 14:41:49 2019 -0400

    Some fixes for p2wsh-p2sh and p2wsh cases

commit 537b35586e0b1e11622a8e7d718b6fd37d47f952
Merge: a9e3ca47e 2a80f6a3a
Author: nvk <rodolfo@rnvk.org>
Date:   Tue Jul 23 11:40:39 2019 -0400

    Merge branch 'master' into multisig

commit a9e3ca47e189bcf0556703a4f2ca0c084638eb73
Author: Peter D. Gray <peter@conalgo.com>
Date:   Mon Jun 24 13:36:41 2019 -0400

    Bugfix: not all keystores have labels

commit 57783ec158af5ca8d63d596638bc3b6ee63b053f
Author: Peter D. Gray <peter@conalgo.com>
Date:   Mon Jun 24 13:36:04 2019 -0400

    Add address format to export data, and bugfix: use xfp_for_keystore()

commit 6f1f7673eaa340d14497b11c2453f03a73b38850
Author: Peter D. Gray <peter@conalgo.com>
Date:   Fri Jun 21 09:06:49 2019 -0400

    Revert "bugfix: P2SH inputs can be signed with extra signatures, more than required"

    This reverts commit 75b6b663eca9e7b5edc9a463f7acd8f1c0f0a61a.

commit c322fb6dd2783e1103f5bf69ce60a365fbaf4bfe
Author: Peter D. Gray <peter@conalgo.com>
Date:   Thu Jun 20 12:57:19 2019 -0400

    Require latest CKCC protocol

commit 69a5b781ebc182851d2e25319b549ec58ea23eb1
Author: Peter D. Gray <peter@conalgo.com>
Date:   Thu Jun 20 12:40:27 2019 -0400

    gui/qt/main_window.py: add co-signer keystore label to wallet info display, and a hook for different buttons

commit 55d506d264dbb341602630c3429134e493995272
Author: Peter D. Gray <peter@conalgo.com>
Date:   Thu Jun 20 12:36:10 2019 -0400

    PSBT Combining/cleanup

commit 75b6b663eca9e7b5edc9a463f7acd8f1c0f0a61a
Author: Peter D. Gray <peter@conalgo.com>
Date:   Thu Jun 20 10:18:02 2019 -0400

    bugfix: P2SH inputs can be signed with extra signatures, more than required

commit 1bde362ddbbfd86520a7cb7bc51e0bcef06be078
Author: Peter D. Gray <peter@conalgo.com>
Date:   Wed Jun 19 09:47:26 2019 -0400

    Combines signed PSBT files

commit cc5c0532e52fbe282e862e20c250cc88ed435cad
Author: Peter D. Gray <peter@conalgo.com>
Date:   Fri Jun 14 13:04:32 2019 -0400

    Working towards multisig

commit cb20da5428ba97237006683133e10b0758999966
Author: Peter D. Gray <peter@conalgo.com>
Date:   Fri Jun 14 13:04:18 2019 -0400

    Refactor/import PSBT handling code into own files

commit 558ef82bb0a8c16fb4e8bd0a6a80190498f1ce57
Author: Peter D. Gray <peter@conalgo.com>
Date:   Tue May 28 13:26:10 2019 -0400

    plugins/hw_wallet/qt.py: show keystore label in tooltip

commit 269299df4a9eb5960b6c6ec0afcbf3ef69ad0be3
Author: Peter D. Gray <peter@conalgo.com>
Date:   Mon May 27 09:32:43 2019 -0400

    Swap endian of xpub fingprint values, so they are shown as BE32 in capitalized hex, rather than 0x%08x (LE32)
2019-09-18 18:29:29 +02:00
SomberNight
3385a94753
logging: basics 2019-05-02 15:19:03 +02:00
SomberNight
85a7aa291e
bip32: refactor whole module. clean-up. 2019-02-22 18:50:24 +01:00
SomberNight
026448837f
no more "import *"
fixes #5101
fixes #5105
2019-02-11 20:21:24 +01:00
SomberNight
16bac5fd73
rm qt icons file
so we don't need pyrcc5, which is not deterministic,
and so we don't need the submodule for the icons

based on electrumsv/electrumsv@bf8802c2ea
2019-02-01 20:15:28 +01:00
SomberNight
8c3920a0db
hw: check_libraries_available now gets version of incompatible libs
previously we would return early and the user would
just see "missing libraries"
2018-12-06 19:39:58 +01:00
SomberNight
ee287740a7
coldcard: fix p2pkh signing for new fw (1.1.0)
PSBT was serialised incorrectly but old fw did not complain
2018-11-29 20:28:27 +01:00
SomberNight
32af83b7ae
wizard/hw: show transport type when listing HWDs 2018-11-16 19:03:25 +01:00
SomberNight
bd32b88f62
introduce UserFacingException
we should not raise generic Exception when wanting to communicate with
the user. it makes distinguishing programming errors and messages hard,
as the caller will necessarily need to catch all Exceptions then
2018-11-08 19:46:15 +01:00
SomberNight
5d52dc204c
coldcard: fix spending when there is no change
follow-up 9037f25da1
2018-11-06 16:17:18 +01:00
SomberNight
9037f25da1
kill old-style namedtuples 2018-10-28 00:28:29 +02:00
SomberNight
a88a2dea82
split bip32 from bitcoin.py 2018-10-25 22:20:33 +02:00
SomberNight
bf18e2bbc9
follow-up prev 2018-10-19 22:24:42 +02:00
Peter D. Gray
14b4955a6f
Fix p2wpkh-p2sh support per issue #4729 2018-10-18 12:38:47 -04:00
SomberNight
70c32590a9
hw plugins: fix only_hook_if_libraries_available
follow-up f9a5f2e183
2018-09-30 00:25:36 +02:00
SomberNight
f9a5f2e183
fix #4698 2018-09-19 20:02:03 +02:00
Johann Bauer
e5cd2ed52f
Goldcard: Change spelling mistake 2018-09-06 18:15:44 +02:00
SomberNight
91c369e392
hw wallets: generalise 'minimum_library' for those that provide a version number 2018-08-23 18:31:14 +02:00
SomberNight
04c1b522d6
minor fixes for prev
use TxOutputHwInfo namedtuple

warn user if device is set to wrong chain

undo parts of prev re testnet. fix p2wpkh.

testnet support. and minor stuff
2018-08-22 21:52:28 +02:00
Peter D. Gray
0bcea80bdf
Support for new hardware wallet: Coldcard
build-wine/deterministic.spec: add Coldcard plugin and ckcc-protocol dependancy

Require version 0.7.2 of ckcc-protocol (window fixes)

Rework import paths to new standards

Updated icons

New minimum version, for latest PSBT constants

Upgrade to final PSBT (BIP 174) standard encoding

Remove log noise

Show bootloader version number as well

Handle case where libraries are missing better

Remove noise about missing packages, for rest of world

Add reference to ckcc-protocol module/data

Remove dead code

Beef up the README more

Slightly better looking

Add version numbers and upgrade firmware feature

Split out DFU support into own file

First pass at adding Coinkite Coldcard hardware wallet to Electrum
2018-08-22 21:43:03 +02:00