Zcash ZIPs
Theme
Appearance
Contents

Unnumbered proposal

Wallet-to-Wallet Messaging

Draft

Terminology

The key words “MUST”, “MUST NOT”, “SHOULD”, “SHOULD NOT”, and “MAY” in this document are to be interpreted as described in BCP 14 1 when, and only when, they appear in all capitals.

The terms “Unified Address” and “Receiver” are to be interpreted as defined in ZIP 316. 2

Envelope

:An encrypted message, padded to one of three sizes.

Mailbox

:A queue of Envelopes held by a Mailbox Server under a Mailbox ID.

Conversation

:The state two wallets share after a first Envelope: a secret from which they derive Envelope keys and Mailbox IDs.

Contact Mailbox, Pairwise Mailbox

:The Mailbox derived from an Orchard Receiver, and one derived from a Conversation, a direction, and a week-long epoch.

Routing Binding

:A specification of how wallets reach Mailbox Servers, and optionally each other, over one anonymity network.

Abstract

This ZIP specifies an off-chain channel between Zcash wallets. A wallet that holds another wallet’s Unified Address deposits an encrypted Envelope in a Mailbox, reaching the Mailbox Server over an anonymity network, and the recipient fetches it later. Neither wallet reveals its network identity to the other or to the server.

Nothing is added to the Unified Address. The Mailbox ID and Mailbox Server are derived from the address’s Orchard Receiver, the Envelope is encrypted to that Receiver using the Orchard key agreement, and fetching requires the incoming viewing key. Every first Envelope also starts a Conversation, whose mailboxes rotate each epoch, so that an ongoing exchange does not accumulate metadata under one identifier. Routing is separate from storage: mailboxes are reached over any supported anonymity network, and prompt replies can also go directly between the wallets. Payload types are defined for acknowledgements, text, ZIP 321 payment requests, and PCZTs.

Anyone who holds the recipient’s Orchard incoming viewing key can read and fetch its Envelopes, and a Mailbox Server sees the volume and timing of what each Mailbox ID receives. Appendix A sketches Routing Bindings for the Nym mixnet 3 and for Tor. 4

Motivation

Several wallet protocols need a direct channel between wallets, and each wallet that wants one currently builds its own:

On-chain memos are the only standard channel today. Even without their size cap (ZIP 231 10) they cost fees, are stored forever, and need a block confirmation per round. ZIP 324 11 covers the case where the sender has no address for the recipient; this ZIP covers the case where it does.

Out-of-band delivery over a mixnet, with a mailbox for offline recipients, has been proposed before. 12 13 The Nym × Zcash integration 14 routes chain-sync and transaction submission through the mixnet, not wallet-to-wallet messages.

Privacy Implications

Incoming viewing key holders. Whoever holds an account’s Orchard incoming viewing key can read and fetch every Envelope sent to its addresses that a server still holds, and, where the recipient has opted into deletion on fetch, by fetching can cause the server to delete them. It can also derive the secret of every Conversation started with those addresses, and so read, fetch, and send Envelopes in them, in both directions. There is no forward secrecy. Envelopes can reveal more than notes do: a PCZT shows a transaction before it is signed. The viewing keys of the wallet that starts a Conversation give no access to it.

All diversified addresses of an account share one incoming viewing key, so using a different address does not help. Viewing keys of different accounts are unrelated: a user who shares an account’s viewing key, for example with an auditor or a watch-only service, keeps messages from its holder only by receiving them at addresses of another account.

Mailbox Servers. A server never learns a network identity. It sees each Mailbox ID it holds and the number, size, and timing of the Envelopes deposited in and fetched from it. A Contact Mailbox lives as long as its address, and anyone who knows the address can compute its ID and server, so that server holds a long-lived traffic record for the address. Pairwise Mailbox IDs change every epoch and can be computed only by the two wallets and the responder’s viewing key holders.

Linking addresses. Diversified addresses of one wallet have unrelated Contact Mailboxes. A server can still link them if the wallet fetches them together, which is why fetches use separate sessions and schedules.

No opt-in signal. Every address with an Orchard Receiver has a Contact Mailbox whether or not its wallet implements this ZIP, so a sender cannot tell whether its Envelope will be read.

