Skip to content

Commit

Permalink
docs: add zcash protocol doc
Browse files Browse the repository at this point in the history
  • Loading branch information
soralit committed Sep 25, 2024
1 parent 9440e7f commit a36bc9b
Showing 1 changed file with 59 additions and 0 deletions.
59 changes: 59 additions & 0 deletions docs/protocols/ur_registrys/draft/zcash.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
## Keystone Zcash UR Registries

This protocol is based on the [Uniform Resources](https://github.com/BlockchainCommons/Research/blob/master/papers/bcr-2020-005-ur.md). It describes the data schemas (UR Registries) used in Zcash integrations.

### Introduction

Keystone's QR workflow involves two main steps: linking the wallet and signing data, broken down into three sub-steps:

1. **Wallet Linking:** Keystone generates a QR code with public key info for the Watch-Only wallet to scan and import.
2. **Transaction Creation:** The Watch-Only wallet creates a transaction and generates a QR code for Keystone to scan, parse, and display.
3. **Signing Authorization:** Keystone signs the transaction, displays the result as a QR code for the Watch-Only wallet to scan and broadcast.

Two UR Registries are needed for these steps, utilizing the Partially Created Zcash Transaction structure.

### Zcash Accounts

#### Unified Full Viewing Key (UFVK)

UFVK is a standard account expression format in Zcash as per [ZIP-316](https://zips.z.cash/zip-0316). It consists of:

1. Transparent
2. Sprout
3. Sapling
4. Orchard

This protocol focuses on the Transparent and Orchard components.

#### CDDL for Zcash Accounts

The specification uses CDDL and includes `crypto-hdkey` and `crypto-key-path` specs.

```cddl
zcash-accounts = {
master-fingerprint: uint32, ; the master fingerprint to identify the wallet

This comment has been minimized.

Copy link
@daira

daira Sep 25, 2024

ZIP 32 specifies a 16-byte seed fingerprint: https://zips.z.cash/zip-0032#seed-fingerprints
It's a byte array so endian-independent.

accounts: [+ zcash-ufvk],
? origin: text, ; source of data, e.g., Keystone
}
zcash-ufvk = {
? transparent: crypto-hdkey,
orchard: zcash-fvk,
? name: text,
}
zcash-fvk = {
origin: crypto-key-path,
key-data: bytes,
}
```

`zcash-ufvk` describes the UFVK of a Zcash account. Each seed has multiple accounts with different indexes. For index 0, `zcash-ufvk` should contain a BIP32 extended public key with path `M/44'/133'/0'` (transparent) and an Orchard FVK with path `M_orchard/32'/133'/0'` (Orchard).

This comment has been minimized.

Copy link
@daira

daira Sep 25, 2024

Specify that:

133' is for mainnet. Like other coins, we use 1' for testnet as specified in SLIP 44.


#### CDDL for Zcash PCZT

```cddl
zcash-pczt {
data: bytes, ; Zcash PCZT, signatures inserted after signing.
}
```

0 comments on commit a36bc9b

Please sign in to comment.