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

[ZIP 305] Best practices for hardware wallets supporting Sapling and Orchard #346

Open
daira opened this issue Mar 2, 2018 · 2 comments
Labels
has ZIP stub Sapling Interacts with Sapling design, spec, or implementation ZIP idea ZIP number assigned

Comments

@daira
Copy link
Collaborator

daira commented Mar 2, 2018

Document how a hardware wallet (that has a trusted path to the user) should construct or verify transactions in order to protect its user, as far as possible, against attacks from the untrusted computer.

In the general case we have a hardware wallet, an untrusted computer, a delegated prover, a user, and a network connection, something like this:

             network
                ↕
h/w wallet ↔ computer ↔ prover
      ⤡       ⤢
         user

The h/w wallet should not trust the computer or the prover with spend authority, and should not allow a transaction confirmed by the user on the wallet's UI to be malleated while remaining valid. Similarly the computer should not trust the prover with spend authority (this is automatic when the computer is not trusted with that authority), or ability to malleate the intended transaction.

We believe that the Sapling design supports this without requiring the h/w wallet to be able to either prove or verify Spend or Output proofs. A h/w wallet should only need to implement:

  • Pedersen commitments using Jubjub arithmetic (for note and value commitments)
  • BLAKE2b and BLAKE2s (and the various PRFs / CRHs they are used in)
  • Nullifier check (using Jubjub arithmetic)
  • KDF plus either encryption or decryption (AEAD_CHACHA20_POLY1305)
  • SignatureHash algorithm
  • Signatures (RedJubjub, i.e. randomized EdDSA on the Jubjub curve)
  • A source of randomness.
@daira daira changed the title [ZIP ???] Best practices for hardware wallets supporting Sapling [ZIP 305] Best practices for hardware wallets supporting Sapling Apr 10, 2018
@str4d
Copy link
Contributor

str4d commented Aug 21, 2018

TREZOR's transparent transaction workflow is documented here: https://wiki.trezor.io/Developers_guide:Message_Workflows

@str4d
Copy link
Contributor

str4d commented Oct 19, 2018

Extracts from the discussion that led to me posting the above comment:

  • RedJubjub is the operation that defines spend authority. Everything else in the list above is for the HW to check it is signing what it thinks it is.
  • Note that there's sharing of code between the Pedersen commitments, the nullifier check, and the RedJubjub signatures: you only need to implement Jubjub curve arithmetic once.
  • TREZOR fragments transactions when sending to its HW due to memory limitations. This should be compatible with Sapling.
    • If you look at how our current Sapling verification is organised (Sapling proving and verifying API librustzcash#30) we only need data for a single input or output at a time (which is at most 948 bytes), with only 32 bytes of context. In this case, we also need the private data for each input or output to be cached by the device for at least one round-trip.
  • Ledger seems to use a much lower-level approach, and it has a memory model that restricts the use of pointers (https://ledger.readthedocs.io/en/latest/userspace/memory.html), which means that any libraries used would need to be reviewed for conformance with that model.

@daira daira transferred this issue from zcash/zcash Apr 20, 2020
@daira daira added Sapling Interacts with Sapling design, spec, or implementation ZIP idea ZIP number assigned labels Apr 20, 2020
@daira daira added this to the Documentation Q4 2024 milestone May 4, 2024
@daira daira changed the title [ZIP 305] Best practices for hardware wallets supporting Sapling [ZIP 305] Best practices for hardware wallets supporting Sapling and Orchard May 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
has ZIP stub Sapling Interacts with Sapling design, spec, or implementation ZIP idea ZIP number assigned
Projects
None yet
Development

No branches or pull requests

2 participants