The other wallet. Envelopes do not authenticate their sender. An answer shows the sender that the recipient was online. Both wallets can fetch from the Pairwise Mailboxes of both directions, so each can see when the other’s fetches cause its Envelopes to be deleted, and a wallet in Conversations with two addresses can compare them.

Network observers. Privacy is bounded by the anonymity set of the Routing Binding. A wallet’s entry point to the network sees its IP address but no Mailbox ID, server, or Zcash address.

Denial of service. Anyone can deposit under any Mailbox ID, at the expense of the server’s storage and the recipient’s bandwidth.

Requirements

Non-requirements

Specification

Notation

\(\mathsf{BLAKE2b\text{-}256}\) and \(\mathsf{BLAKE2b\text{-}512}\) 15, \(\mathsf{DiversifyHash^{Orchard}}\) 16, \(\mathsf{ToScalar^{Orchard}}\) 17, \(\mathsf{Sym}\) 18, \(\mathsf{GroupHash}^{\mathbb{P}}\) 19, \(\mathsf{repr}_{\mathbb{P}}\) and \(\mathcal{O}_{\mathbb{P}}\) 20, and \(\mathsf{I2LEOSP}\) and \(\mathsf{LEBS2OSP}\) 21 are as defined in the Zcash Protocol Specification.

Integers are encoded little-endian. Times are in hours since the Unix epoch, rounded down.

Throughout, \((\mathsf{d}, \mathsf{pk_d})\) is an Orchard Receiver with raw encoding \(\mathsf{rcv}\kern-0.05em\textsf{,}\) 22 incoming viewing key \(\mathsf{ivk}\kern-0.05em\textsf{,}\) and \(\mathsf{g_d} = \mathsf{DiversifyHash^{Orchard}}(\mathsf{d})\kern-0.05em\textsf{.}\)

Envelopes

Field Type Description
version byte \(1\)
ephemeralKey byte[32] \(\mathsf{PointBytes}(\mathsf{epk})\)
ciphertext byte[N + 16] \(N\) is 2048, 32768, or 262144

The plaintext is:

Field Type Description
seed byte[32] Uniformly random
payload_type u16 See Payloads
flags byte Bit 0: ack_requested
expiry_time u32 Time from which the Envelope is dropped
fast_len byte Length of fast_reply
fast_reply byte[fast_len] See Fast mode; may be empty
payload_len u32 Length of payload
payload byte[payload_len]
padding byte[] Zero bytes up to the smallest \(N\) that fits

Every Envelope belongs to a Conversation with secret \(\kappa\kern-0.05em\textsf{,}\) and is sent by its initiator (\(\delta = 0\kern-0.03em\textsf{)}\) or its responder (\(\delta = 1\kern-0.03em\textsf{).}\) \(\mathsf{g_d}\kern-0.05em\textsf{,}\) \(\mathsf{pk_d}\kern-0.05em\textsf{,}\) and \(\mathsf{ivk}\) below are those of the responder’s Receiver. With

\(\hspace{2em}\mathsf{esk} = \mathsf{Scalar}(\texttt{"Zcash\_WMsgEsk\_\_\_"}, \mathtt{seed}), \quad \mathsf{epk} = [\mathsf{esk}]\,\mathsf{g_d}\)

\(\hspace{2em}\mathsf{K} = \mathsf{BLAKE2b\text{-}256}(\texttt{"Zcash\_WMsgPairK\_"}, \kappa \,||\, [\delta] \,||\, \mathtt{ephemeralKey})\)

the ciphertext is \(\mathsf{Sym.Encrypt_K}\) of the plaintext.

A first Envelope starts a Conversation. Its sender is the initiator, and

\(\hspace{2em}\kappa = \mathsf{BLAKE2b\text{-}256}(\texttt{"Zcash\_WMsgPairS\_"}, \mathsf{PointBytes}([\mathsf{esk}]\,\mathsf{pk_d}) \,||\, \mathtt{ephemeralKey})\)

