# Applied Zcash > Patterns for Zcash developers: build apps from shielded notes, memos and keys. Each pattern is possible with the consensus rules of today. Each pattern has a live demo. This file has the full text of each page. A diagram is given as its text description. The demos are left out. --- Page: https://appliedzcash.com/basics/ # Basics The parts of a usual shielded payment, and how a shop or an app receives one. The patterns are made from these parts. The basics pages have reading guides, building blocks and demos. ## Start - Start here A reading order for a new builder, from smart contracts to your first pattern. - Smart contracts on Zcash Zcash has no smart contracts. Find the Zcash pattern for each task of a contract. - Concepts Notes, pools, actions, memos, keys, addresses and trial decryption, in a few lines each. ## Receive payments - Payment links Ask a wallet for a payment with a ZIP 321 URI and its QR code. - Address per customer Make many addresses from one key. Each address is for one customer or one order. - Watch-only keys Give a server a viewing key. It sees the payments, and the spending key stays offline. ## Transactions - Transaction IDs For a v5 or v6 transaction, the txid is a digest of the effecting data. A light client checks its inclusion with the headers and a Merkle path. --- Page: https://appliedzcash.com/basics/start-here/ # Start here This page is a reading order for a new builder. Each step has links to the pages to read. Most pages have a live demo in the browser. ## Before you start You need basic programming skills. The terms of Zcash are on the Concepts page. A mobile or light wallet for Testnet is useful for the demos. ## Network status, November 2026 - Ironwood is a shielded pool. It is live on Mainnet (since July 2026). Use it for new apps. - The NU7 upgrade is live on Mainnet (since November 2026). The target block time is 25 seconds. - zcashd is end-of-life (July 2026). Use Zebra or Zakura in place of the zcashd node. Use Zallet in place of the zcashd wallet. - A tutorial with 75-second blocks or zcashd commands is out of date. This list is true in November 2026. The status of each ZIP is on zips.z.cash. ## The path - Read Smart contracts on Zcash. It has a table with the Zcash pattern for each task of a smart contract. - Read Concepts. Build a unified address in the demo. - Read Payment links. Get test coins (TAZ) with the faucet command on that page. A faucet on the ZecHub faucet list is an alternative. Then make a payment link. Pay it from a wallet on Testnet. - Read Address per customer and Watch-only keys. A shop uses them to find the payment of each customer. - Choose one pattern for your task. The patterns are in the table of tasks on Smart contracts. The Wishlist has designs that need new software, for example Signature login. ## Tools This list has developer tools for Zcash. The first items are the core software of most apps: nodes, a server wallet, a light client server and libraries. The faucet of the demos on this site is also on the list. The maintainer of each other tool adds its item. All items have the same rules. - librustzcash: Rust crates for Zcash apps and wallets: keys, addresses, transactions and a light client backend. - lightwalletd: a light client server that gets blocks from a Zebra or Zakura node and sends compact blocks to wallets. - Zakura: a full node for Zcash. - Zallet: a wallet for servers, in place of the zcashd wallet. - zcash-faucet: a command that gets test coins (TAZ) for a Testnet address. - Zebra: a full node for Zcash, from the Zcash Foundation. - zingolib: a Rust library for light client wallets, with a command line wallet (zingo-cli). Do you maintain a tool? Add one line with the name, the link and what the tool does. The tool must be open source and usable with Zcash after NU7, on Mainnet or Testnet. The steps are in issue 94. ## Get help The Zcash Community Forum and ZecHub also have help for builders. To add a pattern or to correct a pattern, read the contribution guide. --- Page: https://appliedzcash.com/basics/smart-contracts/ # Smart contracts on Zcash Zcash has no smart contracts. An app on Zcash uses the parts of a shielded payment: notes, memos and keys. With these parts, an app can do many tasks of a smart contract. ## Does Zcash have smart contracts? No. Zcash has no virtual machine, and nodes run no app code. Nodes check one fixed set of rules for each transaction. The values and the addresses in the shielded pools are secret. Nodes see note commitments, nullifiers, encrypted notes and proofs. With each proof, the wallet shows that the transaction obeys the rules of the circuit. Thus, nodes check only the rules of the protocol. An app must check its own rules. The transparent pool has a small script language, as in Bitcoin. All its values and addresses are public. Use the shielded pools for new apps. ## Smart contract tasks on Zcash Each row has a task of a smart contract on Ethereum, and the Zcash pattern for the same task. | Task | On Ethereum | On Zcash | | Keep a record with one history | Contract storage | Bound notes | | Receive orders from users | A call to a contract function | Wallet-native orders | | Share control of funds | A multisig contract | Threshold keys | | Log in with a wallet | Sign-In with Ethereum (ERC-4361) | Log in with Zcash | | Keep a record of an address check | An attestation (Ethereum Attestation Service) | Verified address | | Ask for a payment | A payment URI (ERC-681) | Payment links | | Find the customer for a deposit | A new account for each user | Address per customer | | See payments on a server | Contract events | Watch-only keys | | Pay for the work of the network | Gas | A fee for each action (ZIP 317). From block 3,590,000, the fee rule for wallets is in ZIP 2009. A wallet with the older rule pays a higher fee. Keep the scan work of wallets small with polite actions. | Bound notes and threshold keys also use canonical action pairing. With it, each build of the same transaction has the same note commitments. ## Who checks the rules On Ethereum, each node runs the code of a contract. Thus, nodes check all the rules of the contract. On Zcash, three parties check the rules of an app: - Nodes Nodes accept each nullifier one time only. Nodes check the signature of each spend. - Anyone with the data A verifier calculates the note commitment from the record, recipient address, value, plaintext lead byte and action nullifier. The verifier checks that its x-coordinate is equal to the `cmx` on the chain. The verifier checks that each successor is in the action in which its predecessor is spent. The verifier also checks the block order of the records. Thus, each verified record has one next record at most. - The app The app checks all other rules, for example the price of an order. Users must trust the app for these rules. ## Tasks that need new software Some tasks of a smart contract need a ZIP and a network upgrade. Each ZIP in this table has the status Draft (November 2026). | Task | Change | | Make a new token | Zcash Shielded Assets: ZIP 227 (issuance) and ZIP 226 (transfer and burn) | | Swap two assets | ZIP 228 (asset swaps) | | Use relative lock-time for transparent inputs | ZIP 68 (relative lock-time) | | Send a memo of more than 512 bytes | ZIP 231 (memo bundles) | Some designs need a new wallet function only. These designs are on the Wishlist, for example Signature login. ## Where to start The next steps are on the Start here page. Then read the pattern for your task. --- Page: https://appliedzcash.com/basics/concepts/ # Concepts A shielded payment has a small set of parts: notes, actions, memos, keys and addresses. ## Notes A note contains value. Each note has a recipient, a value and a random seed `rseed`. A commitment to the note, `cmx`, is on the chain. The recipient and the value stay secret. A wallet spends a note with its nullifier. Nodes accept each nullifier one time only. Thus, each note can be spent one time only. ## Pools A pool is a set of notes with one protocol. Two pools are important for new apps: - Ironwood The newest shielded pool. Its protocol is Orchard. Use it for new apps. - Transparent A public pool. All values and addresses are visible, as in Bitcoin. Zcash also has two older shielded pools: Sapling and Orchard. Orchard is the first pool of the Orchard protocol. ### The Orchard pool and the turnstile Before NU6.2, the Orchard circuit had a soundness vulnerability. With it, an attacker could have made value in the Orchard pool. Since NU6.3 (Mainnet block 3,428,143), one corrected circuit is in use for both pools. The Orchard pool also has two more consensus rules (ZIP 2006): - Nodes accept no new value in the Orchard pool. - In each Orchard-pool action, the output and the spent note must have the same receiver. Thus, a holder cannot send value to a different address in the Orchard pool. This rule includes the other addresses of the same wallet. Without these rules, people could still pay each other in the Orchard pool. Nodes would then never check value from the vulnerability at the turnstile. Nodes check each move out of the Orchard pool at the turnstile. If the balance of a pool becomes negative with a block, nodes reject the block (ZIP 209). A holder can move Orchard notes to the Ironwood pool. A holder can also change the values of their own Orchard notes. The chain value pool balances are public. Thus, the amount of each move to the Ironwood pool is public. The migration practice for wallets is in ZIP 318 (draft): notes of fixed values, sent over time. ## Actions and bundles An action contains one spend and one output. A bundle contains the actions of one transaction in one pool. With its default settings, the `orchard` builder makes a bundle with two actions or more. The builder adds dummy spends and dummy outputs to fill the actions. With the `BundleType::UNPADDED` setting, the builder can make a bundle with one action. Outsiders see the number of actions. The real spends and outputs stay secret. ## Memos Each output has a memo of 512 bytes. The memo is in the note ciphertext. The recipient can read the memo. The sender can read it with the outgoing viewing key. The format is in ZIP 302. A text memo is UTF-8 text. A payment to a transparent address has no memo. ## Keys All the keys of a wallet are made from one seed. Each key in this table is made from the key above it, and has less power. | Key | Spend | See payments in | See payments out | Make addresses | | Spending key | Yes | Yes | Yes | Yes | | Full viewing key | No | Yes | Yes | Yes | | Incoming viewing key | No | Yes | No | Yes | See Watch-only keys. ## Addresses Different address types for different use cases. ### TEX addresses A TEX address (Transparent-Source-Only Address, ZIP 320) is a transparent address. It is for a recipient that accepts transparent inputs only, such as an exchange. A wallet pays a TEX address in two steps: - Move shielded funds to an ephemeral transparent address. - Send the funds from that ephemeral transparent address to the TEX address. The intermediate payment is public on the chain. Both its address and amount are visible. A TEX address has the prefix `tex1` on Mainnet (`textest1` on Testnet). Thus, a wallet can recognize this address type. **Note:** Always check the recipient's requirements before sending. A wallet sends a note to an address. A unified address (ZIP 316) contains one receiver for each pool that the recipient accepts. The wallet of the sender selects the best receiver. A wallet can make many addresses from one key. Only the holder of a viewing key can link these addresses. See Address per customer. ## Trial decryption The recipient of each note is secret. Thus, a wallet must try to decrypt each action with its incoming viewing key. This is trial decryption. Each wallet does this work for each action on the chain. See Polite actions. ## Payment requests A payment request is a URI (ZIP 321). The URI contains the address, the amount and the memo. A wallet reads the URI from a link or a QR code. See Payment links. ## Demo: build a unified address A wallet builds a unified address in three steps (ZIP 316): - The wallet puts the receivers in sequence, from the lowest typecode to the highest. Each receiver has a typecode, a length and its data. The padding is last: the prefix of the address and zero bytes, 16 bytes in total. - The wallet mixes all the bytes with F4Jumble. Thus, when one receiver changes, almost all the characters after the prefix change. The prefix stays the same. - The wallet encodes the result as a Bech32m string with the prefix. Type or paste a Zcash address. The demo decodes it with the `zcash_address` crate, compiled to WebAssembly. For a unified address, each receiver has its own color. Clear the box of a receiver. The demo then builds the address again with the other receivers. Caution The first address is a test address from the Zcash test vectors. Its keys are public. Do not send funds to it. --- Page: https://appliedzcash.com/basics/payment-links/ # Payment links A payment link is a request for a payment. The format is in ZIP 321. The link contains the address, the amount and a memo. A phone wallet can read the link from a QR code. ## Use - a checkout page of a shop; - an invoice; - a donation button. Put the order number in the memo. When the shop receives the payment, it reads the memo and finds the order. ## Mechanism ``` zcash:address?amount=ZEC&memo=base64url&label=text&message=text ``` - `address` The address of the recipient. Use a shielded address. - `amount` The value in ZEC, with 8 decimal places or fewer. For example, `0.25`. - `memo` The memo bytes in base64url, 512 bytes or fewer. Only a payment to a shielded address can have a memo. - `label` A name for the recipient. The wallet shows it to the payer. - `message` A note for the payer. The wallet shows it to the payer. The label and the message stay in the wallet of the payer. The memo is put on the chain, in the note ciphertext. In the URI, the label and the message have percent escapes. A shop uses this sequence: - The shop makes an address for the order. See Address per customer. - The shop writes the URI with the amount and the order number in the memo. - The shop shows the URI as a link and as a QR code. - The wallet of the payer shows the address, the amount and the memo. The payer approves the payment. - The shop finds the payment with its viewing key. See Watch-only keys. A request can contain more than one payment. The names of each added payment have an index, for example `amount.1`. ## Limits - **Amounts.** The amount is a request. Some wallets let the payer change it. The shop must compare the value of the note with the order. - **Memos.** Some wallets change binary memos and control characters. Use one line of printable ASCII. - **Many payments.** Some wallets refuse a request with a second payment or a zero amount. Other wallets pay the first payment only and show no error. See Batch payouts for wallet support. - **Privacy.** The URI is plain text. A person who sees the link or the QR code sees the address, the amount and the memo. - **Phishing.** Anyone can make a link to a different address. Show links only on pages that you control. In Wallet-native orders, a participant sends app orders with payment links. ## Demo: a shop link The demo uses the `zip321` crate, compiled to WebAssembly. It writes the URI and draws the QR code. The address is address 0 of the demo shop on the other basics pages. Caution The demo shop address is a Testnet address. Its seed is in the public source of this site. Do not send real funds to it. Test coins You must have test coins (TAZ) to pay the link from a wallet on Testnet. To get TAZ, you must have Node.js 24.7 or later. Run this command with an address of your Testnet wallet: ``` npx zcash-faucet@1.2.1 utest1your_testnet_address ``` Your computer calculates a short proof of work. Then the faucet server sends 0.1 TAZ to the address. No account is necessary. The command has a fixed version. Thus, a later release cannot change the code that you run. The options are in the zcash-faucet repository. --- Page: https://appliedzcash.com/basics/address-per-customer/ # Address per customer A shop can make many addresses from one key. Give each customer or each order its own address. The shop knows the address of each payment. Outsiders see unrelated addresses. ## Use - a deposit address for each user of an exchange or a game; - an address for each invoice; - an address for each place where you publish a donation link. With an address for each order, the payer can send a payment with no memo. The shop finds the order from the address. ## Mechanism Diagram: The diversifier key dk is made from the full viewing key or from the incoming viewing key. Address j is made with FF1 from dk and j. The index j is found from the address with the inverse of FF1 and dk. Left: the shop makes address j. Right: the shop finds j from address j. - The shop gives each customer a number `j`, the diversifier index. - The wallet encrypts `j` with the key. The result is an 11-byte diversifier `d_j`. - The wallet makes a receiver from the diversifier and the key. It puts the receiver in a unified address. - The wallet receives a payment. It decrypts the note with its incoming viewing key, one key for all addresses. - The wallet decrypts the diversifier of the note to get `j` again. Each index from 0 to 2⁸⁸ − 1 has a valid Orchard address. The wallet scans one time for all addresses. Thus, the scan work for many addresses is the same as for one address. The shop keeps a table of `j` and the customer. The table is the only shop data that is necessary for this pattern. ## Limits - **Transparent receivers.** With a transparent receiver in a unified address, that receiver is visible on the chain. Use addresses with shielded receivers only. - **Viewing keys.** A holder of the incoming viewing key can link all the addresses. Keep the key secret. - **Wallet support.** Wallet apps make a new address on request and select the index themselves. A server selects the index with a library such as `orchard` or `zcash_keys`. ## Demo: a demo shop The demo uses the `orchard` crate, compiled to WebAssembly. It makes addresses of the demo shop key from a first index. Copy an address into the second field. The demo finds the index of the address with the shop key. Caution The demo shop is on Testnet. Its seed is 32 bytes of 0x07, in the public source of this site. Do not send real funds to it. --- Page: https://appliedzcash.com/basics/watch-only-keys/ # Watch-only keys A server that receives payments needs a viewing key only. With the viewing key, the server sees the payments and makes new addresses. The spending key stays offline. ## Use - a shop server that marks orders as paid; - an accountant or an auditor who reads the payments of an account; - a public dashboard of the donations to a project. ## Mechanism Diagram: The spending key is made from the seed with ZIP 32. The full viewing key is made from the spending key. The incoming viewing key is made from the full viewing key. The outgoing viewing key is made from the full viewing key. The holder of a key can make each key below it, and no key above it. Each key is made from the key above it. The derivation is possible in one direction only. Thus, each key has less power than the key above it: | Key | Spend | See payments in | See payments out | Make addresses | | Spending key | Yes | Yes | Yes | Yes | | Full viewing key (UFVK) | No | Yes | Yes | Yes | | Incoming viewing key (UIVK) | No | Yes | No | Yes | | Outgoing viewing key (OVK) | No | No | Yes | No | ## Outgoing viewing key A sender uses the outgoing viewing key (OVK) to decrypt the outputs that it sent. With the OVK, the sender sees: - the recipient of the payment - the amount sent - the memo field (if any) The OVK is made from the full viewing key. The OVK is a viewing key. Its scope is the payments out of the account only. A unified key (ZIP 316) is the encoding of a viewing key, like a unified address. The prefix of a UFVK is `uview1`. The prefix of a UIVK is `uivk1`. The OVK is in the UFVK: a wallet makes the OVK from the Sapling or Orchard part of the UFVK. On Testnet, the prefixes are `uviewtest1` and `uivktest1`. Select the smallest key for each task: - Keep the seed and the spending key in an offline wallet or a hardware wallet. - Give the shop server the UIVK. The server makes addresses and finds payments. - Give an auditor the UFVK. The auditor also sees the payments out of the account. - Give the OVK to a server that keeps records of the payments out of the account. The server sees the recipient, the amount and the memo. ## Limits - **All or nothing.** The holder of a viewing key sees all the past and future payments of the account. To show one payment only, use a payment disclosure (ZIP 311, draft). - **Permanent access.** A key that you give out stays valid. To stop new access, move the funds to a new account. The old payments stay visible with the old key. - **Balances.** A server with the UIVK sees each note in. A server with the full viewing key also sees each spend. The full viewing key is necessary for a balance. - **Spendable balance.** A balance can contain notes that a wallet cannot spend yet. The recommendation of ZIP 315 (draft) is 10 confirmations for an untrusted note. For a trusted note, such as a note from a transaction that the wallet made, the recommendation is 3. With 25-second blocks, 10 confirmations are about 4 minutes. Three confirmations are about 75 seconds. Show the spendable balance next to the balance. Thus, a person sees which funds are spendable now. - **Wallet birthday.** A server with a viewing key should also keep the birthday height of the account. The birthday height is the minimum block height that a wallet scans for the account. A wallet can rebuild the account with a later birthday height, for example the current height. Thus, the wallet misses notes that were sent to the account before that height. The balance is too low, and can be zero. Each account in the wallet library `zcash_client_backend` has a birthday height (AccountBirthday). An optional birthday height in a viewing key is in ZIP 316 (revision 2, draft). Without a birthday height in the viewing key, a wallet must ask for one or scan from a conservative default. Keep the birthday height with the key in each backup. ## Demo: one seed, three keys The demo uses the `orchard` and `zcash_address` crates, compiled to WebAssembly. It derives the keys of account 0 on Testnet from the seed. It then makes address 0 two times: from the spending key, and from the UIVK only. The first seed is the seed of the demo shop on the other basics pages. Warning Type only demo seeds here. The holder of a seed has full control of its funds. Keep real seeds in a wallet. --- Page: https://appliedzcash.com/basics/transaction-ids/ # Transaction IDs A receipt contains the ID of a transaction, the txid. For a v5 or v6 transaction, the txid is a digest of the effecting data. The authorizing data is in a separate digest. ## Use - a verifier who checks a receipt of Memo stones, Verified address or Bound notes: the receipt contains a txid; - a wallet that finds its own transaction by its txid, also after a new signature; - a light client that checks that a transaction is in a block, with the block headers and a Merkle path. ## Mechanism ### The txid For v5 transactions, the authorizing data is the signatures, the proofs and the scripts of transparent inputs. The effecting data is all the other data. The txid is the root of a tree of BLAKE2b-256 digests (ZIP 244). Each node has its own personalization string. Each pool has its own branch: ``` txid ├── header_digest version, version group ID, consensus branch ID, lock time, expiry height ├── transparent_digest outpoints, sequence numbers, outputs ├── sapling_digest spends, outputs, value balance └── orchard_digest actions, flags, value balance, anchor ``` The txid has no signatures and no proofs. Thus, a person who changes a signature or a proof cannot change the txid. The consensus branch ID is in the personalization of the root. Thus, a transaction has a different txid on each consensus branch. Libraries and explorers show the txid with its bytes in reverse order, as in the `zcash_protocol` crate. Compare a txid only with a txid in the same byte order. ### The authorizing data digest The authorizing data is in a second tree: ``` auth_digest ├── transparent_scripts_digest the script of each transparent input ├── sapling_auth_digest proofs, spend signatures, binding signature └── orchard_auth_digest proofs, spend signatures, binding signature ``` The pair of the txid and the authorizing data digest is a commitment to all the data of the transaction. ### Version 6 Since NU6.3, each tree of a v6 transaction also has an Ironwood branch (ZIP 229). In version 6, the anchors are authorizing data. In version 5, they are effecting data. Thus, a wallet can update the anchor and the proofs of a v6 transaction. The txid stays the same. ### Proof of inclusion Each block header has the root `hashMerkleRoot` of a Merkle tree of the txids of the block. With a Merkle path from a txid to this root, a verifier checks that the transaction is in the block. Since NU5, the header field `hashBlockCommitments` is a digest of two roots and 32 zero bytes (ZIP 244). `hashAuthDataRoot` is the root of a Merkle tree of the authorizing data digests of the block. `hashLightClientRoot` is the root of a Merkle Mountain Range (MMR) of the earlier blocks (ZIP 221). With the MMR and the FlyClient protocol, a light client checks a chain and the inclusion of a block. The client needs a logarithmic number of headers only. The check is probabilistic (ZIP 221). ## Limits - **Version 4 and older.** For a v4 transaction, the txid is a double SHA-256 hash of the full encoding (ZIP 244). Thus, a person who changes a signature also changes the txid. A v4 txid is reliable only after the transaction is in a block. - **Signatures.** A wallet signs a signature digest for each transparent input, each Sapling spend and each Orchard action (ZIP 244). For a transaction with transparent inputs, each signature digest also has the amounts and the scripts of the spent coins. For a transaction without transparent inputs, the signature digest is the txid. - **One network upgrade.** The MMR of a header has the blocks since the last network upgrade only (ZIP 221). - **FlyClient.** For a chain with fast difficulty changes, such as Zcash, the security of FlyClient is only heuristic. A deeper security analysis is necessary before light clients depend on FlyClient (ZIP 221). ## Demo: the digests of a v5 transaction The demo uses the `blake2b_simd` crate, compiled to WebAssembly. It reads a v5 transaction and calculates the main nodes of the two trees. The sample transaction is the fourth ZIP 244 test vector. Its txid and its authorizing data digest are the same as in the test vector. Select a field and change one byte. The demo marks the digests with a new value. The demo reads v5 transactions only. --- Page: https://appliedzcash.com/patterns/ # Patterns With an app pattern, an app binds data and rules to shielded notes, memos and keys. Each pattern is possible with the consensus rules of today. Each pattern page has the problem, the use cases, the mechanism and the cost. It also has the spec, a demo and a toy example. ## Records Keep a record that a verifier can find on the chain later. - Bound notes Put a hash of app data in the `rseed` of a zero-value note. Standard wallets can decrypt the note. - Verified address Experimental Write a record of an address check in a bound note. A verifier with the receipt examines the record. - Memo stones Experimental Put one hash for many shielded memos in a public record. The author of a memo keeps a receipt. ## Payments and orders Receive an order, or pay many recipients. - Wallet-native orders Put an order in the memo of a ZIP 321 payment URI. - Batch payouts Experimental Pay many recipients in one shielded transaction. Each recipient receives its own amount and memo. ## Login and roles Find who controls an address, or share one role among many people. - Log in with Zcash Send a one-time code in a memo to the address of a user. The user types the code to log in. - Threshold keys Experimental Give each app role one FROST group key. Any t of n members can sign for the role. ## Transaction shape Make transactions with fewer actions and a fixed order of actions. - Polite actions Each wallet must try to decrypt each action. Thus, an app must use a small number of actions. - Canonical action pairing Use a keyed sort to put the spends and the outputs of a bundle in order. The pairs are the result of the order. ## Status A pattern with the Experimental tag has an open item: a review, an implementation or support in wallets. The open item is in the warning at the top of its page. The condition for the removal of the tag is also in the warning. Read the warning before you use the pattern on Mainnet. --- Page: https://appliedzcash.com/patterns/bound-notes/ # Bound notes Zcash keeps money in sealed notes. Each note has a seal that only its contents can make. A bound note puts an app's data into that seal. If someone changes the data, the seal stops matching. Everyone can see the change. Each new note also includes the seal of the note before it. To make the new note, the app must use up the old one. Zcash lets a note be used one time only. So the app's record is a single chain. Each link is sealed, and each link can come only once. Anyone with the data can check the whole chain. In technical terms, the seal is the note commitment `cmx`. An app puts a hash of its data in the `rseed` of a note. ψ and rcm are calculated from `rseed` (ZIP 212). Thus, `cmx` is a commitment to the data. Standard wallets can decrypt a bound note. Anyone with the data can calculate `cmx` again and compare it with the chain. The pattern is possible with the consensus rules of today. ## Problem Many apps must keep a public record on the chain. Anyone must be able to examine the record. Examples are a name registry, a decision market and a timestamp service. A memo is a weak place for a record. The memo is in the note ciphertext, outside the note commitment. To read a memo, a verifier needs a viewing key. Compact blocks contain only the first part of each ciphertext. The note commitment is a strong place for a record. Nodes add each note commitment to the note commitment tree. Nodes accept each nullifier one time only, so each note can be spent one time only. A record in the note commitment has these two properties. ## Use cases - **Timestamp registry.** The app puts a hash of each document in the fields of one stamp. Anyone with the document can then show that it existed at the block height of the stamp. The demo below is a timestamp registry. The transaction builder must accept an `rseed` from the app. See Cost. - **Name registry.** The app writes each registration as one record in a chain of bound notes. Each tip has one successor at most. Thus, the registry is an append-only record. The app pins a genesis note. Only the descendants of that note are part of the record. See Authority. - **Decision market.** The app writes the public record of a market as one record, for example its result. Anyone with the data can examine the whole chain. Each wallet tries to decrypt each action on the chain. Thus, the app keeps the number of records small. See Cost. ## Mechanism Diagram: The app hashes kind, fields and prev into rseed. esk, ψ and rcm are calculated from rseed and ρ (ZIP 212, ZIP 2005). cmx is the x-coordinate of the NoteCommit of the recipient, the value, ρ, ψ and rcm. cmx is on the chain. Dashed: a value that the app calculates. Amber: a value on the chain. - The app selects a binding domain `D`. `D` is 16 bytes. `D` is unique to the app and to the version of its record format. - The app gives each type of record a kind. The kind is one byte. - The app encodes the record as bytes. These bytes are the fields. - The app calculates `rseed`: ``` rseed = BLAKE2b-256(D, kind ‖ len(fields) ‖ fields ‖ prev) ``` - `kind` 1 byte - `len(fields)` 8 bytes - `fields` any length - `prev` 32 bytes `len(fields)` is little-endian. `prev` is the cmx of the predecessor, or 32 zero bytes. - The wallet builds a usual Orchard-protocol output with this `rseed`. It calculates esk, ψ and rcm from `rseed` and ρ (ZIP 212, ZIP 2005). ρ is the nullifier of the note that is spent in the same action. With the length prefix, the encoding is injective. Two different records always have two different hash inputs. ### Chains A chain is a sequence of bound notes. The first note is the genesis note. Each note after it is the successor of the note before it. `prev` is the `cmx` of the predecessor. For the genesis note, `prev` is 32 zero bytes. The successor must be the output of the action in which its predecessor is spent. Then ρ of the successor is the nullifier of the predecessor. Nodes accept each nullifier one time only. Thus, each tip has one successor at most. The chain is an append-only record. This weaker rule is not sufficient: the predecessor is spent in the transaction of the successor. With the weaker rule, one transaction can contain two successors of one tip, and the lineage check is successful for both successors. For Ironwood-pool bundles, the `orchard` builder pairs spends with outputs at random. A builder for bound notes must put the successor in the action in which the predecessor is spent. Then the `cmx` of the successor stays the same after a rebuild of the transaction, if the same predecessor is spent in the rebuild. A rebuild can be necessary after a reorg. The `cmx` of the change note can change. For stable `cmx` values in all outputs, see Action pairing. ### Verification A verifier knows the recipient address, the value, the lead byte of the note plaintext and the record. The verifier reads `nf_old` and `cmx` from the action. Then the verifier: - calculates `rseed` from the record; - sets ρ = `nf_old`; - calculates ψ and rcm from `rseed` and ρ; - calculates the note commitment; - compares its x-coordinate with `cmx`. Only public data is necessary for this check. To check lineage, the verifier also needs the nullifier key `nk` of the account of the chain. With `nk`, the verifier calculates the nullifier of the predecessor and finds it as `nf_old` in the action of the successor. An app with a public chain publishes its full viewing key. The verifier must also find each transaction of the chain in a block, and the transaction of each successor must be after the transaction of its predecessor. "After" is a later block, or a later place in the same block. This order is not a result of lineage alone. The Merkle path of a spent note is checked in the Orchard circuit only if the value of the note is not zero. Thus, a zero-value note that is not in a block can be spent in a transaction. The checks above are successful for a successor of such a note. ### Authority Anyone can send a bound note to a published address. Thus, each app must define which notes are part of its record. This rule is sufficient to select the notes: the app pins a genesis note by its transaction ID and `cmx`. A note is part of the record only if it is a descendant of that genesis note. The sender of a false note pays a fee, and the record stays the same. The order of the chain is not known from the pin. See Verification. ### Privacy `rseed` is a function of the record. A person who knows or guesses the record can calculate `rseed`, and then esk. With esk, that person can decrypt the note and its memo. Thus, a bound note to a published address is public. For a public registry, this is the correct result. To keep a bound note private, put a secret of 256 bits or more in the fields. Examples are the hash of a secret key and a random blinding value. ## Cost - **Fee** In a usual record transaction, the tip and one funding note are spent. The outputs are the new note and a change note. That is two actions. From block 3,590,000, the fee rule for wallets is in ZIP 2009. With that rule, the fee for two actions is 2,000 zatoshis (0.00002 ZEC). A wallet with the older rule of ZIP 317 pays 10,000 zatoshis. - **Wallets** Each wallet tries to decrypt each action on the chain. Keep the number of records small. See Polite actions. - **Verifiers** One BLAKE2b hash and one Sinsemilla commitment for each note. The demo below does this work in your browser. - **Builders** The transaction builder must accept an `rseed` from its caller. It must also let the caller put the successor in the action in which the predecessor is spent. The `orchard` crate samples `rseed` at random. `add_output_with_rseed` is in a patch. The patch is pending upstream. In a PCZT (ZIP 374), the usual `rseed` field is sufficient for a bound output. ## Spec The full spec is a draft ZIP. It includes the binding domain rules, the amendment to ZIP 212, the lineage check and the security analysis. The draft will be published after review. ## Demo: a timestamp registry With the registry, anyone can prove that a document existed at a block height. Each stamp is a zero-value note to the registry address. Demo parameters ``` D "TimeStamp_v1____" kind 1 (stamp) fields BLAKE2b-256("TimeStamp_doc_v1", document) prev the cmx of the previous stamp ``` The demo uses the `orchard` crate, compiled to WebAssembly. The registry key is a demo key. The ρ of the first stamp is a demo value. The previous stamp is spent in the action of each next stamp. Thus, the ρ of the next stamp is the nullifier of the previous stamp. --- Page: https://appliedzcash.com/patterns/polite-actions/ # Polite actions Each shielded wallet must try to decrypt each action on the chain. Thus, each action that an app adds is more scan work for all wallets. An app must keep its number of actions small. ## Problem An app that keeps state on the chain often uses one note for each user. When a user changes, the app spends the old note and makes a new note. That is one action for each changed user. A busy app makes thousands of actions each day. The app pays only the fee for these actions. All other wallets pay with scan time and bandwidth. The cost increases with each user of the app. ## Use cases - **Game scoreboard.** The app puts the score of each player in a leaf of a Merkle tree. The app binds the root in one bound note for each epoch. In the example results, with 20 changed players in each block, the app makes 6,912 actions each day. With one note for each player, the app makes 76,032 actions each day. Each player gets a leaf proof from the app. If the app holds back a proof, the player can see the delay. See Cost. - **Membership lists.** The app puts the state of each member in a leaf. With one note for each member, outsiders see how many members changed in each epoch. With leaves, the action count stays the same. Each payment to a member is still one action. See Cost. - **Public epoch records.** The app puts the public record of each epoch in the memo of the root note. Only the wallets that read the record pay for its memo bytes. For a long record, the app adds chunk notes to the same transaction. Each chunk note is one more action. See Techniques. ## Mechanism A light wallet downloads compact blocks. A compact block has about 148 bytes of each Orchard-protocol action: - `nullifier` 32 bytes - `cmx` 32 bytes - `ephemeral key` 32 bytes - `ciphertext prefix` 52 bytes Total: 148 bytes The wallet tries to decrypt each action with each key that it holds. This is trial decryption. The memo is not in the compact block. Thus, in the compact-block scan: - the cost of each action is one trial decryption for each key, and 148 bytes of download; - memo bytes are free. To read a memo, a wallet gets the full transaction. Only the wallets that read the record pay for its memo bytes. The action count is the lever. An app that uses fewer actions makes the chain faster to scan for all wallets. ### Techniques - **Put user state in leaves.** Put the state of each user in a leaf of a Merkle tree. Bind the root in one bound note. When a user changes, one leaf changes, and the root note changes one time for each epoch. Each user gets a leaf proof from the app and compares the leaf with the bound root. - **Put records in the memo.** A memo has 512 bytes, and it is not in the compact-block scan. Put the public record of the epoch in the memo of the root note. When the record is too long, add chunk notes to the same transaction. Bind a hash of the full record in the root note. Thus, each chunk is in the binding. - **Use the free action.** With its default settings, the `orchard` builder makes an Orchard-protocol bundle with two actions or more. The builder adds a padding action to a bundle with one action. The root note (spend and output) is in one action. A fee from a shielded note and its change are in the second action. With a transparent fee, the second action is padding. Thus, the cost of a record of one memo is two actions, and the cost of each chunk is one more action. - **Use epochs.** Collect the changes of a period in one transaction. With a longer epoch, the app makes fewer transactions each day. ## Cost - **Proof delivery** Each user must get leaf proofs from the app. A leaf proof is about 32 × log₂(N) bytes for N users. If the app holds back a proof, the user must wait. The user can see the delay. - **Privacy** The result is better privacy. With one note for each user, outsiders see from the action count how many users changed in each epoch. With leaves, the action count stays the same. - **Payouts** A payment to a user wallet is one action for each payment. The user must receive a usual note, so this cost stays. - **Proving** A transaction with fewer actions is faster to build. - **Block limit** Under NU7 (ZIP 218), one block has at most 330 Orchard and Ironwood actions, across all of its transactions. Thus, a block with many actions from one app has less space for other shielded transactions. ## Spec This pattern is a design rule. The protocol of today is sufficient: bound notes for the root, and the ZIP 302 memo format for the record. ## Demo: the cost of a scoreboard A toy app keeps a scoreboard for a game. The scores of some players change in each transaction. The calculator compares two designs: - **One note per player:** 2 actions for the root and the fee, plus 1 action for each changed player. - **One note per epoch:** 2 actions, plus 1 action for each chunk note. In the calculator, the fee is from a shielded note. With a transparent fee, the per-player design has one action fewer. Since the NU7 network upgrade, the mainnet target block time is 25 seconds. Thus, the chain has about 3,456 new blocks each day. ### Example results Each row has 20 changed players in each transaction, and no chunk notes. | Design and cadence | Actions each day | Download each day | | One note per player, each block | 76,032 | 11.3 MB | | One note per epoch, each block | 6,912 | 1.02 MB | | One note per epoch, each 10 minutes | 288 | 42.6 kB | --- Page: https://appliedzcash.com/patterns/wallet-native-orders/ # Wallet-native orders A participant sends app orders from a usual Zcash wallet. Each order is a ZIP 321 payment with a memo. The wallet shows the memo before the participant approves the payment. The operator identifies the participant by a MAC under a session key. The keys for the funds of the participant stay in the wallet. ## Problem An app must know which participant sent each order. The sender of a shielded payment is secret. Wallets sign messages with transparent keys at most. ZIP 304 is for Sapling keys only. Thus, many apps ask for a seed phrase, or keep a secret key in the browser. Participants with real funds refuse to put a seed phrase in a web page. Wallets already send ZIP 321 payments with memos. A wallet shows the memo before it sends the payment. These two functions are the base of this pattern. A survey of wallets in November 2026 had these results: - wallets send a memo of one line of printable ASCII unchanged; - some wallets refuse or change binary memos and control characters; - some wallets refuse a request with a second payment or a zero amount; - some wallets pay the first payment only and show no error (Batch payouts). ## Use cases - **Polls.** A participant sends each answer as a command in an order memo, for example `q1 YES`. In the demo scheme, one memo can contain 9 answers or fewer. The operator knows each session key. Thus, the operator can make a false order. Use this pattern only for polls with small stakes. See Limits. - **Credit rounds.** An operator runs a round with small stakes, for example credits. The welcome to the payout address can contain funds for the first orders. After the round, the operator pays the final balance of each participant to that address. A holder of the incoming viewing key of the payout address can get the session key of the participant. Thus, each participant joins with a payout address with a private viewing key. See Limits. ## Mechanism ### Roles - Operator The service that runs the app. It receives orders and publishes the result. - Participant A person who sends orders from their own Zcash wallet. - Page The web client of the operator. It shows payment requests and status. - Inbox A unified address with an Orchard receiver. The operator publishes it and receives all orders there. - Session key A 32-byte key `k_i` for participant `i`. It is valid for one round. - Sign-in code A one-time code of 8 digits. With it, one page gets `k_i`. ### Sequence Diagram: 1: The participant joins with a payout address. 2: The page sends the hash of a secret s. 3: The operator sends an 8-digit code in a memo. 4: The participant types the code, and the page sends s and the code. 5: The operator sends k_i to the page. 6: The page shows a ZIP 321 QR code with the memo and its MAC. 7: The participant pays the Inbox. 8: The operator sends the payout. Each arrow is one message. The steps are in sequence from top to bottom. ### Join - The participant gives the operator a payout address with an Orchard receiver. - The operator gives the participant a number `i`. - The operator makes a session key `k_i` from 32 random bytes. - The operator calculates the owner tag τ, a hash of `k_i`. - The operator signs `i`, τ and a salted hash of the payout address. - The operator sends `i`, τ, the salt and the signature to the participant. The operator keeps `k_i` back in this step. The operator accepts each Orchard receiver one time only in each round. The operator then sends a welcome to the payout address. The welcome can contain funds for the first orders. ### Sign-in - The page makes a 32-byte secret `s` and keeps it. - The page sends the hash of `s` to the operator. - The operator sends an 8-digit code in a memo to the payout address. The memo contains the first 4 bytes of the hash. - The participant reads the code in the wallet and types it on the page. - The page sends `s` and the code to the operator. - The operator sends `k_i` to the page. The code is then used. - The page calculates the hash of `k_i` and compares it with τ. The page also examines the signature. Only a person who can read the payout address gets a code. A code is useful only with the secret of the page that asked for it. The operator stops a code after the first correct try or after the fifth incorrect try. A new code is necessary for a new device. The participant pays a code request to the Inbox from the wallet. The memo of the request contains the new hash and the payout address. ### Order memo The page writes each order as one line of printable ASCII: ``` memo = scheme " r=" round " t=" i " n=" nonce " x=" expiry " | " command [" | " command]… " | mac=" mac round first 4 bytes of the round identifier, hex i participant number nonce 4 random bytes, hex, new for each memo expiry the last close height at which the memo counts mac MAC_k_i(P_mac, all bytes before " | mac="), 8 bytes, hex ``` The MAC is keyed BLAKE2b with an 8-byte output. The commands and the personalization `P_mac` are part of the scheme of the app. The memo is a ZIP 302 text memo of 512 bytes or fewer. ### Payment request For each memo, the page makes a ZIP 321 payment request with one payment: the Inbox, the order amount and the memo. The page shows the request as a QR code. The page also shows the URI, the address and the memo for copy. A request is a finished order. The order is placed with the first payment of the request. Thus, the page shows a request only when the participant asks for it. ### Windows and status The lag `c` is a number of blocks from the rules. The close height of epoch `e` is `H_e`. The Inbox notes of epoch `e` are at heights `h` with: ``` H_(e-1) - c < h ≤ H_e - c ``` Each Inbox note is in one window. Anyone who knows the close heights can calculate each window. After a reorg of fewer than `c` blocks, each closed window stays the same. The operator gives each Inbox note one status. It examines the notes in chain order. The status is the result of the first failed check: | Code | Status | Check | | 1 | oversize | A field is too long, or the memo has too many commands. | | 2 | out of bounds | No participant has the number `t`, or a command is outside the scheme limits. | | 3 | malformed | The memo is incorrect for the grammar, or a new encoding of the memo has different bytes. | | 4 | wrong value | The note value is different from the order amount. | | 5 | expired | `x` is less than `H_e`. | | 7 | bad MAC | The MAC is different from the MAC under `k_t`. | | 6 | duplicate | An earlier counted memo has the same pair (`t`, `n`). | | 0 | counted | All the checks above are successful. | A nonce is used only when its memo is counted. Only a holder of `k_t` can make a valid MAC. Thus, each participant controls their own nonces. ### Record and disclosure For each window, the operator publishes a leaf list. Each leaf is the `cmx` of one Inbox note and its status code. The operator puts the Merkle root of the list in the record of the epoch, for example in a bound note. The notes of the Inbox are known from the leaf list. The senders and the memos stay secret. A participant can show that the operator omitted an order or gave it an incorrect status: - The participant gives the transaction ID, the action index and the ephemeral secret key `esk` of the order note. The wallet gets `esk` with its outgoing viewing key. - A verifier decrypts the note with `esk` and the Inbox receiver. - The verifier calculates `cmx` again and finds the window of the note. - The verifier examines the leaf list. A missing leaf is an omission. A status that is incorrect for the memo and the record is an error. Only one note is disclosed. The other notes of the wallet stay secret. ### Payout After the round, the operator pays the final balance of each participant to the payout address from the join. ## Cost - **Each order** The order amount and the network fee. A usual shielded payment with change has two actions. From block 3,590,000, the fee rule for wallets is in ZIP 2009. With that rule, the fee for two actions is 2,000 zatoshis. A wallet with the older rule of ZIP 317 pays 10,000 zatoshis. - **Wallets** Each order is one transaction on the chain. Put several commands in one memo. See Polite actions. - **Sign-in on a new device** One code request. Its amount is the cost of the code note and its part of the epoch transaction. - **Wallet support** ZIP 321 with memos. The wallet must send the memo bytes unchanged. ## Limits Warning The operator knows `k_i`. Thus, the operator can make a false order. Use this pattern only for apps with small stakes, for example credits. Apps with real stakes need signatures from the wallet of the participant. - **False orders.** The participant can find a false order with the viewing key of the wallet and the memo log of the page. Other persons see only the word of the participant against the word of the operator. - **Copies.** A copy of a memo or a QR code is a finished order. With the nonce rule, it is counted one time only. A copy stays valid until the expiry. - **Leaked keys.** A person with `k_i` can make orders for participant `i` and pay for them from a different wallet. The key `k_i` is valid until the end of the round. Thus, the operator counts these orders until then. Malware or a browser extension can read `k_i` from the page. A holder of the incoming viewing key of the payout address can get a code, and then `k_i`. Use a payout address with a private viewing key, for example a new account. - **Phishing.** Anyone can send a memo that looks like a code or a payout. The operator refuses a false code at sign-in. A clone page can still ask the participant for a real code. Wallets and pages must show the host of each link. - **Privacy.** Outsiders see a usual Ironwood-pool transaction. The number of orders in each window is visible in the leaf list. The operator knows the payout address and the time of each order. ## Spec The full spec is a draft ZIP. It includes the grammar of code requests, the code quota, the lifetime of codes and the open questions. The draft will be published after review. ## Demo: a toy poll This is the scheme of a toy poll: Demo parameters ``` scheme toypoll1 command "q" question SP answer question 1 to 9, answer YES or NO limit 9 commands in each memo amount 1,000 zatoshis (0.00001 ZEC) P_mac "ToyPoll_ordmac_1" ``` The demo uses Rust compiled to WebAssembly. It writes the memo, calculates the MAC, makes the ZIP 321 URI and draws the QR code. The session key and the nonce are random values from your browser. Caution The Inbox is a Testnet address. Its key is in the public source of this site. A wallet on Testnet can pay the request, but the operator is only a demo. Test coins You must have test coins (TAZ) to pay the request. To get TAZ, you must have Node.js 24.7 or later. Run this command with an address of your Testnet wallet: ``` npx zcash-faucet@1.2.1 utest1your_testnet_address ``` Your computer calculates a short proof of work. Then the faucet server sends 0.1 TAZ to the address. No account is necessary. The command has a fixed version. Thus, a later release cannot change the code that you run. The options are in the zcash-faucet repository. --- Page: https://appliedzcash.com/patterns/action-pairing/ # Canonical action pairing A builder uses a keyed sort to put the spends and the outputs of a bundle in order. The pairs of spends and outputs are the result of the sort. Thus, each build of the same transaction has the same note commitments. ## Problem Each action of an Orchard-protocol bundle contains one spend and one output. The ρ of the output is the nullifier of the spend in the same action. ψ, rcm and the note commitment of the output are calculated from ρ. Thus, the note commitment of an output changes when its pair changes. A standard builder pairs spends and outputs at random. It also makes new dummy notes on each build. Thus, each output has a different note commitment in two builds of the same transaction. The same note commitments are necessary on each build in three cases: - **Rebuild after a reorg.** In a chain of bound notes, the `cmx` of each predecessor is bound in its successor. After a reorg, a transaction can be gone from the chain. After a rebuild with new commitments, each later note with an old `cmx` is invalid. - **Several signers.** With FROST over a PCZT, each signer must examine the bundle before it signs. To calculate the expected bundle, a signer needs the dummy notes and the pairs of the coordinator. - **Receipts before mining.** An app can tell a user the note commitment of a note before the transaction is mined. That commitment must stay the same after a rebuild. ## Use cases - **Chains of bound notes.** After a reorg, a builder makes a transaction of the chain again. With the same inputs, each output has the same `cmx`. Thus, each later note of the chain stays valid. The builder must accept a pairing key and a context. See Cost. - **Treasuries with several signers.** With FROST over a PCZT, the coordinator makes the canonical build as the Constructor. Each signer with the pairing key makes the bundle again before it signs. The signer compares `nf`, `cmx` and `epk` of each action. Each signer keeps the pairing key as secret as a viewing key. See Limits. - **Receipts before mining.** An app gives a user the note commitment of a note before the transaction is mined. When a builder makes the transaction again with the same inputs, the note commitment stays the same. With a different fee input, the note commitments are different. See Limits. ## Mechanism Diagram: The pairing seed d is a hash of the pairing key, the context and the real nullifiers. The dummy notes and the output rseeds are calculated from PRF_d values. The pairs are the result of the keyed sort. The ρ of each output is the nullifier of its pair. Thus, the cmx is the same for the same inputs. Dashed: a value that the builder calculates. Amber: a value on the chain. The cmx is the same for the same inputs. ### Inputs Each party that builds or examines the bundle uses the same inputs: - the pairing key `k`, a 32-byte secret; - an app context `ctx`, for example an epoch number; - the real spends, each with its note and its nullifier key; - the real outputs, in the order of the caller; - the number of actions `n`; - the lead byte of the note plaintext. ### Steps - Sort the nullifiers of the `m` real spends. Calculate the pairing seed: ``` d = BLAKE2b-256("Zcash_PairingSd_", k ‖ len(ctx) ‖ ctx ‖ m ‖ nf_1 ‖ … ‖ nf_m) ``` - Use `d` as the key of a PRF. Each value has a tag byte `t` and an index `i`: ``` PRF_d(t, i, c) = BLAKE2b-512("Zcash_PairingPRF", d ‖ t ‖ i ‖ c) ``` - `c` is a counter. It increases only when a value is invalid, for example a spending key. - Make `n − m` dummy spends of value zero. The spending key, ρ and `rseed` of each dummy spend are calculated from PRF values. - Give each real output an `rseed` from the PRF. A caller can give its own `rseed`, for example for a bound note. - Make the dummy outputs of value zero. The recipient and the `rseed` of each dummy output are calculated from PRF values. - Calculate a keyed sort key for each spend and each output: ``` key_spend = BLAKE2b-256("Zcash_PairingOrd", d ‖ 0x00 ‖ nf) key_out = BLAKE2b-256("Zcash_PairingOrd", d ‖ 0x01 ‖ rseed) ``` - Sort the spends and the outputs by their keys. Action `a` contains spend `a` and output `a`. - The ρ of each output is the nullifier of its action. Calculate esk, ψ, rcm and the note commitment (ZIP 212, ZIP 2005). A value can be invalid, for example an esk of zero. The chance is about 2⁻²⁵⁴. Then the builder discards the full build. It adds a retry byte to `ctx` and builds again. Each party that follows this rule gets the same bundle. ### Values that stay random The value commitment trapdoor, the spend authorization randomizer, the proof and some outgoing ciphertexts stay random. Nullifiers and note commitments are independent of these values. Thus, two canonical builds have different transaction IDs. The same notes are spent in both, so only one of them can be mined. ### Scope The pattern is for bundles with `enableCrossAddress = 1`, in practice Ironwood-pool bundles. For other bundles, the pairs are set by expanded receiver (ZIP 2006). ## Cost - **Chain** Zero. A canonical bundle has the same size and the same fee as a standard bundle. - **Build** A small number of BLAKE2b hashes for each action, and one sort. - **Builders** The builder must accept a pairing key and a context. The `orchard` crate pairs at random. This pattern is implemented in a fork of the crate, and an upstream PR is pending. - **PCZT** The Constructor role makes the canonical build. A signer with `k` can build the bundle again and compare `nf`, `cmx` and `epk` of each action before it signs. ## Limits - **Privacy.** All derived values are calculated from `k`. Only a holder of `k` can identify each dummy note. To all other parties, the dummy notes and the order of actions look random. Thus, keep `k` as secret as a viewing key. - **Reused seeds.** A dummy nullifier is the same when `d` is the same. The real nullifiers are bound in the seed, so the same notes are spent in two bundles with the same `d`. Only one of them can be mined. A unique `ctx` is necessary for a bundle with zero real spends. - **Rebuild scope.** A rebuild has the same commitments only with the same inputs. With a different fee input, `d` changes, and then all pairs change. ## Spec The full spec is a draft ZIP. It includes the spending key rule for dummy notes, the dummy output memo, the PCZT fields and the rationale. The draft will be published after review. ## Demo: rebuild a bundle The demo uses the `orchard` crate, compiled to WebAssembly. It makes Ironwood-pool notes of value zero. The real spends have demo nullifiers. The recipient of the real outputs is a demo address. Click a build button two times. A canonical build has the same `cmx` values each time. A standard build has a new random seed each time, so its `cmx` values change. --- Page: https://appliedzcash.com/patterns/threshold-keys/ # Threshold keys Give each app role one FROST group key. Any `t` of `n` members can sign for the role. Nodes see one usual spend signature. Warning FROST on the Ironwood pool is unaudited, and ZIP 312 is a draft. Review by a cryptographer is necessary for the nested construction on this page. Use it on Testnet only. The Experimental tag stays until a cryptographer reviews the nested construction. See Status. Test coins You must have test coins (TAZ) to use a wallet on Testnet. To get TAZ, you must have Node.js 24.7 or later. Run this command with an address of your Testnet wallet: ``` npx zcash-faucet@1.2.1 utest1your_testnet_address ``` Your computer calculates a short proof of work. Then the faucet server sends 0.1 TAZ to the address. No account is necessary. The command has a fixed version. Thus, a later release cannot change the code that you run. The options are in the zcash-faucet repository. ## Problem An Orchard-protocol spend has one signature under one key `ak`. Thus, shared control of a note must be inside the key. An app often has roles: a treasury, a registry or a guard. One person with one key is a weak point for each role. The person can lose the key, a thief can take it, or the person can be away when the app must sign. `nLockTime` is in effect only for transactions with transparent inputs. Thus, for a shielded note, the structure of the signers is the only path to liveness. ## Use cases - **Group treasuries.** The members of a treasury make one FROST group key with a DKG. Any `t` of `n` members can sign a spend. Thus, `t` members can sign while the other members are away. Nodes see one usual spend signature. FROST on the Ironwood pool is unaudited. See Limits. - **Registry and guard roles.** An app gives one group key to each of its roles, for example a registry or a guard. Any `t` of the `n` members of a role can sign for the role. A group is one unit of trust. Thus, `t` bad members are a bad role. See Limits. - **Deeds and titles.** Each deed has its own key from a public tweak of the group key. The owner and a guard group sign each move together. The guard members examine each move for the rules of the app. If all guard members refuse, the deed stays frozen. Review of the nested construction by a cryptographer is necessary. See Limits. The demo below is a deed with a guard group. ## Mechanism Diagram: Members 1, 2 and 3 make the group key A_G with 2-of-3 FROST. The public tweak t is a hash of the object id. A_G + [t]G is the group key of the object. ak is made from it and the owner share A_O with 2-of-2 FROST. The address of the object is made from ak. Dashed: a key that is calculated with FROST or the tweak. Each object has its own key from a public tweak. ### 1. One group key for each role - The `n` members of a role make a FROST key over RedPallas (ZIP 312). Use a distributed key generation (DKG). Then each person has only a share of the secret. - The group key is the `ak` of the role account. - The members agree on a secret `sk` in private. From `sk`, each member calculates the nullifier key `nk`, the quantum spending key `qsk` and the quantum intermediate key `qk`. From `ak`, `nk` and `qk`, each member calculates the commit-ivk randomness `rivk`. These rules are in ZIP 2005 (Usage with FROST). Each member must keep `qsk` secret and safe from loss, with the same care as the full secret of `ak`. - To spend, a coordinator makes a PCZT. Each member examines the transaction on its own and calculates the sighash. Each member refuses a signing package with a message that is different from this sighash. - Any `t` members sign in two rounds. The randomizer α is in the PCZT, so the signature is valid under `rk = ak + [α]G`. The coordinator has zero shares. It has `ak`, `nk` and `qk` (ZIP 2005, key storage). Thus, the coordinator can see the notes of the role. The role continues while `t` members are available. After a share refresh, each member has a new share. The group key stays the same. The members can also remove a member in a refresh. ### 2. A public tweak for each object Some apps need one key for each object: each title, each deed, each account. With a public tweak, each object has its own key: ``` t = ToScalar(BLAKE2b-512(domain, object id)) object key = A_G + [t]G ``` - Anyone can calculate the object key from the group key and the object ID. - For a plain group key, the `ak` of the object is `±(A_G + [t]G)`, with sign bit 0. In section 3, the object key is the verifying share of the group, and `ak` is calculated from it. - The address of the object is calculated from `ak`, `nk` and `rivk`. `rivk` is calculated from `ak`, `nk` and `qk`. Thus, the app that registers objects must have `nk` and `qk`. The app can see each object. - The members stay offline when the app registers a new object. - Each object has its own address. Outsiders see unrelated shielded addresses. - To sign for an object, the group adds `t` to its secret. The coordinator adds the public term one time. When the sign bit is 1, the members negate their shares and the coordinator negates the public term. The coordinator also negates each verifying share before it examines the answers. ### 3. A group inside a 2-of-2 key Two parties can be necessary for an object: an owner and a group. For example, the owner moves the object, and the group examines each move for the rules of the app. Make a FROST 2-of-2 key. The owner is identifier 1. The group is identifier 2: ``` ak = ±([2]A_O − (A_G + [t]G)) ``` The coefficients 2 and −1 are the result of Lagrange interpolation at zero over identifiers 1 and 2. In the Orchard protocol, the sign bit of `ak` must be 0. When the sign bit is 1, both sides negate their shares. Each object has its own `t` and its own `ak`. Thus, the sign bit can be different for each object. The owner and the guard members calculate the sign bit for each object. The group signs as one participant of the outer round: - Each chosen member sends the hash of its nonce commitments. Then each member shows its commitments. - The outer commitment of the group is the sum of the member commitments. - Each member calculates its answer from the outer round: ``` z_j = d_j + ρ₂·e_j + λ₂·c·(±μ_j·σ_j) ``` - ρ₂, `c` and λ₂ are the binding factor, the challenge and the Lagrange coefficient of identifier 2. μⱼ is the Lagrange coefficient of the member in the group. σⱼ is the share of the member. - The coordinator examines each answer against the verifying share of the member. Thus, the coordinator knows the member of a bad answer. - The coordinator adds the answers and the public term `λ₂·c·(±t + α)`. The result is the share of identifier 2. - The owner signs as identifier 1. The spend signature is a usual FROST aggregate. The owner must prove possession of its share. A dishonest owner can choose `A_O` from the group key, and then know the full secret of `ak`. The proof of possession is the defense against this attack. Each guard member compares each move with the rules of the app. At registration, the app writes each fixed rule into the first bound note of the object. A royalty rate is an example of a fixed rule. Each guard member compares each move with that note on the chain. Later, an auditor can do the same check. For the approval of one move, each member uses its own record (Approval, in Limits). ### 4. The owner keeps sk In ZIP 2005, all participants of a FROST key agree on `sk`. In a 2-of-2 key, each guard member then has `qsk`. In this design, only the owner has `sk` and `qsk`: - The owner makes `sk`. Then the owner calculates `nk`, `qsk` and `qk` from `sk`. - The owner gives `nk` and `qk` to the app. The guard members receive `nk` and `qk` from the app. - Each guard member also receives `nk` and `qk` directly from the owner. It compares these values with the values from the app. Then the guard members can see the object and examine each move. - The owner keeps `sk`, and a backup of `sk` with its share. In ZIP 2005, a holder must keep `sk` or be able to calculate it again. - The owner makes the proof of `qsk` on its own device. Thus, `qsk` stays with the owner. For a spend with the Recovery Protocol, a wallet must show a proof of `qsk` and a signature under `ak`. Thus, the owner must also have the signature of the group. The 2-of-2 rule stays in effect while discrete logarithms on Pallas stay hard to find. After an attacker can find them, the owner can possibly move the object with `qsk` only (Quantum, in Limits). With the ZIP 2005 text, each guard member also has `qsk`. Thus, after that attack, more persons can move the object alone. This design has two costs. If the owner loses `sk`, the object is lost after the switch to the Recovery Protocol. Before the switch, the owner and the group can move the object to a new address. Also, the guard members cannot make sure that `qk` is from a `qsk` that the owner has. Caution This design is different from the text of ZIP 2005. Review by a cryptographer is necessary. The Recovery Protocol in ZIP 2005 is a proposal. Its details are subject to change. ## Cost - **Chain** Zero. The spend has one usual RedPallas signature. To outsiders, it looks like a spend with one key. - **Rounds** Two FROST rounds. Members can send commitments ahead of time. Thus, each member sends its signature share in one round for each spend. A nested group has one hash round before the commitments. - **Liveness** `t` members must approve each spend. In round one, each member uses only its share (RFC 9591). Thus, members can send commitments ahead of time (FROST paper, section 5.2). Then each member signs when it approves, and the members can sign at different times. Each signature share is for one set of at least `t` members. The coordinator chooses this set before the first member signs. Each chosen member must sign before the expiry height. This is for the plain group key of section 1. Review of the nested group of section 3 with stored commitments is necessary. - **Keygen** One DKG for each role. A new object has a public tweak, with zero keygen. ## Comparison with transparent multisig A P2SH multisig address also needs `t` of `n` keys for a spend. At each spend, nodes examine the redeem script and each of the `t` signatures. The wallet rules are in ZIP 48 (Draft). In the protocol specification (§ 7.10), ZIP 48 is the reference for standard redeem script hashes of P2SH multisig addresses. The one-time lockbox payment of ZIP 271 (Final) is to the 2-of-3 P2SH multisig address of the Key-Holder Organizations. One reason for P2SH there is in ZIP 271: key generation is outside ZIP 312 (Draft). In ZIP 271, a later spend of these funds to a FROST address is presumed. | Item | P2SH multisig (ZIP 48) | FROST (ZIP 312) | | On the chain | The redeem script: all `n` public keys, `t` and `n`. The `t` signatures, the amounts and the addresses. | One spend signature for each action, under a randomized key, and a binding signature. The amounts and the addresses are encrypted. To outsiders, it looks like a spend with one key. | | Keys | Each member has a full key from its own seed. | Each member has a share of one key. After a DKG, each member has only a share of the secret. | | Keygen | Each member gives an extended public key one time. Then each wallet makes the same sequence of addresses. | A DKG, with rounds between the members. Key generation is outside the published ZIP 312. A text for it is in an open pull request, zcash/zips#895. | | Signing | One round. Each member adds its signature to a copy of the PCZT. One member combines `t` copies. | Two rounds through a coordinator. Members can send commitments ahead of time. Thus, each member sends its signature share in one round for each spend. | | New threshold or key set | A new redeem script and a new address. The members must move the funds to it. | After a share refresh, each member has a new share. The members can remove a member in a refresh. The group key and the address stay the same. In a refresh, the threshold `t` stays the same (frost-core). With their old shares, `t` of the old members can still calculate the group secret key (FROST book). | | Wallet support | librustzcash has code for ZIP 48 account keys. In Zallet, `addmultisigaddress` is not implemented yet. | The reference implementation of ZIP 312 is the `reddsa` crate. The Zkool wallet has FROST accounts with a DKG. | | Fee | 2-of-3: 2,000 zatoshis. 3-of-5: 3,000 zatoshis. | 2,000 zatoshis for all values of `t` and `n`. | | Size | 2-of-3: 389 bytes at most. 3-of-5: 531 bytes at most. | 9,166 bytes for all values of `t` and `n`. | Each fee and size is for a spend with one input, one payment and one change output. In the P2SH case, both outputs are to P2SH addresses. In the FROST case, both outputs are Ironwood notes, and the spend has two Ironwood actions. The format is v6 (ZIP 229, Final). From block 3,590,000, the fee rule for wallets is in ZIP 2009 (Proposed). Mainnet is past that block. The fees above are for the ZIP 2009 rule. A wallet with the older rule, Revision 1 of ZIP 317 (Active), pays five times these fees. The shielded transaction is larger. A wallet calculates the fee from the logical actions only. In ZIP 317, the logical actions of the transparent part are the larger of two numbers. One is the size of the inputs divided by 150 bytes. The other is the size of the outputs divided by 34 bytes. A wallet calculates the ceiling of each number. A P2SH multisig input contains the redeem script and the `t` signatures. Thus, for a larger `t` or `n`, the input is larger. Thus, the fee can also be higher. The input sizes are for the largest signature in ZIP 317 (72 bytes) and for compressed keys (33 bytes): ``` 2-of-3 input = 36 + 3 + 1 + 2 × 74 + 2 + 105 + 4 = 299 bytes 3-of-5 input = 36 + 3 + 1 + 3 × 74 + 2 + 173 + 4 = 441 bytes 2 P2SH outputs = 2 × (8 + 1 + 23) = 64 bytes logical actions, 2-of-3 = max(⌈299 / 150⌉, ⌈64 / 34⌉) = 2 logical actions, 3-of-5 = max(⌈441 / 150⌉, ⌈64 / 34⌉) = 3 fee = 1,000 × max(2, logical actions) zatoshis 36 the outpoint 3 the length of the script 1 OP_0 74 one signature: a push byte, 72 bytes, the sighash type 2 OP_PUSHDATA1 and the length of the redeem script 105, 173 the redeem script, 3 + 34 × n: OP_t, OP_n, OP_CHECKMULTISIG and n keys (a push byte and 33 bytes) 4 the sequence number 8 the value of an output 1 + 23 the P2SH script with its length: OP_HASH160, a push byte, a 20-byte hash, OP_EQUAL ``` ``` 2-of-3 transaction = 20 + 1 + 299 + 1 + 64 + 4 = 389 bytes 3-of-5 transaction = 20 + 1 + 441 + 1 + 64 + 4 = 531 bytes Ironwood transaction = 20 + 6 + 2 × 820 + 44 + (2720 + 2 × 2272) + 3 × 64 = 9,166 bytes 20 the five common fields of 4 bytes each 1, 4, 6 1, 4 or 6 count fields of one byte each 820 one action 44 the flags, the value balance, the anchor and the length of the proofs: 1 + 8 + 32 + 3 2720 + 2 × 2272 the proofs of two actions 64 one signature: two spend signatures (one for each action) and one binding signature ``` The script formats are in the P2SH and multisig sections of the Bitcoin developer guide. These two sections are also in the references of the protocol specification. ## Limits - **Audit.** FROST on the Ironwood pool is unaudited. ZIP 312 is a draft. The nested construction is from the recipe of the `frostito` crate, and review is necessary. - **Trust.** A group is one unit of trust. `t` bad members are a bad role. - **Refusal.** If all members refuse, the object stays frozen. The remedy is outside the chain, for example in law. - **Coordinator.** Each member must examine the request on its own. Each member must also sign the set of commitments that it saw, so that the coordinator shows the same set to each member. The coordinator must send the randomizer, the message and the commitments over a confidential and authenticated channel (ZIP 312). - **Message.** The member software calculates the signature share over the message in the signing package. It compares that message with its own sighash. Do this comparison in the function that signs, before the software calculates the signature share. Software that compares in a different step can examine one value and sign a different value. - **Approval.** With the sighash, a member knows that it has the same transaction as the coordinator. Each member also compares the transaction with a record that the member keeps, for example the proposal that it approved. A member that uses only data from the coordinator can sign a move that is different from the approved move. - **Nonces.** Each member uses each nonce for one signature share only. After a member calculates a signature share, it deletes the nonces (RFC 9591). In the two-round flow, each spend has its own signing session. Each member makes new nonces in round one of each session. Keep these nonces in memory only. After a reload, the members start a new session. Each member uses only the commitments and the signing package of the current session. - **Stored nonces.** Members can send commitments ahead of time. For this flow, each member must put its nonces on its device. This is a cost in state. Each member keeps its stored nonces secret, with the same care as its share. The coordinator puts each commitment in one signing package only. A member uses each of its commitments with one signing package only. The member must have zero copies of the nonce before it sends the signature share. Backups must not contain nonces. This includes system backups and transfers to a new device. After a member receives its share from a backup or a copy, it cancels each commitment that it sent before. The coordinator then removes these commitments. Member software can use a nonce two times if it receives that nonce from a backup or a copy. - **Backup.** Each member must keep a backup of its share. A member that has `sk` must also keep a backup of `sk`. A draft format for this backup is in zcash/zips#1432. The draft is for the plain group key of section 1. Also see Backing Up Key Shares in the FROST book. That section is older than ZIP 2005. With ZIP 2005, the backup must contain `sk`, because `qsk` is calculated from `sk` only. - **Quantum.** With the ZIP 2005 rules, each member of a role has `qsk`. In the design of section 4, only the owner has `qsk`. An attacker that can find discrete logarithms can possibly steal the funds with `qsk` only (ZIP 2005). Thus, when a post-quantum pool with threshold signatures is available, move the funds of each role to that pool. ## Spec FROST for spend authorization is specified in ZIP 312. This page is a design note for the tweak and the nested group, for experiments only. ## Demo: a deed with a guard group In a toy registry, each deed has its own key. The owner has one side. A guard group of three members has the other side, and any two of them sign. The demo uses the `reddsa` crate (RedPallas FROST), compiled to WebAssembly. A trusted dealer makes the demo keys from a random seed. A real group uses a DKG. --- Page: https://appliedzcash.com/patterns/log-in-with-zcash/ # Log in with Zcash A user logs in to an app with a Zcash address. The user pays a small amount from a wallet. A server wallet then sends a one-time code in a memo to the address. The user types the code in the app. The server wallet sends the code only to that address. Thus, the address is the account of the user. This pattern is from ZcashMe. The use of a one-time code in a memo for login is the invention of Zechariah. The Zcash Verification Service is the reference implementation. ## Problem An app must know that a user controls an address. The sender of a shielded payment is secret, also to the receiver. Wallets sign messages with transparent keys at most. ZIP 304 is for Sapling keys only. Each shielded wallet sends payments with memos. Each shielded wallet also shows the memos of the payments that it receives. These two functions are the base of this pattern. ## Use cases - **Website accounts.** Each user logs in to an app with a unified address. The address is the account of the user. One wallet can make many addresses. Thus, one user can have many accounts. See Limits. - **Login through OpenID Connect.** A server can run the flow as an OpenID Connect provider, as ZcashMe does. An app sends the user there with a usual OIDC library. After the login, the app receives the unified address of the user as the `sub` claim. Apps that get the same address can link the accounts of the user. See OpenID Connect and Limits. - **Payout address check.** An app asks a user to log in with an address before the app sends funds to it. With a correct code, the app knows that the user can read the memos of that address. A holder of the incoming viewing key of the address can also read the code. A correct code is a claim about one receiver of the address only. See Limits. ## Mechanism ### Roles - User A person with a Zcash wallet and a unified address. - App The website that the user logs in to. It makes sessions and examines codes. - Worker A server wallet. It receives login payments and sends codes. - Service address The unified address of the worker. The app puts it in each login link. - Session ID A number of 16 decimal digits. The app makes a new session ID for each login. - Return address The address that the user gives to the app. The worker sends the code there. - Code key A secret key of 32 bytes. The worker and the app each have a copy. - Code A one-time code of 6 digits. ### Sequence Diagram: 1: The user gives the app an address. 2: The app shows a login link. 3: The user pays the worker, and the payment has the login memo. 4: The worker sends a memo with a 6-digit code to the address. 5: The user types the code in the app. 6: The app calculates the code and compares the two codes. Each arrow is one message. The steps are in sequence from top to bottom. - The user types their unified address in the app. This address is the return address. - The app makes a session ID. It writes the login memo from the session ID and the return address. - The app shows a ZIP 321 payment link as a QR code. The link has the service address, the login amount and the login memo. - The user pays the link from a wallet. The funds can come from any wallet. - The worker finds the payment in the mempool. It decrypts the payment with its viewing key and reads the memo. - The worker calculates the code from the code key, the session ID and the return address. - The worker sends a shielded payment to the return address. The memo of this payment contains the code. - The user reads the code in the wallet and types it in the app. - The app calculates the code and compares the two codes. If they are equal, the user is logged in. The worker and the app calculate the code independently, from the same three values. Thus, the worker needs a connection to the Zcash network only. ### Login memo The app writes the login memo as one line of text: ``` memo = "DO NOT MODIFY:{zvs/" session "," address "}" session the session ID, 16 decimal digits address the return address, as the user typed it ``` The wallet shows the memo before it sends the payment. The first words are an instruction for the user. The worker accepts this format only. It refuses a memo with a different prefix, a second comma, or text after the last brace. ### Code ``` code = HMAC-SHA256(key, session ‖ address)[0..4] mod 10⁶ ``` The first 4 bytes of the HMAC are a big-endian number. The code is this number modulo 1,000,000, written as 6 decimal digits. The address in the calculation is the exact text of the address in the memo. The worker puts the code in the memo of the reply. The memo contains the 6 digits only: ``` 847291 ``` ### What the code shows The reply is a shielded payment to the return address. Outside the service, only a holder of the incoming viewing key of that address can read it. Thus, a correct code shows that the user can read the memos of that address. The service also knows the code. The worker and the app calculate it, and the worker can read the reply that it sent. Thus, the result is correct only while the keys of the service are secret. The login payment can come from any wallet, because its sender is secret. Wallet-native orders has a different sign-in. There, the operator already knows the address and sends the code first. ### Worker The worker examines the return address before it sends the reply. The address must be valid for the network of the worker. The reply at ZcashMe has an amount of 0.0005 ZEC. The worker keeps a record of each reply on disk. Thus, the worker makes one reply transaction at most for each login payment. After a failure, the worker sends the same transaction again. ### OpenID Connect ZcashMe runs this flow as an OpenID Connect provider at `auth.zcash.me`. An app sends the user there with a usual OIDC library. After the login, the app receives the unified address of the user as the `sub` claim. ## Cost - **Each login** The login amount and the network fee. The minimum login amount at ZcashMe is 0.002 ZEC. A usual shielded payment with change has two actions. From block 3,590,000, the fee rule for wallets is in ZIP 2009. With that rule, the fee for two actions is 2,000 zatoshis. A wallet with the older rule of ZIP 317 pays 10,000 zatoshis. The user receives the reply amount. - **The service** The reply amount and the network fee of each reply. At ZcashMe, the reply amount is 0.0005 ZEC and the fee is 2,000 zatoshis. The worker pays both from the login amounts. - **Wallets** Each login is two transactions on the chain. See Polite actions. - **Time** The worker sends the reply when the login payment is in the mempool. The wallet of the user shows the reply after its next sync. - **Wallet support** ZIP 321 with memos. The wallet must send the memo bytes unchanged, and it must show the memos of received payments. ## Limits Warning The code key is a shared secret. A person with the code key can calculate the code for each session and each address. A person with the outgoing viewing key of the worker can read each reply. Keep these keys on the servers of the app and the worker only. - **Viewing keys.** A holder of the incoming viewing key of the return address can read the code. Thus, this holder can log in as the address. - **Receivers.** A unified address can contain receivers from different wallets. The worker sends the reply to one receiver of the address. Thus, a correct code is a claim about that receiver only. - **Many addresses.** One wallet can make many addresses, and an app cannot link them. Thus, one user can have many accounts. See Address per customer. - **Guesses.** A code has 6 digits. The app must stop a session after a small number of incorrect codes. - **Lifetime.** The calculation has no time input. Thus, the code of a session stays the same. The app must give each session an expiry, and it must accept the code one time only. - **Phishing.** A clone page can show the login link of a real session and then ask for the code. The user must examine the host of the page before they type a code. - **Mempool.** A payment in the mempool can expire before it is in a block. Thus, the service can lose the reply amount and the reply fee, and receive no login amount. - **Privacy.** Outsiders see two usual shielded transactions. The service knows the return address and the time of each login. Apps that get the same address can link the accounts of the user. ## Alternative: a signature login With a new wallet function, a wallet signs a login message with a wallet key. Thus, the login is off the chain. The worker, the code key and the fees are unnecessary. Most wallets do not have this function today. The designs are on the wishlist page Signature login. ## Spec The reference for this pattern is the source of the Zcash Verification Service, under the MIT license. The memo format is in `src/memo.rs`. The code calculation and its test vector are in `src/otp.rs`. ## Demo: a toy login These are the values of the toy login: Demo parameters ``` amount 0.002 ZEC memo "DO NOT MODIFY:{zvs/" session "," address "}" code HMAC-SHA256(key, session ‖ address)[0..4] mod 10⁶ reply code ``` The demo writes the login memo, makes the ZIP 321 URI and draws the QR code. It also calculates the code, as the worker and the app do. The session ID and the code key are random values from your browser. To examine the calculation, type the test vector of the reference implementation: Test vector ``` key 000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f session 1234567890123456 address u1example-return-address code 880279 ``` Caution The service address is a Testnet address. Its key is in the public source of this site. A wallet on Testnet can pay the link, but the worker is only a demo. --- Page: https://appliedzcash.com/patterns/verified-address/ # Verified address A service examines that a user controls a Zcash address. Then the service writes a record of the check in a bound note. A verifier with the receipt finds the record on the chain. This pattern is a combination of Log in with Zcash and Bound notes. The login is the check. The bound note is the record. Warning This pattern is a proposal of this site. It has no implementation and no review. Use it on Testnet only. The Experimental tag stays until a reviewer examines the record format and an app uses it. See Status. ## Problem A login is a fact between two parties: the user and the app. The app examines the code, and the session starts. For a login, a record on the chain is unnecessary. Some claims must stay valid for other parties, and for a long time: - a user must show that an address was verified before a deadline, for example for a vote; - a second app accepts the check of the first service; - an auditor examines the full list of a service that gives "verified" marks. A signed token from the service is sufficient while the service is honest. A dishonest service can put an old date on a new token. It can also show different lists to different persons. A record in a chain of bound notes has a place in a block. Nodes accept one successor for each note. Thus, each record has a height, and the service has one list. ## Use cases - **Vote eligibility.** A user shows a verifier that an address was verified before the deadline of a vote. The height of the block of the record is the time of the claim. One user can register many addresses. Thus, the number of users can be smaller than the number of records. See Limits. - **Checks between apps.** A second app accepts the check of a first service. The second app examines the receipt against the directory of that service. The record is the statement of the service. Thus, the second app must trust the service for the code check. See Limits. - **Audits of verified marks.** An auditor examines the full list of a service that gives "verified" marks. The service can publish only the first part of its chain. Thus, the auditor calculates the nullifier of the last listed record. That nullifier must be absent from the chain up to a checkpoint height. See Public list. ## Mechanism ### Roles - User A person who logs in with a Zcash address. - Service The app and its server wallet. It examines login codes and writes records. - Verifier A person or an app that examines a receipt. - Directory The chain of bound notes of the service. Each record is one note of the chain. - Salt A secret value of 32 random bytes. The service makes a new salt for each record. - Claim A hash of the salt and the address. The claim is the fields of the record. - Receipt The data for the check of one record: the address, the salt, the transaction ID, the action index and `prev`. ### Sequence Diagram: 1: The user logs in, and the service examines the code. 2: The service writes the record in a bound note. 3: The service gives the receipt to the user. 4: The user gives the receipt to a verifier. 5: The verifier calculates cmx and compares it with the chain. Each arrow is one message. Amber: a step that uses the chain. - The user logs in with an address. The service examines the code. See Log in with Zcash. - The service makes a salt and calculates the claim: ``` claim = BLAKE2b-256(P, salt ‖ address) ``` - The service builds a bound note to the directory address. The fields are the claim. `prev` is the `cmx` of the tip of the directory. - The service spends the tip in the action of the new note. Then it sends the transaction. - When the transaction is in a block, the service gives the receipt to the user. - The user gives the receipt to each verifier that must examine the claim. `P` is a personalization of 16 bytes. The address is the text of the address from the login, with no space before or after it. The salt has a fixed length. Thus, two different pairs of salt and address always have two different hash inputs. ### Public list The service publishes the claim and the place of each record. The place is the transaction ID and the action index. With this list, anyone can examine each listed record and its lineage. Each claim is a hash of the address and a secret salt of 256 bits. Thus, the address stays secret from a person who has only the list. A service can publish only the first part of its chain. Thus, a count of the listed records is a minimum. For a full audit, the auditor selects a block height as a checkpoint. With the full viewing key, the auditor calculates the nullifier of the last listed record. The auditor accepts the list as complete only if that nullifier is absent from the chain up to the checkpoint. ### Verification The service publishes the directory address, its full viewing key and the pin of the genesis note. A verifier with a receipt: - calculates the claim from the salt and the address; - reads `nf_old` and `cmx` from the action of the receipt; - calculates `rseed` from the kind, the claim and `prev`; - calculates the note commitment and compares its x-coordinate with `cmx`; - examines the lineage from the genesis note to the record, with the public list. The height of the block of the record is the time of the claim. Steps 3 to 5 are the usual checks for a chain of bound notes. See Bound notes: Verification. ### What the record shows A valid record shows three facts: - the service wrote this claim; - the claim was on the chain at this height; - the directory has one sequence of records. The code check stays with the service. A verifier must trust the service for that step. As in Log in with Zcash, a correct code shows that the user can read the memos of the address. ### Private and public records For a private record, only the user and the service have the receipt. The user selects each verifier. For a public directory, the service publishes each address and its salt. Then anyone can examine each record. ## Cost - **Each record** In a usual record transaction, the tip and one funding note are spent. The outputs are the new record and a change note. That is two actions. From block 3,590,000, the fee rule for wallets is in ZIP 2009. With that rule, the fee for two actions is 2,000 zatoshis. A wallet with the older rule of ZIP 317 pays 10,000 zatoshis. - **Wallets** Each wallet tries to decrypt each action on the chain. A service with many logins can put many claims in one record. The fields are then the Merkle root of the claims, and each receipt has a Merkle path. See Polite actions. - **Verifiers** One BLAKE2b hash for the claim. Then one BLAKE2b hash and one Sinsemilla commitment for each record of the lineage. - **Builders** The transaction builder must accept an `rseed` from its caller. See Bound notes: Cost. ## Limits - **Trust.** The record is the statement of the service. A dishonest service can write a record for an address with no login. Use a record only if you trust the service for the code check. - **Viewing keys.** A holder of the incoming viewing key of the address can log in. Thus, the record is a claim about the viewing key. The spending key can have a different holder. - **Receivers.** The service sends the login code to one receiver of the address. Thus, the record is a claim about that receiver only. See Log in with Zcash: Limits. - **Count.** One user can register many addresses, and a verifier cannot link them. Thus, the number of records is a number of addresses. The number of users can be smaller. - **Time.** The record is correct for its height. The user can lose control of the address after that height. For a new claim, the user logs in again. - **Receipts.** A receipt discloses the address to the verifier. The verifier can give the receipt to other persons. Use a different address for each claim that must stay apart. - **Salts.** A check of an address against a record is possible only with the salt. The service or the user must keep each receipt. - **Public data.** The number of records and the height of each record are public. ## Spec This pattern has no spec. The record format of the demo is a proposal. The rules for the binding and the lineage are in the draft ZIP for Bound notes. ## Demo: a toy directory These are the values of the toy directory: Demo parameters ``` D "VerifiedAddr_v1_" kind 1 (verified) fields claim = BLAKE2b-256("VerifiedAddr_clm", salt ‖ address) prev the cmx of the previous record ``` The demo starts after a correct login code. It uses the `orchard` crate, compiled to WebAssembly. The directory key is a demo key. The ρ of the first record is a demo value. The demo calculates the values of each note only. For each next record, ρ is the nullifier of the previous record. Each record is an Ironwood-pool note. --- Page: https://appliedzcash.com/patterns/memo-stones/ # Memo stones An author sends a memo in a shielded payment. A server calculates one hash from all the memos of a period and puts it in a public record. The author keeps a receipt. With the receipt, anyone can find the memo in the record. The sender stays secret. The memo contains a hash of the text. Thus, the text stays secret until the author shows it. Warning This pattern is a proposal. It has no deployed service and no review. Use it on Testnet only. The Experimental tag stays until a reviewer examines the design and a service runs it on Testnet. See Status. ## Problem A service must show in public that it received a text at a time. The sender and the text must stay secret. Examples are a research result of an agent, a sealed bid, and a report from an employee. Only the recipient, the sender and the holders of their viewing keys can read the memo of a shielded payment. Thus, outsiders cannot see that the service received the memo. In a public post, all persons can read the text. One use is a retrospective grant for proof of agentic work. A lab records a claim of each result of its agents at the time of the work. Later, the lab shows the receipts to a funder as evidence. The time of each claim is in the transparent chain. The funder sees that each text existed at the time of its record. The funder does not see who did the work: a receipt has no name of an author. To show the author, the lab can put a signature of a known key in the text. ### When to use this pattern Use it in these conditions: - other parties must see, at a later time, that the service received a text at a time; - the text must stay secret until its author shows it; - many authors send texts, and one record for each period is sufficient. A different design is better in these conditions: - Only the author and the service use the fact. Then the memo is sufficient, with no record. - The text can be public. Then publish the text. - One author needs a timestamp and no service. Then the author can write a hash in a bound note. ## Use cases - **Research claims.** For each result, an agent of a lab sends the text hash of a claim in a memo. Later, the lab shows the receipts to a funder, for example for a retrospective grant. A receipt is weak evidence of who wrote the text. To show the author, the lab can put a signature of a known key in the text. See What a verifier knows from a receipt. - **Sealed bids.** Each bidder sends the text hash of a bid in a memo. Later, the bidder shows the bid, the text salt and the receipt. The service can select payments to ignore by the topic, the amount and the time. Thus, each bidder examines a receipt before the bidders show their bids. See Limits. - **Employee reports.** An employee sends the text hash of a report in a memo. With the receipt, the employee can show that the report existed at the time of the record. Each holder of the full viewing key of the employee can read the memo. Thus, the employee pays from an account with a viewing key that only the employee has. See Limits. ## Mechanism - Author A person or an agent with a shielded wallet. The author writes the text. - App A web page of the author. It calculates the text hash, and writes the memo and the payment link. It keeps the receipt in the browser. - Service The operator of the reader and the writer. - Reader A server with the incoming viewing key of the service. It finds payments and reads memos. - Writer A server with one transparent key. It sends the record transactions. - Text hash The hash of the text and a random text salt. It is the body of the memo. - Leaf The hash of one memo. The memo contains a random salt. - Stone The Merkle root of the leaves of one period. In a record on the chain, it cannot change. - Record One stone in a transparent `OP_RETURN`, with a record number and a leaf count. - Receipt The memo, the ID of the record transaction, and the path from the leaf to the stone. Diagram: 1: The author sends a shielded payment with the memo to the reader. 2: The reader gives the leaf to the writer. 3: The writer sends a record with the Merkle root, the stone, to the chain. 4: The writer publishes the leaf list. 5: The app of the author makes the receipt. The reader and the writer are the service. The steps are in sequence from top to bottom. - The app calculates the text hash from the text and a random text salt. It writes the memo from a topic, a random salt and the text hash. It shows a ZIP 321 payment link, and the author pays it from a shielded wallet. - The reader finds the payment and examines the memo and the amount. It calculates the leaf and gives it to the writer. The writer does not receive the memo. - At the end of each period, the writer calculates the root of the new leaves: the stone. It sends one record transaction with the stone. - The service publishes the leaf list of the record. The list contains hashes only. - The app finds its leaf in the list and completes the receipt. The author gives the receipt to a verifier at a later time. The service sends no reply payment. The app uses public data only for steps 4 and 5. Thus, the author needs no account at the service. As an option, the app puts the text in the memo as the body. Then the service can read the text. See Limits. ### Record chain Input 0 of each record transaction is output 1 of the record transaction before it. Nodes accept each spend of an output one time only. Thus, each record has one next record at most. The service publishes the transaction ID of record 0. Thus, the writer cannot make a second history from record 0. A verifier examines the chain: see Receipt. The service can cut off records only with a recovery. A recovery is a public record with a block time: see Keys. ### Other designs A Merkle root of hashes in an `OP_RETURN` is the design of OpenTimestamps. There, a client sends each hash to a calendar server through a web API. In this pattern, the author sends the hash in a shielded payment. With the shielded payment, the pattern has these properties: - The service needs no web API and no accounts. Its payment address is the full interface. - The service does not see a network address or an account of the author. - The author pays the service for each memo. Thus, a sender of many false memos has a cost. Bound notes have the property of one history in a shielded pool. A service can put the stone in a bound note. Then a verifier needs the revealed fields of each record. The records of this pattern are in the transparent pool. Thus, anyone can read each record and the time of its block with no key and no disclosure. A usual transparent wallet library is sufficient for the writer. In Verified address, a server writes one salted hash in one bound note, for one user. In this pattern, the writer puts one root for the memos of many authors in each record. ### What a verifier knows from a receipt - The stone of the record contains this exact memo, with this topic. - The service wrote the record, and the record has one place in the record chain. - The memo existed at the time of the block. - With the text and the text salt: the memo contains the hash of this exact text. A receipt has no name of an author. Each holder of a receipt can show it. Thus, a receipt is good evidence that a text existed at a time. It is weak evidence of who wrote the text. A receipt is evidence about one leaf only. It is no evidence that the record contains all the memos of its period. See Limits. The salt and the text salt have 256 bits each. Thus, outsiders cannot find the memo of a leaf by guesses. The service cannot find the text of a text hash by guesses. ### Keys The reader has the incoming viewing key only. The writer has one transparent key. The funds for the fees and output 1 of the last record are under that key. The spending key of the service stays offline. See Watch-only keys. A person who breaks into the reader gets the memos, and gets no funds. A person who breaks into the writer gets no memos. That person gets the fee funds and the control of the record chain. There are two risks: - That person can send records with leaves of any value. Verifiers then accept them as records of the service. - That person can spend output 1 of the last record in a different transaction. Then the record chain has no next record. To recover, the service makes a new writer key and sends a recovery record 0. This record contains the ID of the last correct record transaction of the old chain. The service publishes the ID of the recovery record. Verifiers then refuse the later records of the old chain. The receipts of the earlier records stay valid. The recovery is a trust point. With a recovery, the service can also cut off correct records. Each recovery is on the chain and has a block time. Thus, a verifier sees a late recovery and the records after the last correct record. ## Cost - **Each memo** One usual shielded payment from Ironwood notes has two actions. With the ZIP 2009 fee rule, the fee for two actions is 2,000 zatoshis. With the older rule of ZIP 317, the fee is 5,000 zatoshis for each logical action. The minimum fee is 10,000 zatoshis. Thus, a wallet with that rule pays 10,000 zatoshis for two actions. A wallet that spends Orchard notes puts the spend in an Orchard bundle and the payment in an Ironwood bundle. With the default builders, each bundle has at least two actions. Thus, a usual payment from Orchard notes has four actions. Its fee is 4,000 zatoshis. With the older rule, the fee is 20,000 zatoshis. - **Each record** One transparent transaction for all the memos of a period. Its two outputs are 88 bytes. In ZIP 317, that is three logical actions. With the ZIP 2009 fee rule, the fee is 3,000 zatoshis. With the older rule, the fee is 15,000 zatoshis. - **Wallets** A record transaction has no shielded actions. Thus, other wallets do no trial decryption for a record. See Polite actions. - **Reader** One incoming viewing key. The reader does trial decryption of each shielded action of each block, as a wallet does. It also gets the full transaction of each payment. - **Receipt** The memo and the path. A path in a record of n leaves has ⌈log₂ n⌉ hashes or fewer, of 32 bytes each. For 1,000 leaves, a path has 10 hashes or fewer. - **Relay** The `OP_RETURN` script of a record is 45 bytes. By default, Zebra nodes relay an `OP_RETURN` script of 83 bytes or fewer. They refuse a record with less than 54 zatoshis in output 1. - **Wallet support** ZIP 321 with memos. The wallet must send the memo bytes unchanged. The service address has shielded receivers only. ## Limits Warning With a text hash in the memo, the reader cannot read the text. With the text in the memo, the reader sees the text and the salt. Then the service can show each recorded text as its own. Put the text in the memo only if the service can read it safely. - **Refusal.** The service can ignore a payment and still send a valid record. After the maximum delay, the author compares each leaf list with the root of its record. If no list contains the leaf, or a list is absent, the author sees a refusal. To show the payment to other persons, the author needs a payment disclosure (ZIP 311, draft). - **Selection.** The reader sees the full memo and the amount of each payment. With a text hash in the memo, the reader cannot read the text. Thus, the reader can select payments to ignore by the topic, the amount and the time. An author can tell the service the leaf of a memo. Thus, the service can keep that leaf and ignore the others. For sealed bids, each author must use the Receipt steps to examine a receipt. The authors must do this before they show their bids. - **Author keys.** The wallet of the author can use its outgoing viewing key for each payment. Thus, each holder of the full viewing key of the author can read the memo. That holder can also calculate its leaf. Thus, that holder knows which record contains a memo of the author. Pay from an account with a viewing key that only the author has. - **Enclave.** As an option, the service can run the reader and the writer in an enclave, a trusted execution environment (TEE). Then the enclave code puts each leaf in a record. These conditions are necessary: - The enclave sends an attestation. The verifier examines the signature of the attestation. The verifier calculates the code hash from a reproducible build of the published source. The code hash must be the same as the hash in the attestation. - The enclave examines the header and all the transactions of each block. It calculates the Merkle root of the transaction IDs. Then it compares this root with the root in the header. It gets the chain tip from sources that are independent of the operator. The operator can hold back blocks or the chain tip. Thus, the enclave sends no records, and the authors see the delay. - The writer key stays in the enclave. Each writer public key that the enclave makes must be in a verified attestation. The verifier calculates the P2PKH address of each writer public key. This address must be the record address of its record 0 or recovery record 0. - The verifier then trusts the maker of the chip. An enclave decreases the risk. Attacks on enclaves are known. Thus, a payment disclosure stays necessary. - **Refunds.** The sender of a payment is secret. Thus, the service cannot send back a payment with an invalid memo. The app must examine the memo and the amount before it shows the link. - **Timing.** A record a short time after a payment is a possible link between the two. With a longer period and more leaves, the link is weaker. - **Memo download.** Compact blocks contain no memos. A reader gets each memo in a full transaction. If it gets only payment transactions from a light wallet server, that server sees each payment transaction. If it gets all transactions only from blocks with payments, that server sees those blocks. A reader can use `GetMempoolStream` to receive all full transactions in the server's mempool. Thus, the reader receives those memos without payment-specific requests. For payments absent from the stream, the reader can use `GetTransaction`. If the author wallet and the reader use the same server, that server can link the IP address of the author to a payment to the service. Use a reader with its own node. - **Leaf list.** The leaf list is off the chain. If the service holds back a list, the authors cannot complete their receipts. The authors can see the delay. - **Empty leaves.** The writer can put any hash in a record. The verifier must use paths with at most ⌈log₂ n⌉ hashes for a record with n leaves. Thus, the maximum number of real memos is two to the power of ⌈log₂ n⌉. - **Copies.** The reader drops a leaf that is equal to a leaf of the open period or of a record. Thus, the record has no second leaf for a second payment with the same memo. - **Reorganization.** The reader must wait for confirmations before it accepts a payment. - **Disclosure.** A shown receipt stays public. It contains the topic of one leaf, and the text if the author shows it. - **Truth.** A receipt is evidence that the service recorded a text at a time. It is no evidence that the text is true. - **Public data.** The number of leaves of each period and the time of each record are public. Thus, outsiders see how much the service is used. - **Transparent funds.** The fee funds of the writer are public, and so is their source. Use funds with no link to other addresses of the service. - **Writer key.** A person with the writer key can send false records or stop the record chain. See Keys. - **Chain data.** Each record stays on the chain. With a longer period, the chain has fewer records. ## Spec The protocol of today is sufficient: the ZIP 302 memo format, ZIP 321 payment links and a transparent `OP_RETURN`. The formats in this section are the full spec. The test vectors are in `demo/src/memo_stones.rs`. ### Memo ``` memo = "DO NOT MODIFY:{ms1/" topic "," salt "}" LF body topic 1 to 32 characters: a to z, 0 to 9 and the hyphen salt 64 hexadecimal characters in lowercase LF one line feed (0x0A) body the text hash as 64 hexadecimal characters in lowercase, or the text text UTF-8, 1 byte or more, without the character U+0000 ``` The wallet shows the memo before it sends the payment. The first words are an instruction for the author. The header is 118 bytes at most. Thus, 394 bytes or more are free for the body. The reader accepts this format only. It refuses a different prefix, a second comma in the braces, an empty body, and a body with U+0000. The reader removes the zero padding at the end of a memo. Thus, a text with U+0000 at its end has no correct leaf. ### Text hash ``` text hash = BLAKE2b-256("MemoStones__Text", text salt ‖ text) ``` The text salt is 32 random bytes. The app makes it and keeps it with the text. With a text hash, the length of the text has no limit. ### Leaf and root ``` leaf = BLAKE2b-256("MemoStones__Leaf", memo) node = BLAKE2b-256("MemoStones__Node", min(a, b) ‖ max(a, b)) ``` The input of the leaf hash is the memo bytes without the zero padding. The 16 characters in quotation marks are the BLAKE2b personalization. The two values are different, so a leaf is never valid as a node. The writer compares two hashes as raw bytes, in lexicographic sequence. This rule is for the sequence of the leaves and for `min` and `max`. - The writer drops each copy of a leaf. It puts the leaves in sequence, from the smallest value to the largest. - The writer calculates one node from each pair of leaves, from the left. An odd last leaf goes up unchanged. - The writer does step 2 again with the nodes, until one node stays. This node is the root: the stone. The two inputs of each node are in sequence by value. Thus, a path is a list of hashes only. With one leaf, the root is the leaf. ### Record The record is the data of one `OP_RETURN` output: - `tag MST1` 4 bytes - `version` 1 byte - `number` 4 bytes - `leaves` 2 bytes - `root` 32 bytes Total: 43 bytes The script of the output is 45 bytes: `0x6a` (`OP_RETURN`), `0x2b` (a push of 43 bytes) and the record. The version is 1. The record number and the leaf count are big-endian. The first record has the number 0. Each later record has the number of the record before it, plus 1. The time of a record is the time of its block. A record transaction has transparent inputs and outputs only: ``` input 0 output 1 of the record transaction before it output 0 the OP_RETURN with the record, value 0 output 1 the change, to the record address of the service ``` A record transaction has exactly two outputs. The writer can add more inputs to pay the fees. The service publishes the transaction ID of record 0. The service publishes a maximum delay, as a number of blocks. For each payment with a valid memo and amount, a record must contain the leaf. The block of that record is not more than the maximum delay after the block of the payment. The service publishes the leaf list of that record before the end of the maximum delay. Thus, an author can see a refusal at a known block. Each record after record 0 has one leaf or more. For a period with no new leaves, the writer sends no record. Record 0 has a leaf count of 0. It has two forms: ``` first record 0 root = 32 zero bytes recovery record 0 root = the ID of the last correct record transaction of the old chain ``` The ID in the root field has the byte order of a transaction input. This order is the opposite of the order that a block explorer shows. Input 0 of a record 0 has no rule. ### Leaf list The service publishes one file for each record. The file has the record number, the transaction ID, the root and all the leaves. Anyone can calculate the root from the leaves and compare it with the record on the chain. ### Receipt ``` memo the exact memo txid the ID of the record transaction path the hashes from the leaf to the root text_salt the text salt, for a memo with a text hash text the text, for a memo with a text hash ``` The author can show a receipt without the last two fields. Then the text stays secret. A valid record transaction has these properties: - It is in a block with sufficient confirmations. - It has exactly two outputs. - Output 0 has the value 0. Its script is `0x6a`, `0x2b` and a record of 43 bytes with the tag `MST1` and version 1. - Record 0 has a leaf count of 0. Each later record has one leaf or more. A verifier examines a receipt in these steps: - The verifier examines the format of the memo. - The verifier calculates the leaf from the memo. - The verifier makes sure that the path has ⌈log₂ n⌉ hashes or fewer. Here n is the leaf count of the record. - The verifier calculates the root from the leaf and the path. - The verifier gets the record transaction and makes sure that it is valid. It compares the root with the root in output 0. - The verifier gets the transaction with the output of input 0, and makes sure that it is valid. Input 0 must be its output 1. Its record number must be smaller by 1. - The verifier does step 6 again for each record, back to record 0 of that chain. - The verifier compares the ID of that record 0 with the ID that the service published. If they are equal, the chain is the current chain. - If they are different, the verifier starts at the published record 0. It follows the root field of each recovery record to an older chain. It stops at the chain of the receipt. - In an older chain, the verifier compares record numbers. The record of the receipt must have the number of the last correct record or a smaller number. - The verifier reads the time of the block of the record transaction. - If the receipt has a text, the verifier calculates the text hash. It compares the text hash with the body of the memo. If one step fails, the receipt is invalid. In step 9, the verifier also examines each last correct record as in steps 5 to 7. ## Demo: research claims A lab uses agents for research. An agent sends the hash of a claim of each result in a memo. Each claim has the time of its record, and the results stay secret. The lab discloses one result later, with its receipt. These are the values of the toy record: Demo parameters ``` amount 0.001 ZEC topic research record number 7, with your leaf and 3 fixed leaves ``` The demo calculates the text hash, writes the memo and calculates the leaf. It makes the payment link, the record and the receipt. Then it examines the receipt as a verifier does. The two salts are random values from your browser. The demo has no chain. The toy transaction ID is the SHA-256 hash of the record. The demo finds the record of the ID in the receipt. It does not examine the record chain. To see an incorrect receipt, change one character of the memo or of the text in the receipt box. Caution The service address is a Testnet address. Its key is in the public source of this site. The demo has no reader and no writer. Thus, a payment to the link has no record. --- Page: https://appliedzcash.com/patterns/batch-payouts/ # Batch payouts A sender writes one ZIP 321 payment link with many payments. One wallet makes one shielded transaction. Each recipient receives its amount and its memo. The sender signs one transaction for the whole batch. This pattern is for payrolls, bounty payouts, grant payouts and refund batches. See Payment links for the base pattern. Warning This pattern is a proposal. Some wallets do not accept a URI with more than one payment. See Wallet support. The Experimental tag stays until most of the tested wallets accept a URI with more than one payment. See Status. ## Problem An app has one sender and many recipients. Each recipient needs its own amount and its own memo. The sender wants one confirmation and one on-chain transaction. Without this pattern, the app writes one payment link for each recipient. The sender signs one transaction for each link. Thus, 20 recipients need 20 confirmations and 20 transactions. The total fee for 20 transactions is more than the fee for one. ### When to use this pattern Use it in these conditions: - the sender pays many recipients at the same time; - each recipient needs a different amount or a different memo; - the sender's wallet accepts multi-payment URIs. A different design is better in these conditions: - The sender needs one recipient only. Then use Payment links. - The sender's wallet rejects multi-payment URIs. Then the app writes one payment link for each recipient. See Wallet support. ## Use cases - **Payroll.** An employer pays each employee in one transaction. Each memo can contain one payslip line, for example the period and the amount. Each employee can estimate the size of the batch from the number of actions. See Limits. An employer splits a payroll with more actions than the block limit across two or more blocks. See Cost. - **Bounty payouts.** A project operator pays the accepted bounties of a period in one transaction. Each memo contains the name of the bounty. - **Grant payouts.** A grant operator pays milestone payments to several grantees in one transaction. Each memo contains the grant name and the milestone. The app writes a memo only for a shielded recipient. The amount to a transparent address is public. See Limits. - **Refund batches.** A shop returns funds to many buyers in one transaction. Each memo contains the order number. The sender of a shielded payment is secret. Thus, the shop asks each buyer for a refund address, for example in the memo of the order payment. ## Mechanism - Sender A person or a program with a shielded wallet. - Recipient A person or a service with a shielded address. - App A web page or a script. It reads a list of rows and writes the URI. - Row One recipient address, one amount, and one memo. - URI A ZIP 321 payment link. One payment per row. - The app reads the list of rows. - The app checks each row. If one row has an error, the app stops and writes no URI. - The app writes one ZIP 321 URI with one payment for each row. - The app shows the URI as text and as a QR code. - The sender opens the URI in a shielded wallet. - The wallet shows one confirmation screen with all the payments. - The sender signs one transaction. - The wallet pays each recipient the row amount. Each recipient receives the row memo in its note. ### Indexed parameters For many payments, the parameter names have an index (ZIP 321). The first payment can have no index. Each later payment has an index after its parameter name. ``` zcash:?address=&amount=&memo= &address.2=&amount.2=&memo.2= &address.3=&amount.3=&memo.3= ``` The index is in the range 1 to 9999. One payment can have no index. All parameters of one payment have the same index. The parameters can be in any order in the URI. ### Partial payment Some wallets read the first payment only. The wallet shows a send screen with one recipient. The sender does not see the other payments. Thus, the sender signs a partial payment. The wallet shows no error. Some wallets show the first payment only, but send all payments. The sender pays more than the confirmation screen shows. This is a hidden payment. Some wallets, in newer versions, refuse a multi-payment URI and show an error. An app cannot know the wallet of the sender from the URI. As a check, the app shows the number of payments and the total. The sender compares the two values with the confirmation screen of the wallet. See Wallet support. ## Cost - **Each recipient.** One shielded output. After NU6.3, a wallet puts the output to an Orchard receiver in the Ironwood bundle (ZIP 326). Each such output is in one action. A Sapling recipient receives a Sapling output. - **Number of actions.** An Ironwood bundle has at least as many actions as the larger of its spends and its outputs. In an Orchard bundle, one action can contain a spend and an output only at the same expanded receiver (ZIP 2006). Under ZIP 326, a wallet SHOULD NOT put a real spend and an output with value in one action. Thus, in the Orchard bundle of a wallet, the number of actions is at least the spends plus the outputs. A sender with many small notes needs more actions than recipients. The fee is larger for each extra action. See ZIP 317. - **Fee.** From block 3,590,000, under ZIP 2009, the fee is 1,000 zatoshis per logical action. A wallet with the older rule of ZIP 317 pays 5,000 zatoshis for each action. A payout to 20 recipients from an Ironwood note has 21 actions, with one change output. The fee is 21,000 zatoshis under ZIP 2009, or 105,000 zatoshis under the older rule. With zcash_client_backend 0.25.0, the same payout from an Orchard note had 22 actions. Two actions were in an Orchard bundle, for the spend and the change. The fee was 22,000 zatoshis, or 110,000 zatoshis under the older rule. - **Compare.** The fee for 20 separate payments from Ironwood notes is 40,000 zatoshis under ZIP 2009, or 200,000 zatoshis under the older rule. Each payment has two actions. With the same library, 20 separate payments from Orchard notes had 80 actions. The total was 80,000 zatoshis under ZIP 2009, or 400,000 zatoshis under the older rule. - **Block limit.** Under NU7 (ZIP 218), one block has at most 330 Orchard and Ironwood actions, across all of its transactions. Thus, one payout transaction has at most 330 actions. With zcash_client_backend 0.25.0 and one note, a payout had at most 329 recipients, or 328 from an Orchard note. The block of a large payout has less space for other shielded transactions. - **URI limit.** A ZIP 321 index is in the range 1 to 9999. One payment can have no index. Thus, a URI can hold up to 10,000 payments by syntax alone. The block limit is smaller than this. - **Polite actions.** See Polite actions for a note on action counts. - **Wallet support.** The wallet must accept multi-payment ZIP 321 URIs. The wallet must send memo bytes unchanged. ## Wallet support The table shows the support of each wallet for multi-payment ZIP 321 URIs. The test results are from November 2026. The tester used one URI with two or three payments to unified addresses. Each payment had a different amount and a different memo. A row with "Not tested" in the Network column comes from the source code and the changelog of the wallet. Yonkoo11 found the Zodl change in issue 96. Warning With a partial payment, the wallet pays one recipient of a batch. The sender sees one confirmation, and the batch looks complete. The other recipients receive nothing. With a hidden payment, the wallet pays all recipients, but the sender sees one payment only. | Wallet | Version | Network | Result | | Zkool | 6.35.0 | Testnet | Accepts. Shows each payment with its own address, amount and memo. | | Zingo PC | 2.0.29 (206) | Testnet | Accepts. Shows each payment with its own address, amount and memo, and the total. | | Zingo mobile | 2.1.1 (323) | Testnet | Partial payment. Reads payment 1 only. Ignores the other payments. The test transaction is `3db48157…27bb`. | | Vizor | 0.0.65 | Mainnet | Partial payment. Reads payment 1 only. Ignores the other payments. | | Vizor | 0.0.67 | Not tested | Refuses a multi-payment URI. See the Vizor commit. | | Zodl Android | 3.19.0 to 3.21.2 | Not tested | Hidden payment. The wallet shows payment 1 only for review. The wallet signs and sends all payments. See the Zodl changelog for 3.22.0 (MOB-1341). | | Zodl Android | 3.22.0 | Not tested | Refuses a multi-payment URI. Shows "Multi-recipient payment requests are not supported." See the Zodl commit. | The Zcash Open Development Lab changed the name of the Zashi wallet to Zodl in February 2026. See the announcement on the Zcash community forum. To add a wallet to this list, test the multi-payment URI on the chosen network. Open a pull request with the wallet name, version, network and result. ## Limits - **Partial payment.** Some wallets ignore the extra payments and show no error. The app shows the number of payments and the total. The sender compares the two values with the confirmation screen of the wallet. See Wallet support. - **Hidden payment.** Some wallets show the first payment only, but send all payments. The sender pays more than the confirmation screen shows. The same check finds the difference: the app shows the number of payments and the total. - **Memo integrity.** Some wallets change binary or control characters in memos. Use single-line printable ASCII for each memo. - **Address format.** Transparent amounts are visible when recipients use both transparent and shielded addresses. Use shielded addresses for each recipient. - **URI length.** A long URI is too large for a scannable QR code. A file transfer or a short link is necessary for a payout with many recipients. - **Error on one row.** The wallet rejects the whole transaction when a row is malformed. The app must check each row before it writes the URI. - **Privacy.** Each recipient sees the transaction, its number of actions and its fee. Thus, a recipient can estimate the size of the batch. The block time of the transaction is public. ## Spec This pattern uses the existing protocol. ZIP 321 payment links and ZIP 302 memos are all that is necessary. The URI has these parameters for each payment: ``` address[.N] the recipient address, unified or shielded amount[.N] the payment amount in ZEC, decimal memo[.N] the memo as base64url, no padding label[.N] an optional short name of the recipient message[.N] an optional message about this payment ``` The index N is in the range 1 to 9999. The first payment can have no index. The same index applies to each parameter of one payment. A transparent address has no memo. A URI with a memo for a transparent address is invalid. A valid URI has one payment or more. A URI with one payment is a Payment link. ## Demo: a small batch The demo writes one ZIP 321 URI from three rows. Each row has an address, an amount and a memo. Add or remove rows. The demo updates the URI and the QR code after each change. Caution The sample addresses are Testnet. Do not send Mainnet funds to these addresses. ## Toy example A lab runs a quarterly grant round. The round has three winners. Each wins a different amount. Grant round values ``` Winner Amount Memo Alice 0.5 ZEC grant/2026Q4/winner-1 Bob 0.3 ZEC grant/2026Q4/winner-2 Carol 0.2 ZEC grant/2026Q4/winner-3 ``` The lab writes one ZIP 321 URI with three payments. The treasurer opens the URI in a wallet that accepts multi-payment URIs. The treasurer signs one transaction. The three winners each receive one note with the grant round memo. --- Page: https://appliedzcash.com/wishlist/ # Wishlist Designs that need new software: a wallet function, a ZIP or a consensus change. Each wishlist page has the problem, the mechanism and the necessary changes. A wishlist page has no demo. ## Wallet functions Designs that need a new function in wallets only. - Signature login Sign a login message with a wallet key. The login is off the chain. Most wallets need a new function. ## Protocol changes Designs that need a new ZIP, a server protocol or a consensus change. - Static address with OMR A server finds the payments for a wallet and does not learn which they are. A tip jar can use one address. - Presigned transactions Sign a transaction now. A wallet on a different device sends it later, also after a network upgrade. The design is a draft ZIP. --- Page: https://appliedzcash.com/wishlist/signature-login/ # Signature login A wallet signs a login message with a wallet key. The app examines the signature. The login is off the chain: it has zero transactions and zero fees. Most wallets do not have this function today. This page has three designs. The viewing key signature is from Julian (craftsoldier). The app key signature is from c-node. The identity key signature is from hitch (hitchho), in the zafu wallet. zafu has a form of it today. ## Necessary changes - Improves Log in with Zcash - Wallets A new function: sign a login message with a wallet key. zafu has a form of the identity key signature today. - ZIP A new ZIP for the login message and the keys. See Parts of a spec. - Consensus No change. - Status Proposal. A spec is not written yet. ## Problem An app uses Log in with Zcash with the wallets of today. Each login is two payments. Thus, each login has two transactions, two fees and a delay. The service also needs a worker with a code key. With a signature, these costs are zero. On Ethereum, apps use ERC-4361 for this function. On Zcash, wallets sign messages with transparent keys at most. ZIP 304 is for Sapling keys only. ## Mechanism ### Viewing key signature Each shielded receiver of an address is already a public key. Its secret key is the incoming viewing key `ivk`. ``` pk_d = [ivk]g_d g_d the base point of the receiver, from its diversifier pk_d the public key in the receiver ``` The wallet makes a Schnorr signature with `ivk` as the secret key and `g_d` as the base point. The app has `g_d` and `pk_d` from the address, and it examines the signature with them. Thus, the address is the account of the user, as in Log in with Zcash. The wallet calculates `g_d` from its own diversifier only. An app that chooses the base point `B` can find `[ivk]B` from the signature. If `B` is the `epk` of an Orchard note to the user, `[ivk]B` is its shared secret. For a Sapling note, the shared secret is `[8ivk]B`. Thus, the app can read that note if the wallet uses its `epk` as the base point. The signature contains a point `R` and a number. The challenge is a hash of a domain tag, the diversifier `d`, `pk_d`, `R` and the login message. Thus, the signature is valid for one receiver and one login message only. ### App key signature A shielded wallet has a spend authorizing key `ask` and its public key `ak`. In RedDSA, a wallet can randomize this key pair with a secret number α. Each shielded spend already has a signature from a randomized key. ``` α = PRF(wallet secret, domain) rk = ak + [α]G rsk = ask + α domain the domain of the app, for example app.example G the base point of the spend signatures rk the public key of the user at this app rsk the secret key of the user at this app ``` The wallet calculates α with a keyed hash, from a secret of the wallet and the domain of the app. Thus, the wallet has a different key pair for each app. The wallet calculates the secret from the seed, with ZIP 32 registered key derivation. If the secret is from the full viewing key, each holder of that key can calculate α. Thus, each holder of the full viewing key can link the app keys of the user. A wallet that the user restores from the seed calculates the same keys again. An account that participants make with a FROST distributed key generation has no seed. For that account, developers must give the source of the secret in the spec. ### Identity key signature The wallet calculates a set of identity keys from the seed phrase. These keys are for logins and messages only. In site mode, the wallet uses a different Ed25519 key pair for each app. Site mode is the default. The zafu wallet has this design, with the name zid. ``` m = SHA-256(seed phrase) root = HKDF-SHA256(m, salt "zafu-zid-v2", info "identity-root", 64 bytes) id = HMAC-SHA512(root, "identity:default") id_sk = the first 32 bytes of HMAC-SHA512(id, "site:" + origin) id_pk = the Ed25519 public key of id_sk origin the origin of the app, for example https://app.example id_sk the secret key of the user at this app id_pk the public key of the user at this app ``` The input of SHA-256 is the seed phrase as UTF-8 bytes. The phrase is lowercase English words with one space between them. zafu does not use the NFKD normalization of BIP 39. The wallet calculates the Zcash keys from the BIP 39 seed, a PBKDF2 hash of the seed phrase. The identity keys are from a different hash of the seed phrase. Thus, the identity keys and the Zcash keys have no shared intermediate values. A holder of `root` cannot calculate the Zcash keys. The user can set cross-site mode for a site. The wallet uses one key pair for all sites in cross-site mode. Its tag is `"cross-site"` in place of `"site:" + origin`. zafu calculates the key from the origin of the page. In version 1 of the zafu protocol, zafu signs the challenge from the app as raw bytes. zafu does not add the origin to these bytes. The app can put its domain in these bytes. zafu does not read that domain. Thus, zafu does not compare a domain with the host of the page (step 2 of the sequence). zafu shows the origin to the user at the first login to a site. After that login, zafu signs for that site with no prompt for 30 days, while zafu is unlocked. The user can stop this for each site. For a site in cross-site mode, zafu asks the user each time. If the app puts a nonce and an expiry time in the challenge, the app can refuse an old signature (a replay). A relay is a different attack. In a relay, an attacker gets a real challenge from the app. The attacker sends it to the wallet from a page at a different origin. The wallet signs the challenge with the key of that origin. - In site mode, each origin has a different key. Thus, the attacker cannot log in to the account of the user. - In cross-site mode, all origins in this mode have the same key. If the user sets this mode for the real app and for the page of the attacker, the attacker can log in as the user. With steps 1 to 3 of the sequence, the wallet stops a relay: the domain is in the signed message, and the wallet compares it with the page. The zafu sign-in document has this function in the next version: zafu writes the login message itself, with the domain from the origin of the page. The calculation above is for generation 0 and for the first key of each site. The user can change to a new generation N. Then the name in `id` is `default-vN`. The user can also change to a new key N for one site. Then the tag is `"site:" + origin + ":" + N`. An origin with a port, for example `http://localhost:3000`, has the tag `"site\0" + origin + "\0" + N`, where `\0` is a zero byte. N is in this tag for the first key too (N = 0). zafu keeps a counter for the generation and a counter for each site. These counters are in the storage of the browser extension, separate from the seed phrase. Thus, after a restore from the seed phrase, the user must also give the counter values to the wallet. The salt and the tags are specific to zafu. A different wallet must use the same calculation and the same counter values to calculate the same keys. An account from a FROST distributed key generation has no seed phrase. Thus, that account has no identity keys. Each participant can log in with the identity keys from the seed phrase of that participant. ### Sequence - The app makes a login message, as in ERC-4361. The message has the domain of the app, a nonce and an expiry time. The app makes a new nonce for each login. - The wallet shows the domain to the user. A wallet in the browser also compares the domain with the host of the page. - The wallet signs the message. The secret key is `ivk`, `rsk` for the domain, or `id_sk` for the origin. - The wallet sends the signature to the app. It also sends the address, the key `rk`, or the key `id_pk`. - The app examines the signature. It also examines the domain, the nonce and the expiry time. The app accepts each nonce one time only. - If all of them are correct, the user is logged in. The account of the user is the address, the key `rk`, or the key `id_pk`. A wallet on a different device cannot see the page. There, the user must compare the domain in the wallet with the host of the page. ## Comparison | Design | Transactions | Account | Necessary key | Wallet support | | Code in a memo | 2 | The address | Incoming viewing key | Wallets with ZIP 321 and memos | | Viewing key signature | 0 | The address | Incoming viewing key | A new wallet function | | App key signature | 0 | One key for each app | Spend authorizing key | A new wallet function | | Identity key signature | 0 | One key for each app. In cross-site mode, one key for all apps in this mode | Identity secret key `id_sk` | zafu. A new function for other wallets | ## What apps can find from each signature The app uses a correct viewing key signature as proof that the wallet has the address's `ivk`. With the memo code, the app checks that the user knows the code only. Each holder of the incoming viewing key can log in as the address. A user who gives the viewing key to a different person also gives the login. The app uses a correct app key signature as proof that the user has the secret key `rsk`. Only a holder of `ask` can calculate `rsk`. Thus, a viewing key is insufficient for a login. The app uses a correct identity key signature as proof that the user has the secret key `id_sk`. A holder of the seed phrase, of `root` or of `id` can calculate `id_sk`. Thus, a holder of a viewing key must also have `id_sk` for this login. The app key and the spend key have shared values: `rsk = ask + α`. The app gets `rk` and the signature only. The wallet keeps `rsk` and α with `ask`. If an attacker gets `rsk` and α from the wallet, the attacker can calculate `ask = rsk − α`. The identity keys and the spend keys have only the seed phrase in common. If `id_sk` is disclosed, `ask` stays secret. A FROST group can hold an account, with a threshold of `t` participants. For that account, `t` participants make each app key signature together, in a rerandomized FROST round with α. Each participant who has the incoming viewing key can make a viewing key signature alone. Thus, for that account, the threshold is in effect for the app key signature only. With the app key signature, the app gets `rk` only. Because α is secret, two apps cannot calculate that their keys are from the same `ak`. Thus, apps cannot link the app keys of one user. There, the address of the user stays secret. To show that `rk` and an address are from the same key, the wallet must also make a zero-knowledge proof. ZIP 304 has this proof for Sapling keys only. With the identity key signature in site mode, each app gets a different `id_pk` from a keyed hash. Thus, apps cannot link the identity keys of one user. In cross-site mode, all apps in this mode get one `id_pk`. Thus, these apps can link the logins of the user. The identity keys have no link to an address. For a login as an address, the app uses the viewing key signature or the memo code. ## Parts of a spec - **Message format.** The fields of the login message and their sequence, as in ERC-4361. - **Receiver.** For the viewing key signature. A unified address can have more than one shielded receiver. A Sapling receiver and an Orchard receiver have different `ivk` values. For each receiver type, all receivers that the wallet gives to senders for one account have one `ivk`. The change receivers of the account have a different `ivk`. Developers must give the receiver type in the spec. - **Calculation of α and of the identity keys.** For the app key signature and the identity key signature. One calculation for all wallets. Thus, a user who moves to a different wallet keeps the same accounts. For the identity keys, the zid calculation of zafu is a candidate. - **Hash personalization.** For the app key signature. Wallets already use these keys in transactions. RedPallas has one fixed hash personalization for all signatures. Thus, the wallet signs a hash of the login message, as in ZIP 304. This hash has a personalization for logins only. The wallet calculates this hash itself. The wallet never signs 32 bytes from the app. Thus, a login signature is invalid for a transaction. - **Transport.** A path from the app to the wallet and back. For example, a QR code for the message and an HTTPS request for the signature. --- Page: https://appliedzcash.com/wishlist/omr/ # Static address with OMR A tip jar has one address for all senders. With oblivious message retrieval (OMR), a server finds the payments for the wallet. The server does not learn which payments they are. A static address already works on Zcash today. With OMR, a wallet finds its payments in a new way. The set of people who can pay the address stays the same. That change, its cost and the open parts of the design are on this page. ## Necessary changes - Improves Each wallet that syncs with a server. Each app that publishes one address, for example a tip jar. - Wallets A clue key in the address. A detection key for the server. A function that reads the digest from the server. - Senders A clue with each payment, about 1 KB for each output in the design of the Zcash Foundation. - Servers A service that scans all clues for each wallet that registers. It does homomorphic encryption work for each clue. - ZIP A new ZIP for the clue, the address and the server protocol. None exists. See Parts of a spec. - Consensus Depends on where the clue is. A new field in each output changes the transaction format. - Status Proposal. Research schemes exist. The Zcash design is an open issue in the Tachyon repository, and its author says it is not proven. ## Problem On Zcash today, a wallet finds its payments by trial decryption: it tries its incoming viewing key on each action on the chain. A light wallet gets compact blocks from a server such as lightwalletd for this. After it finds a payment, it asks the server for the full transaction. Then the server knows that this wallet, at this time, requested this transaction (Zcash Foundation, March 2023). A wallet can download all transactions in full to hide this, but the cost is almost the size of the chain. Shielded outputs to one address do not link to each other on the chain. The leak is in the sync with the server. Tachyon issue 368 shows a second problem. In the Tachyon payment protocol, a first payment has a tag `H(ek)`, which the recipient finds with private information retrieval (PIR). Each holder of the key `ek` can calculate the same tag. Thus, the Tachyon book makes a new address for each sender. There is no safe way to publish one address for everyone. After Tachyon, a static address needs a tag that only the recipient can recognize. ## Mechanism OMR is from Liu and Tromer. The scheme is based on lattice-based fully homomorphic encryption. The Zcash Foundation described how it can work for Zcash: - The address has a clue key, in addition to its other keys. - The sender pays as usual. The transaction also has a clue ciphertext for the recipient, about 1 KB for each shielded output. - The recipient makes a detection key and gives it to a server. The server cannot read the key. - The server scans each clue with the detection key, under encryption. The server adds the clues that match into one encrypted digest. - The recipient decrypts the digest and gets the transactions that are for the wallet. The server learns that the wallet uses OMR. It does not learn which transactions are for the wallet. ### The Tachyon proposal Issue 368 has a new first-payment tag: a 32-byte clue field in place of `H(ek)`. The field is different in each payment. Only the recipient can recognize it, with a secret. The clue is made from a value of the ML-KEM ciphertext. Thus, a clue adds only a few numbers to the ciphertext. The sizes in the issue: ``` address 2,368 bytes (pk 32 + ek 1,184 + ck 1,152) entry 1,249 bytes (marker 1 + field 32 + ciphertext 1,088 + note 128) detection key 52,256 bytes (one RLWE key and two packing keys) ``` Its author lists two open questions. The same randomness `r` is in the ML-KEM ciphertext and in the clue. No paper studies this combination. The protection against fake clues ("snake-eye" attacks) is new. The paper that it comes from has a warning: the obvious Ring-LWE version is not secure. According to the issue, nobody outside has reviewed it. ## Costs The papers have different message sizes, parameters and computers. Read the numbers as orders of size. | Source | Server | Wallet and network | | Liu and Tromer, 2021 | About $1 for each million messages scanned | Digest of a few bits for each message scanned. About 20 ms to decode. | | PerfOMR, 2024 | Describes prior schemes as about 0.1 s for each message. One protocol is 13.8 times faster. The other is about 40 ms for each message. | Prior schemes: about 1 KB for each message and 132 KB for the public keys. In the second protocol, the keys are about 235 times smaller and the message about 1.6 times smaller. | | UnifOMR, 2026 | About 25 s for 2¹⁹ messages of 612 bytes. SophOMR needs more than 1,250 s. | 4 MB of communication, against 260 KB for SophOMR. Two rounds between the detector and the client. | UnifOMR has a proof that an OMR scheme with strong detection-key unlinkability is at least as hard as PIR. Thus, OMR is unlikely to be much cheaper than PIR. Each payment carries a clue. The clue has about 1 KB in the Foundation design. An entry has 1,249 bytes in the Tachyon proposal. The wallet pays for the detection key and for the digest. The server pays for the scan. A server must do this for each wallet that registers. ## Comparison | Method | Who finds the payments | What the server learns | Added to each payment | | Trial decryption of all actions | The wallet | Nothing, if the wallet downloads all actions in full | Nothing | | Compact blocks, then fetch | The wallet | Which transactions the wallet fetches, and when | Nothing | | OMR | The server, for the wallet | That the wallet uses OMR | A clue, about 1 KB | | Tachyon tag with PIR | The wallet, with PIR | The query, which PIR hides | A tag. Needs a new address for each sender. | | Tachyon clue (issue 368) | The server, for the wallet | That the wallet uses OMR | A clue field of 32 bytes, in an entry of 1,249 bytes. Static address. | ## Limits The issue has three limits of its design. **Reactions.** A person can send fake payments to a known address and watch how the recipient reacts. After many checks, this can show the clue secret and thus which first payments are the recipient's. The attacker learns no amounts and gets no spend authority. **Dishonest servers.** A server can hide payments. It can also add fakes, which makes the reaction attack cheaper. **Wrong address.** The sender must be sure that the complete address belongs to the recipient. ## Parts of a spec - **Clue format.** The size, the place in the transaction and the version. A new field in an output changes the transaction format. - **Address.** The clue key is in the address. In Tachyon it makes the address 2,368 bytes. The spec must give the encoding, for example as a new receiver in a unified address. - **Server protocol.** How a wallet registers a detection key, asks for a range of blocks and gets the digest. UnifOMR has two rounds. - **Protection against fake clues.** A scheme with protection against snake-eye attacks, with a proof or a review. - **Who runs servers.** The cost of a scan is for each wallet and for each message. A wallet needs a server that it can pay or trust to be available. --- Page: https://appliedzcash.com/wishlist/presigned-transactions/ # Presigned transactions A key holder signs a transaction now. A wallet on a different device completes the transaction and sends it later, also after a network upgrade. The design is in a draft ZIP by Kris Nuttycombe (nuttycom): Sighash Variant for Deferred Broadcast. The draft has no ZIP number yet. Its deployment is not scheduled. Thus, no wallet or node has this function today. On this page, a presigned transaction is a transaction that a key holder signs now. A wallet sends it later. ## Necessary changes - Improves Threshold keys, offline signing and scheduled payments. - Wallets New rules to sign, complete, keep and cancel presigned transactions. Support for the v7 transaction format. - ZIP Sighash variant 1 is in the draft, as an addition to the v7 format of ZIP 248 (Draft). Changes to the draft are in an open pull request, zcash/zips#1484. A change to the lock time of ZIP 248 is in zcash/zips#1497 (merged). - Consensus A network upgrade with the v7 format and variant 1. The v7 format is outside NU7 (ZIP 259). - Status Draft. The deployment is not scheduled. The draft has no reference implementation yet. ## Problem In v5 and v6, the consensus branch ID and the expiry height are signed (ZIP 244, ZIP 229). Both ZIPs are Final. Thus, a key holder must know both values at the time of signing. In ZIP 203, the default expiry height is 40 blocks after the current height. From NU7, the recommendation in ZIP 218 is 120 blocks (ZIP 203, Changes for NU7). If the transaction is sent later, the key holder must sign a later expiry height or no expiry. Both values are different from the values of other wallets. Thus, an observer can find the transactions with these values. The signing time can also be found from a later expiry height. A signature is valid on one consensus branch only. After a network upgrade, the signed transaction is invalid. A key holder can sign one copy for each consensus branch. This is possible only for a network upgrade with a known consensus branch ID. In ZIP 318 (Draft), a wallet should sign the Orchard to Ironwood migration transactions in advance and keep them. It sends each one at its scheduled height. The wallet must sign one copy for each consensus branch in the validity range of a transaction. The expiry height is calculated from 30-day periods. That value is still different from the default. Before v6, the anchors were part of the signed data too. In the v6 format, the anchors are authorizing data (ZIP 229). Thus, a wallet can make the proofs after the signature, with a new anchor. ## Mechanism ### Sighash variant 1 In the v7 format of ZIP 248, each signature has a sighash variant. The signed data of variant 0 is all the effecting data of the transaction. This data contains the consensus branch ID and the expiry height. Variant 1 is in the draft. The signed data of variant 1 is the same data, without these two fields. Variant 1 is for spend authorization signatures and transparent input signatures. Variant 0 is necessary for binding signatures. That is a consensus rule in the draft. The sighash variant of each signature is visible on the chain. Thus, the draft has a recommendation for wallets with this function. They should use variant 1 for each v7 transaction with a shielded bundle. This includes the transactions that they send immediately. ### Complete and send Before a wallet sends a presigned transaction, it completes the transaction in these steps: - The wallet sets the consensus branch ID of the target height. The target height is the height of the next block. - The wallet sets the expiry height as for a transaction that it signs now. This value must be independent of the signing time. - If the proofs do not exist yet, the wallet selects the anchor of each shielded bundle. Then it makes the proofs against that anchor. If the proofs exist, the wallet keeps their anchor. If the wallet selects a new anchor, it must make new proofs. - The wallet makes the binding signature of each shielded bundle. Thus, these fields are independent of the signing time. The exception is the anchor of existing proofs. The wallet needs the binding signing key of each shielded bundle. To make new proofs, the wallet also needs the private inputs of the proofs. The values and the addresses of the notes are in these inputs. The spending key stays with the key holder. ### Who can send the transaction The builder of a shielded bundle knows its binding signing key. Each party that receives the value commitment randomness from the builder also knows it. In the draft, a FROST coordinator sends each participant the openings of the value commitments. Then each participant can check the values. These openings contain the value commitment randomness. Thus, each participant has the binding signing keys. With the private inputs of the proofs, a participant can complete the transaction. In ZIP 312, the coordinator "possibly" sends these openings, and the mechanism is outside its scope. Without them, a participant does not have the binding signing keys, and only the coordinator could complete the transaction. The draft has an open issue on this point: whether participants can check the values without the openings. Only a shielded bundle has a binding signature. If each transparent input of a transparent-only transaction has a variant 1 signature, any party can change the two fields. The transaction identifier is then different too. ### Validity and cancellation A variant 1 signature stays valid until an input of the transaction is spent. The signature also becomes invalid when nodes stop accepting the transaction version or a bundle variant. The signature stays valid after an expiry height and after a network upgrade. Each time a wallet completes the transaction, the transaction identifier is different. All these transactions have the same inputs. Thus, at most one of them can be mined. In the draft on main, a wallet can cancel a presigned transaction. To do this, it spends an input of that transaction in a different transaction. The wallet treats the cancellation as effective only after that different transaction is mined. After a completed transaction expires, the wallet does not treat the presigned transaction as cancelled or failed. In zcash/zips#1484 (open), these rules are removed, and other rules are added. One new rule is for an expired transaction. While another party can complete it again, a wallet must not assume that its effects can no longer be applied. A variant 1 signature has no upper limit on the height at which the transaction is mined. In the draft, a wallet that asks a user to confirm such a signature should say this. It must not show an expiry height as a limit on the approval. In a transaction with transparent inputs, the lock time is in the signed data. Thus, a lower limit is possible. When nodes use the lock time, the transaction has an earliest height or time. See Lock time. A variant 1 signature has no limit on the consensus branch. After the signatures and the proofs are public, each party with the binding signing keys can complete the transaction again. This is possible later, until an input is spent, on each consensus branch where nodes accept the transaction. Thus, in the draft, a wallet should give a binding signing key only to a party that needs it. ### Lock time A lock time is a block height or a time. Nodes accept the transaction only in a block with a height or a time after the lock time. Current nodes use the lock time only if a transparent input has a sequence number other than `0xFFFFFFFF`. This rule is in the zcashd code (`IsFinalTx`) and in the Zebra code: `lock_time` and `lock_time_has_passed`. This rule is not explicit in the protocol specification yet (zcash/zips#539, open). Thus, for a transaction with only shielded inputs, current nodes ignore the lock time. The result is the same in the v7 format of ZIP 248 (Draft). The wallet that keeps such a presigned transaction decides when to send it. In the draft, a key holder that uses variant 1 should sign only transactions with a lock time of zero. The exception is a transaction for which a lock time is necessary. In the v7 format, the lock time is in the transparent bundle. There, the lock time field is present only when the transaction has transparent inputs. ### Use cases - **Offline signing.** A hardware wallet or a wallet on an offline device signs. A wallet on a different device completes the transaction and sends it later. That wallet needs the binding signing keys, and the private inputs for new proofs. See Who can send the transaction. - **Threshold groups.** A FROST group signs with variant 1. The members can finish the signing session later, also after a network upgrade. The approval stays valid until one of the inputs is spent. If a completed transaction expires, each participant can complete it again. Changes to ZIP 312 are necessary before this. See Parts of a spec and Threshold keys. - **Scheduled payments.** A wallet signs a series of payments in one session. Then it sends them over days or weeks, as in the ZIP 318 migration. Current nodes ignore the lock time of a payment with only shielded inputs. Thus, the wallet that keeps the payments decides when to send them. See Lock time. - **Inheritance and dead-man switch.** These jobs are outside the text of the draft. Only the rules above, from the draft and the Zebra code, are used in this item. An owner signs a payment to an heir. The owner gives it to a second party, with the binding signing keys and the private inputs for new proofs. If the owner stops contact with that party, the party sends the payment. Current nodes ignore the lock time of a payment with only shielded inputs. Thus, that party decides when to send the payment. The owner must trust that party. The payment can have a lock time and a transparent input with a sequence number other than `0xFFFFFFFF`. Then current nodes apply an earliest height or time. The payment has fixed inputs. After the owner spends one of them, the payment is invalid. Then the owner signs a new payment. With the binding signing keys, that party can also complete the payment again until one of the inputs is spent. ## Comparison | Signature | Consensus branch ID signed | Expiry height signed | Anchor signed | Valid until | Status | | v5 (ZIP 225) | Yes | Yes | Yes | The expiry height, a network upgrade, or when an input is spent | Deployed | | v6 (ZIP 229) | Yes | Yes | No | The expiry height, a network upgrade, or when an input is spent | Deployed | | v7, variant 0 (ZIP 248) | Yes | Yes | No | The expiry height, a network upgrade, or when an input is spent | Draft | | v7, variant 1 (the draft) | No | No | No | When an input is spent, or the end of its transaction version or bundle variant | Draft | ## Parts of a spec The draft has the first three parts. ZIP 248 has the fourth part. The other parts are open issues in the draft. - **Variant 1 digest.** The signed data of variant 1, as a change to the variant 0 digest of ZIP 248. It is in the draft. - **Consensus rules.** The variant of binding signatures is 0. The consensus branch ID field of a v7 transaction is the consensus branch ID of the epoch of its block. Both rules are in the draft on main. In zcash/zips#1484, the second rule is in § 7.1.2 of the protocol specification instead. - **Wallet rules.** The rules to sign, complete, keep and cancel presigned transactions. They are in the draft. In zcash/zips#1484, their text is changed, and the cancellation rules are removed. - **Lock time.** The field and its effect in a v7 transaction. In ZIP 248, the field is in the transparent bundle. It is present only when the transaction has transparent inputs. - **Transparent-only transactions.** An open issue in the draft. One option is a rule that each v7 transaction has at least one variant 0 signature. - **PCZT fields.** An open issue in the draft. ZIP 374 (Draft) must contain a field for the sighash variant of each signature. A role for the two fields is also necessary in ZIP 374. - **Threshold signing.** An open issue in the draft. ZIP 312 (Draft) must contain the signed message for each variant. A statement that an approval stays valid until a wallet spends an input must also be in its threat model. - **Variant number and test vectors.** Open issues in the draft. The number 1 is provisional until the ZIP Editors confirm it. --- Page: https://appliedzcash.com/wishlist/spending-conditions/ # Shielded spending conditions A spending condition is a rule for how a note is spent. An example: the note pays only to addresses on a list, up to a cap. Transparent Zcash has a draft for such rules. Shielded Zcash has no draft. ZIP 222 (Transparent Zcash Extensions) is a draft for transparent outputs only. This page describes what a shielded version needs and which parts are open. One design has a public forum post and no ZIP. Treat its numbers as claims. ## Necessary changes - Improves Threshold keys. There, people enforce the rules. A condition in the proof makes the rules independent of the signers. - Wallets Wallets commit to a condition when the note is made. They prove the condition at each spend. They test each way out of the note before the wallet funds it. - ZIP A new ZIP is necessary for the condition, its commitment and the proof. See Parts of a spec. - Consensus Change. The Action statement has a fixed list of facts. The author of the forum proposal says that it needs a network upgrade. - Status Proposal. A ZIP and an audit are open. ## Problem Apps need rules for funds: a list of payees, a cap for each spend, a recovery path, a time limit. Transparent Zcash can express some rules in Bitcoin script. ZIP 222 states that limits on shielded spending are even more restricted. An Orchard Action proves a fixed list of facts. The list is in the protocol specification. The old note commitment is correct and in the tree. The nullifier and the value commitment are correct. The spender has spend authority. The address and the new note commitment are correct. The enable flags are set. The owner of a note cannot add a rule to this list. One restriction of this type exists. The flag `enableCrossAddress` is in the Action statement (ZIP 2006, Final). In the Orchard pool, the flag must be 0. Thus, an Action must send its output to the same receiver as the note that it spends. Consensus sets this flag for all notes in the pool. The owner of a note cannot choose it. Today, an app can use threshold keys: any `t` of `n` members can sign a spend. The condition is then a policy of the signers. If `t` members agree, they can send the note to any address. A timelock is also unavailable: the threshold keys page states that `nLockTime` is in effect only for transactions with transparent inputs. ## Mechanism ### Transparent: ZIP 222 An output has a `precondition`. A spending input has a `witness`. An extension has a function `tze_verify`. The function takes the mode, the precondition, the witness and a context object. It returns true if the precondition is met. Each node runs it. Thus, the precondition and the witness are public. For this reason, ZIP 222 does not fit shielded notes. ZIP 222 has the status Draft. The fields `tze_in` and `tze_out` are in a new transaction format. No extension is deployed. ### Shielded: the same split, in zero knowledge A shielded version keeps the split of ZIP 222. The owner commits to a condition when the note is made. At each spend, the wallet runs the condition on private data and makes a proof that the condition is met. A node examines the proof. The condition, the witness and the result stay hidden from the node. Zexe (2018) is the research design for this. Users run offline computations and make transactions that hide all information about the computation. Anyone can validate a transaction in constant time. In the paper, a transaction has 968 bytes, whatever the computation. Delta Execution Arguments (DEA) are a different design, from one author on the Zcash forum (November 2026). In the idea, a program is bound to an address and runs once for each Action, inside the proof. The author claims: - about 1.1 KB of added proof size; - less than 20% extra proving time; - a limit of about 200 rows for a program. The forum post has a second example: a note that pays to one of two committed addresses, with a fee cap. The author says that this example needs 25 to 30 rows. The thread has no proof and no review of the construction. The author says that DEA needs a ZIP, formal proofs and a network upgrade. ### Design points that decide if it is safe These points come from replies in the DEA forum thread. They apply to all designs. - **Commit at creation.** A condition chosen at spend time has no protective effect. In a 2-of-3 escrow, two members meet the threshold and can prove under a different program. This attack cannot be prevented by a signature. In ZIP 244, the Orchard proofs are in the authorizing data digest. The digest that the signature covers has no proof. Thus, the condition must be bound to the note or to the address. - **One format for all Actions.** If only some Actions have a program package, an observer can see which notes have a condition. The notes with a condition then form a smaller anonymity set. A package in each Action fixes this. The package is empty for normal spends. Each Action then has the cost of the package. - **Test each exit before funding.** A mistake in a condition leaves the funds locked for good. The wallet proves a test spend on each exit path. The wallet also checks that a spend to an address outside the exits fails. - **Time.** A rule such as "refund only after height H" needs the height or `nLockTime` as an input of the circuit. ### Which language We found no source that tests which language is easiest to verify formally. A language that is easy to verify has three properties: - Loops have a fixed bound. The circuit has a fixed size, so each loop is unrolled. For this reason, the DEA author expects short loops. - The cost of a program is known before it runs. - The language has formal semantics, so a tool can check that the circuit matches the language. Simplicity for Bitcoin is an example of a language with these properties. It is a typed, functional language with a fixed set of combinators. Loops and recursion are absent. Its semantics are formal, in Coq. The language is not Turing complete. Thus, a tool can find an upper bound for the time and the space of a program before the program runs. The forum poll lists Python, Solidity and BitcoinScript. The DEA author says that programs are in a compiled intermediate form. Thus, many front languages can exist, as for the EVM. The formal work belongs to the small intermediate form and to the circuit that checks it. The front language comes after. ## Comparison | Design | Condition is | Enforced by | Shielded notes | Status | | Transparent extension (ZIP 222) | Public | Each node | No | Draft | | Threshold keys | Policy of the signers | `t` of `n` members | Yes | Experimental pattern. ZIP 312 is a draft. | | Public flag (ZIP 2006) | Public flag, same for all notes | The proof and consensus | Yes, with one value for all owners | Final | | Program in the proof (Zexe) | Hidden | The proof | Yes, in a new system | Research paper | | Program in the Action proof (DEA) | Hidden, as the author claims | The proof | Yes, after a network upgrade (author claim) | Forum proposal. A ZIP is open. | ## Parts of a spec - **Commitment.** Where the condition is bound: in the note, in the address, or in a new field. A third party who pays into a conditional note must know which one. Wallets that restore from a seed must find the note again. - **Instruction set.** A small intermediate form with formal semantics and a known cost for each instruction. - **Circuit and size.** The change to the Action statement, the added proof size, and the cost of a package in each Action for one format. - **Inputs.** The public values that a condition can read: the new address, the amount, the fee, and the height or time. - **Wallet checks.** Before funding, each exit decodes to a valid address. No exit belongs to the spender. Each exit is unique. A test proof exists for each exit, and a spend to an address outside the exits fails. - **Upgrade rules.** A condition commitment must stay valid after a network upgrade. Otherwise, old conditional notes can be lost.