LBRY-Vault/electrum/plugins/coldcard
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
..
__init__.py Support for new hardware wallet: Coldcard 2018-08-22 21:43:03 +02:00
basic_psbt.py Add multisig support for Coldcard plugin 2019-09-18 18:29:29 +02:00
build_psbt.py Add multisig support for Coldcard plugin 2019-09-18 18:29:29 +02:00
cmdline.py logging: basics 2019-05-02 15:19:03 +02:00
coldcard.py Add multisig support for Coldcard plugin 2019-09-18 18:29:29 +02:00
qt.py Add multisig support for Coldcard plugin 2019-09-18 18:29:29 +02:00
README.md Support for new hardware wallet: Coldcard 2018-08-22 21:43:03 +02:00

Coldcard Hardware Wallet Plugin

Just the glue please

This code connects the public USB API and Electrum. Leverages all the good work that's been done by the Electrum team to support hardware wallets.

Background

The Coldcard has a larger screen (128x64) and a number pad. For this reason, all PIN code entry is done directly on the device. Coldcard does not appear on the USB bus until unlocked with appropriate PIN. Initial setup, and seed generation must be done offline.

Coldcard uses an emerging standard for unsigned tranasctions:

PSBT = Partially Signed Bitcoin Transaction = BIP174

However, this spec is still under heavy discussion and in flux. At this point, the PSBT files generated will only be compatible with Coldcard.

The Coldcard can be used 100% offline: it can generate a skeleton Electrum wallet and save it to MicroSD card. Transport that file to Electrum and it will fetch history, blockchain details and then operate in "unpaired" mode.

Spending transactions can be saved to MicroSD using the "Export PSBT" button on the transaction preview dialog (when this plugin is owner of the wallet). That PSBT can be signed on the Coldcard (again using MicroSD both ways). The result is a ready-to-transmit bitcoin transaction, which can be transmitted using Tools > Load Transaction > From File in Electrum or really any tool.

https://coldcardwallet.com

TODO Items

  • No effort yet to support translations or languages other than English, sorry.
  • Coldcard PSBT format is not likely to be compatible with other devices, because the BIP174 is still in flux.
  • Segwit support not 100% complete: can pay to them, but cannot setup wallet to receive them.
  • Limited support for segwit wrapped in P2SH.
  • Someday we could support multisig hardware wallets based on PSBT where each participant is using different devices/systems for signing, however, that belongs in an independant plugin that is PSBT focused and might not require a Coldcard to be present.

Ctags

  • I find this command useful (at top level) ... but I'm a VIM user.

    ctags -f .tags electrum find . -name ENV -prune -o -name \*.py

Working with latest ckcc-protocol

  • at top level, do this:

    pip install -e git+ssh://git@github.com/Coldcard/ckcc-protocol.git#egg=ckcc-protocol

  • but you'll need the https version of that, not ssh like I can.

  • also a branch name would be good in there

  • do pip uninstall ckcc first

  • see https://stackoverflow.com/questions/4830856