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

support SLIP-19 ownership proofs, for trezor-based Standard_Wallets #8871

Merged
merged 3 commits into from
Feb 21, 2024

Conversation

SomberNight
Copy link
Member

@SomberNight SomberNight commented Feb 5, 2024

  • wallet/keystore: add generic APIs re add_slip_19_ownership_proofs_to_tx
  • transaction.py: add slip_19_ownership_proof field to PartialTxInput
  • trezor:
    • if (generic) proof present, we can pass it to a Trezor signer
    • specifically for singlesig wallets with a Trezor keystore, actually implement ~creating the proofs
  • qt tx_dialog:
    • add option to export tx including the proofs

  • this allows trezor-based wallets to sign transactions with unsigned external inputs

    • this allows doing e.g. coinjoins
    • previously we only supported signed external inputs (Support external pre-signed inputs on Trezor #8324)
      • this restricted the trezor-based wallet to sign last (and precluded there being multiple trezor-based wallets involved)
  • closes SLIP-19 ownership proofs #8325

    • that issue can be considered more generic, e.g. "what about multisig inputs?", "what about Software_KeyStores?" -- if someone wants to, they can open new issues with such narrower scopes.

@SomberNight SomberNight added hw-trezor topic-wallet 👛 related to wallet.py, or maybe address_synchronizer.py/coinchooser.py gui-qt-desktop labels Feb 5, 2024
@SomberNight
Copy link
Member Author

@ecdsa see the second commit "qt tx_dialog: share btn: replace nested menus with checkboxes"

qt_tx_dialog

@ecdsa
Copy link
Member

ecdsa commented Feb 18, 2024

looks good to me. I think a popup would not be better.

update: maybe it would be better to show the checkboxes at the top of the menu, because these are options on which the latter menu items depend.

@hynek-jina
Copy link

Why is the option to include ownership proofs disabled?

@SomberNight
Copy link
Member Author

Why is the option to include ownership proofs disabled?

It is only enabled for "singlesig wallets with a Trezor keystore" for now. The picture above is for a software keystore.
The actual creation and validation of proofs is not implemented here, we are just asking for proofs from the trezor, and when present, passing them to a trezor. For a software keystore to be able to include proofs, we would need code to create the proofs. The API added here is extensible to do that but is not done for now.

maybe it would be better to show the checkboxes at the top of the menu, because these are options on which the latter menu items depend.

Another view though is that the options are rather niche, most people don't need them for most cases, and so it makes sense to make the often-used-buttons easier to spot and click.

- implement it specifically for the "singlesig trezor" case
- aimed to be generic enough that support for more complex scripts
  and other keystores could be added later
Incidentally, the checkboxes are using the config, so their state is persisted.
@ecdsa ecdsa merged commit e2db5ca into spesmilo:master Feb 21, 2024
9 of 14 checks passed
@hynek-jina
Copy link

I'm trying to test it, but I'm getting an error RuntimeError('ProcessError: Unverifiable external input.')

Steps

  • Wallet 1 [W1] creates transaction
  • In preview click on Include SLIP-19 ownership proofs
  • W2 creates second transaction
  • W2 imports transaction made by W1
  • W2 signs the transaction - confirming - (all outputs, locktime, my share in payment) - Btw. here I might not need to confirm change address from W1?
  • Import signed back into W1 → does it attach correctly ownership proofs here?
  • Sign the transaction → ⚠️ RuntimeError('ProcessError: Unverifiable external input.')

@SomberNight
Copy link
Member Author

SomberNight commented Feb 22, 2024

I am having trouble understanding the steps you took.

Here is an example of a manual coinjoin between two parties:

  1. wallet1 creates unsigned tx1, paying itself (e.g. 1 input, 2 outputs)
  2. in wallet1, go to tx Preview. Share>"Include SLIP-19 ownership proofs", then Share>"Copy to clipboard"
    • let's call the exported tx "psbt1"
  3. wallet2 creates unsigned tx2, paying itself (e.g. 1 input, 2 outputs)
  4. in wallet2, go to tx Preview. Combine>"Join inputs/outputs", paste psbt1.
    • now the tx preview dialog shows a new tx, "tx3", which has 2 inputs and 4 outputs
  5. in wallet2 still, tx dialog, now you can click "Sign"
    • the inputs of tx3 that are owned by wallet2 will be signed now - trezor is willing to sign as all inputs either belong to wallet2 (itself) or have SLIP-19 ownership proofs showing they are external
  6. in wallet2 still, tx dialog, click Share>"Copy to clipboard"
    • let's call the exported tx "psbt2"
  7. in wallet1, menubar>Tools>"Load transaction">"From text". paste psbt2.
  8. in wallet1, tx dialog, now you can click "Sign"
    • the inputs of tx3 that are owned by wallet1 will be signed now - trezor is willing to sign as all inputs either belong to wallet1 (itself) or are already signed
      (Ownership proofs are not needed at this point. They are only needed for inputs that are both unsigned and external.)
  9. tx3 is now fully signed and you can broadcast it

@hynek-jina
Copy link

You description is better, but I see no difference.. The error comes in step 8

@SomberNight
Copy link
Member Author

Hmm. Not sure. I wrote the above steps while following them and it worked.

In my case, both wallet1 and wallet2 use p2wpkh scripts, and one is a trezor safe3 and the other is a trezorT.
If you are testing not on mainnet, could you share psbt2?

@hynek-jina
Copy link

Sure.. Here:

cHNidP8BAPACAAAAAoCy57FMcBoCnrbrDXl0gQWYnGyPlFawxkX0dIi7uqeuEQAAAAD9////vxZTjc/7Vqlrv8fnug4ZQUt/tqhWN9LLQ0Q8JO/byL8AAAAAAP3///8EECcAAAAAAAAiUSAQdLBG3dfWhoPIbet17FLNJu7mCzwY9tPI6O1AnXIMyw1LAAAAAAAAFgAUy8GJOWxDDf3yUNXvXx9rw+CbwZogTgAAAAAAACJRIMoufoRJfLw4lOsZmIiCNNM4dIRIn5xegQkd+Xnklgy2zn4CAAAAAAAWABTOX6Nuj++WMXpBeaU6IHG/I2e5PZpaJwAAAQEfxpkAAAAAAAAWABTpvgEYAAGpX8JNBf6uzavB6gNOSgEA/RsTAQAAAAABHzHfRN5CX4+ORCSQw7ACpLGYFPeih/UUFVRyiag7uSxaBgAAAAD/////dIKjMx2p8IQmmfUQW4YnsfO1kMmXI2B8YhjtwwH3HLEGAAAAAP/////UidDUe3mM75saI1qjiM5O1aEqVFqCljiCMPnQ2cNmLQgAAAAA/////9DdMmwWbxu0J2tkC6tKBJn2tUeqpkS2ZrAR8msWfmSkAAAAAAD/////dIKjMx2p8IQmmfUQW4YnsfO1kMmXI2B8YhjtwwH3HLEQAAAAAP////8x30TeQl+PjkQkkMOwAqSxmBT3oof1FBVUcomoO7ksWg0AAAAA/////5dO/lS3i7D+wzvk68DTr7vNvxAAn3KdSYDFBwMt9Q6OBQAAAAD/////1InQ1Ht5jO+bGiNao4jOTtWhKlRagpY4gjD50NnDZi0XAAAAAP////8XXp7D+PmbBgKD3IbbRtZ/lWDa/31pDLpRTtNFOiR6RwcAAAAA/////yctWgC5MnkMt28ioQzhnCUIJZalleWV619SCaMn9THKAQAAAAD/////1InQ1Ht5jO+bGiNao4jOTtWhKlRagpY4gjD50NnDZi0cAAAAAP////+JCydekw5SvfRTEpMgEai5/Mva7MuAMerfdffH2j/MfgsAAAAA/////9vCHsW6vB5FrQpt+Q/+xHq0aTuiYJgmtieDS4trYKoZCgAAAAD/////dIKjMx2p8IQmmfUQW4YnsfO1kMmXI2B8YhjtwwH3HLEmAAAAAP////90gqMzHanwhCaZ9RBbhiex87WQyZcjYHxiGO3DAfccsSgAAAAA/////zHfRN5CX4+ORCSQw7ACpLGYFPeih/UUFVRyiag7uSxaGgAAAAD/////dIKjMx2p8IQmmfUQW4YnsfO1kMmXI2B8YhjtwwH3HLExAAAAAP////90gqMzHanwhCaZ9RBbhiex87WQyZcjYHxiGO3DAfccsToAAAAA/////3SCozMdqfCEJpn1EFuGJ7HztZDJlyNgfGIY7cMB9xyxPAAAAAD/////dIKjMx2p8IQmmfUQW4YnsfO1kMmXI2B8YhjtwwH3HLE9AAAAAP////90gqMzHanwhCaZ9RBbhiex87WQyZcjYHxiGO3DAfccsUUAAAAA//////86rdPXsTv0mpo5cVm+b/ooaCSkVuhd5So3nfZt7TPqEAAAAAD/////Md9E3kJfj45EJJDDsAKksZgU96KH9RQVVHKJqDu5LFooAAAAAP////90gqMzHanwhCaZ9RBbhiex87WQyZcjYHxiGO3DAfccsUwAAAAA/////5dO/lS3i7D+wzvk68DTr7vNvxAAn3KdSYDFBwMt9Q6OQwAAAAD/////0N0ybBZvG7Qna2QLq0oEmfa1R6qmRLZmsBHyaxZ+ZKQsAAAAAP/////UidDUe3mM75saI1qjiM5O1aEqVFqCljiCMPnQ2cNmLUcAAAAA/////xdensP4+ZsGAoPchttG1n+VYNr/fWkMulFO00U6JHpHIgAAAAD/////Md9E3kJfj45EJJDDsAKksZgU96KH9RQVVHKJqDu5LFouAAAAAP////99/T2cs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PoiCc/Y2QGnNxUehUS/F5ACIBaitVrz+gAYF+zLDo/kd1gtatYIPPs+jUaFBXuqx6btASECu0bdNtz4sexWL4Ei25pqQvJHhg/8TzHBxuJ/PnraChwCRzBEAiBYDJqBBVzMCH/dxbAVx0lHxKlKtkPBwGYICgDo1SCtUAIgTc/mVbUViqgeG6SeKo1h098WPwz7DHVLLxQmM8pz0DUBIQOA4sA7XlIBfcRH/mM9g1gTrSP9Ppo2sy9m47YE9XjD7AAAAAABGZNTTAAZAAHuC2EMXMyDdY6K+X0BubfyUrXHOpo70Eqcl+NPUdgxugACSDBFAiEAjjWWLl6/aFxm8zEjDDhGr8JDOYTZHJKFIWH+SwD3HogCIAFLNtp50qjgtD9QPKP8kVn0yMWOoB7xsDLoNdSGdFpdASEDP32Izo+u0i3ivIqxrIMXH/tTPaPoZSDigvlBf5WoY30AAAAAAA==

@SomberNight
Copy link
Member Author

That looks ok. Well... I don't know. I can't reproduce. :/
It is weird that it errors on step 8. It is step 5 where the ownership proofs are used.
For step 8, somewhat older code that has #8324 should already be sufficient.

@hynek-jina
Copy link

I'm able to sign the transaction when I upload the seed directly into Electrum (without Trezor).

@hynek-jina
Copy link

It works on Trezor T and Trezor Safe 3, but not on Trezor One

@SomberNight
Copy link
Member Author

It works on Trezor T and Trezor Safe 3, but not on Trezor One

Indeed, I can reproduce. Thanks for investigating. Not sure what is going on, it must be due to legacy/modern trezor fw differences I guess. Let's move this discussion to #8910

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
gui-qt-desktop hw-trezor topic-wallet 👛 related to wallet.py, or maybe address_synchronizer.py/coinchooser.py
Projects
None yet
Development

Successfully merging this pull request may close these issues.

SLIP-19 ownership proofs
3 participants