Explaining viewing keys

Viewing keys, detailed in ZIP 310, enable the separation of spending and viewing permissions for Zcash shielded addresses. By creating a separate viewing key, Zcash users can share visibility of the transactions sent and received from their shielded address without compromising their private spend key. This capability was added to the protocol in the Sapling network upgrade, and RPC support was released in version 2.1.2.

Shielded addresses allow Zcash users to transact while revealing as little information on the public blockchain as possible. This protects users’ privacy from bad actors and business competitors. There are instances; however, where it is necessary to reveal some information to a third party, such as for audit or compliance purposes. 

Viewing keys are a critical component of the Zcash value proposition because they allow users to selectively disclose information about their transactions.

 class=

For shielded transactions in Zcash, viewing keys are derived directly from a user’s spending key. There is no central authority that controls access to viewing keys. Once a viewing key is created, it can only be obtained from someone who holds it. If you don’t give your viewing key out, then no one can access it without your participation. 

The Zcash protocol is designed with two features to support the disclosure of information:

  • Viewing keys provide visibility into the transaction value, memo field, and target address of all transactions received by or sent from a specific shielded address.
  • Payment disclosure provides similar visibility for a single transaction. It is a method of proving that a payment was sent to a shielded address, without revealing all of the transactions sent to/from that address.

These features enable owners of a shielded address to share transaction visibility in a secure and confidential manner. For cryptocurrency service providers, this means the ability to verify transactions to/from shielded addresses, while keeping spending authority keys on secure hardware, such as HSMs.

Viewing key use cases

Viewing keys enable a variety of commercial use cases for Zcash that support completely private z-to-z transactions. A merchant might share their payment address viewing key with their accountant to track sales revenue; or a charity may publish their viewing key to verify contributions for donation matching. 

Consider the following examples:

  • An exchange wants to detect when a customer deposits ZEC to a shielded address, while keeping the “spend authority” keys on secure hardware (e.g., HSMs). The exchange could generate an incoming viewing key and load it onto an Internet-connected “detection” node, while the spending key remains on the more secure system.
  • A custodian needs to provide visibility of their Zcash holdings to auditors. The custodian may generate a full viewing key for each of their shielded addresses and share that key with their auditor. The auditor will be able to verify the balance of those addresses and review past transaction activity to and from those addresses. 
  • An exchange may need to conduct due diligence checks on a customer who makes deposits from a shielded address. The exchange could request the customer’s viewing key for their shielded address and use it to review the customer’s shielded transaction activity as part of these enhanced due diligence procedures. 

Implications for Zcash

Viewing keys help ensure Zcash remains at the forefront of regulatory compliance by providing a mechanism by which exchanges and custodians can accept shielded deposits while keeping shielded ZEC in secure cold storage. Viewing keys allow sharing visibility of shielded transactions with auditors and, where appropriate, with regulators. This ensures Zcash users have privacy from criminals and bad actors, but that exchanges and other virtual asset service providers can remain fully compliant while supporting shielded addresses.