which the responder computes from \([\mathsf{esk}]\,\mathsf{pk_d} = [\mathsf{ivk}]\,\mathsf{epk}\kern-0.05em\textsf{,}\) as in Orchard note decryption.

The recipient processes an Envelope only as a first Envelope to the Receiver whose Contact Mailbox it was fetched from, or in the Conversation and direction of the Pairwise Mailbox it was fetched from or of the fast_reply address it arrived at. It MUST drop the Envelope, with no behaviour that depends on which check failed, if:

It ignores the payload of an unknown payload_type and unknown bits of flags, which senders set to zero.

Payloads

payload_type Name payload
\(1\) Ack ephemeralKey of the acknowledged Envelope
\(2\) Text UTF-8 text for display to the user
\(3\) Payment request UTF-8 ZIP 321 URI 7
\(4\) PCZT Serialized PCZT 5; format reference TBD

An Ack MUST NOT set ack_requested. Payloads MUST NOT carry spend authority, such as spending keys or ZIP 324 URIs. 11

Mailboxes

A Mailbox ID is \(\mathsf{PointBytes}(G) \,||\, \mathsf{PointBytes}(P)\kern-0.05em\textsf{,}\) where

\(P = [a]\,G\) for a scalar \(a\) that authorizes fetching. A derivation below that yields \(\mathcal{O}_{\mathbb{P}}\) for \(G\) or \(P\) defines no mailbox.

The Contact Mailbox of a Receiver has

\(\hspace{2em}r = \mathsf{Scalar}(\texttt{"Zcash\_WMsgMbxOrc"}, \mathsf{rcv}), \quad G = [r]\,\mathsf{g_d}, \quad P = [r]\,\mathsf{pk_d}\)

so \(a = \mathsf{ivk}\kern-0.05em\textsf{.}\)

The Pairwise Mailbox of a Conversation for direction \(\delta\) and epoch \(e\) has, with \(m = \kappa \,||\, [\delta] \,||\, \mathsf{I2LEOSP}_{32}(e)\kern-0.05em\textsf{,}\)

\(\hspace{2em}G = \mathsf{GroupHash}^{\mathbb{P}}(\texttt{"z.cash:WalletMsg-pair"}, m), \quad a = \mathsf{Scalar}(\texttt{"Zcash\_WMsgPairX\_"}, m), \quad P = [a]\,G\)

The epoch at time \(t\) is \(\mathsf{floor}(t / 168)\kern-0.05em\textsf{.}\)

A Server List entry is a 32-byte server_id and, for each network the server is on, an address in the format of that network’s Routing Binding. The Mailbox Server of a Mailbox ID \(\mathsf{id}\) is the entry with the smallest \(\mathsf{BLAKE2b\text{-}256}(\texttt{"Zcash\_WMsgSrvSel"}, \mathtt{server\_id} \,||\, \mathsf{id})\kern-0.05em\textsf{,}\) compared as a byte string.

TODO: specify the Server List; see Open issues.

Conversations

A first Envelope is deposited in the Contact Mailbox of the Receiver it is encrypted to. In the Conversation it starts:

Each Conversation costs the responder a fetch schedule, so a wallet SHOULD NOT answer a first Envelope, even with an Ack, without the user’s approval. Either wallet MAY forget a Conversation at any time; the other is not told.

Mailbox Servers

Request Fields Response
Deposit \([1]\kern-0.05em\textsf{,}\) mailbox_id, an Envelope None
Fetch \([2]\kern-0.05em\textsf{,}\) mailbox_id, after (u64), time (u32), sig (byte[64]) (seq (u64), len (u32), Envelope) triples

The server gives each deposited Envelope a nonzero seq greater than any it has ever given under that Mailbox ID. Fetch returns, in order, the Envelopes with seq greater than after, up to a size of the server’s choosing.

The server MAY discard Envelopes after a retention period of its choosing, and MUST NOT delete them before it ends, except where the recipient has opted into deletion on fetch. In that case a Fetch allows the server to delete the Envelopes with seq up to after that it has held for at least a minimum age of its choosing, which SHOULD be at least 24 hours. How a recipient opts in is TBD; see Open issues.

The server MUST NOT keep per-wallet fetch state: a Fetch MUST NOT change the result of a later Fetch, other than by such deletion.

sig is a RedPallas signature 23 with generator \(G\) in place of the fixed one, signing key \(a\kern-0.05em\textsf{,}\) and validating key \(P\kern-0.05em\textsf{,}\) over server_id followed by the request without sig. The wallet SHOULD make the signature’s random input \(T\) depend on \(a\) as well as on fresh randomness, since a repeated or predictable \(T\) reveals \(a\kern-0.05em\textsf{.}\)

The server MUST drop a request, without responding, if it is malformed, including when either half of mailbox_id is not the encoding of a Pallas point other than \(\mathcal{O}_{\mathbb{P}}\kern-0.05em\textsf{,}\) or, for Fetch, if time is not within an hour of the server’s clock or sig does not validate. It MUST NOT distinguish a mailbox it holds nothing for from an empty one.

Routing

A Routing Binding carries requests to Mailbox Servers and responses back. It MUST:

Its specification states the server address format, the framing of requests, responses, and Envelopes sent in fast mode, what a session is, and what each party can observe.

A wallet MUST use a new session for each Deposit, and MUST NOT use one session for two Mailbox IDs. It MUST NOT bypass the anonymity network when it is unavailable.

Fast mode

A Routing Binding MAY define addresses at which a wallet can receive Envelopes directly for a limited time without revealing its network identity to the sender. fast_reply, if not empty, is:

Field Type Description
network_id byte Identifies the Routing Binding
valid_until u32 Time from which the address is not used
address byte[] As specified by the Routing Binding

A wallet MUST create a new address for each fast_reply and use it for nothing else, so that neither its host nor the other wallet can tie it to a Zcash address or to another fast_reply.

A wallet that answers an Envelope with a fast_reply MAY, before valid_until and as well as depositing its answer, send the same Envelope to address from a session used for nothing else.

Wallet behaviour

Rationale

Why reuse the Orchard keys? Any address with an Orchard Receiver is already a public encryption key, so first contact needs nothing new. The cost is the power it gives incoming viewing key holders.

Why derive the mailbox instead of advertising it? Advertising it would need a ZIP 316 Metadata Item, lengthen addresses, and allow one mailbox to be put in two addresses, linking them. Derivation gives every diversified address its own mailbox. In exchange, senders cannot tell whether a recipient reads messages, wallets have to agree on a Server List, and fetching has to be authorized by a key the wallet already has.

Why is a Mailbox ID a pair of points? It lets a server verify knowledge of \(\mathsf{ivk}\) without having been told anything by the recipient, and without the fetcher revealing its Receiver. Under the Decisional Diffie–Hellman assumption the pair cannot be linked to the Receiver or to the mailbox of another address with the same \(\mathsf{ivk}\kern-0.05em\textsf{;}\) neither can the signatures.

Why is \(\mathsf{epk}\) checked? For the reason given in ZIP 212: 24 an Envelope encrypted to one address also decrypts under any other address with the same \(\mathsf{ivk}\kern-0.05em\textsf{,}\) so without the check a sender could deposit an Envelope made for one address in the mailbox of another and learn from a reaction that they belong to one wallet. The check also ties \(\kappa\) to a single Receiver.

Why Conversations? A Contact Mailbox gives its server a record of everything sent to an address. Pairwise Mailboxes move an ongoing exchange to identifiers that change weekly, and they give the recipient a way to answer without the sender disclosing an address. Shorter epochs would leak less but cost a returning wallet one fetch per missed epoch and Conversation.

Why is there no Delete request? Deleting on the next fetch puts a random delay between reading an Envelope and its disappearance, which the sender in a Conversation can observe.

Why do wallets keep the fetch position? Several devices, or the members of a FROST group, may hold one incoming viewing key, and a server cannot tell them apart. If any holder’s Fetch caused deletion, or the server kept a position per Mailbox ID, the first to fetch would hide Envelopes from the others, and a position kept by the server would also link a wallet’s fetches. With the position in each request, and deletion only by opt-in and after a minimum age, every device receives every Envelope within the retention period.

Why separate routing from mailboxes? A party that stores messages for a wallet’s address and also sees the wallet’s IP address, as a Nym gateway named in an address would, can link the two. Here the server that stores Envelopes never sees an IP address, and the entry point that sees one never learns a Mailbox ID. It also means wallets on different networks can exchange messages, and the protocol outlives any one network.

Why fixed sizes? Exact lengths would leak payload types.

Why no ZIP 324 payload? A sender on this channel already holds the recipient’s address and can pay it, and a ZIP 324 URI carries spend authority that every incoming viewing key holder could use.

Reference implementation

None yet.

Open issues

Appendix A: Routing Bindings (non-normative)

These sketches exist so that the protocol can be evaluated against real networks. Items marked TBD have to be resolved before either is normative.

Nym mixnet

network_id \(1\kern-0.05em\textsf{.}\)

Tor

network_id \(2\kern-0.05em\textsf{.}\)

References


  1. Information on BCP 14 — “RFC 2119: Key words for use in RFCs to Indicate Requirement Levels” and “RFC 8174: Ambiguity of Uppercase vs Lowercase in RFC 2119 Key Words”  ↩︎

  2. ZIP 316: Unified Addresses and Unified Viewing Keys  ↩︎

  3. Nym documentation  ↩︎

  4. Tor Rendezvous Specification - Version 3  ↩︎

  5. Partially Created Zcash Transactions (librustzcash pczt crate)  ↩︎

  6. ZIP 312: FROST for Spend Authorization Multisignatures  ↩︎

  7. ZIP 321: Payment Request URIs  ↩︎

  8. Sean Bowe and Ian Miers, “A Note on Notes: Towards Scalable Anonymous Payments via Evolving Nullifiers and Oblivious Synchronization”, IACR ePrint 2025/2031  ↩︎

  9. Sean Bowe, “Tachyon: Scaling Zcash with Oblivious Synchronization” (Zcash Community Forum thread)  ↩︎

  10. ZIP 231: Memo Bundles  ↩︎

  11. ZIP 324: URI-Encapsulated Payments  ↩︎

  12. Taylor Hornby, “Fixing Privacy Problems in the Zcash Light Wallet Protocol” (2020)  ↩︎

  13. zips#629: Scalability Design Explorations around changing Payment Flows  ↩︎

  14. Nym × Zcash Integration Guide  ↩︎

  15. Zcash Protocol Specification, Version 2026.8.0 [NU6.3]. Section 5.4.1.2: BLAKE2 Hash Functions  ↩︎

  16. Zcash Protocol Specification, Version 2026.8.0 [NU6.3]. Section 5.4.1.6: DiversifyHashSapling and DiversifyHashOrchard Hash Functions  ↩︎

  17. Zcash Protocol Specification, Version 2026.8.0 [NU6.3]. Section 4.2.3: Orchard Key Components  ↩︎

  18. Zcash Protocol Specification, Version 2026.8.0 [NU6.3]. Section 5.4.3: Symmetric Encryption  ↩︎

  19. Zcash Protocol Specification, Version 2026.8.0 [NU6.3]. Section 5.4.9.8: Group Hash into Pallas and Vesta  ↩︎

  20. Zcash Protocol Specification, Version 2026.8.0 [NU6.3]. Section 5.4.9.6: Pallas and Vesta  ↩︎

  21. Zcash Protocol Specification, Version 2026.8.0 [NU6.3]. Section 5.1: Integers, Bit Sequences, and Endianness  ↩︎

  22. Zcash Protocol Specification, Version 2026.8.0 [NU6.3]. Section 5.6.4.2: Orchard Raw Payment Addresses  ↩︎

  23. Zcash Protocol Specification, Version 2026.8.0 [NU6.3]. Section 5.4.7: RedDSA, RedJubjub, and RedPallas  ↩︎

  24. ZIP 212: Allow Recipient to Derive Ephemeral Secret from Note Plaintext  ↩︎

  25. Nym documentation: Addressing System  ↩︎

  26. Nym documentation: Anonymous Replies (SURBs)  ↩︎

  27. nym-node source: StaleMessageDebug::DEFAULT_STALE_MESSAGES_MAX_AGE in config/gateway_tasks.rs  ↩︎