What is a Zcash Transaction?
A Zcash transaction is the fundamental mechanism for transferring value and data across the decentralized Zcash network. However, unlike Bitcoin, Zcash transactions offer programmable privacy through advanced cryptography.
Here is a breakdown of how a Zcash transaction works beneath the surface.
1. The UTXO Model (Unspent Transaction Outputs)
Like Bitcoin, Zcash does not use an "account balance" model like a traditional bank. Instead, it uses the UTXO (Unspent Transaction Output) model. Think of UTXOs like physical cash. If you have a $20 bill and want to buy a $5 coffee, you hand over the $20 bill (the input) and receive a $5 coffee and a $15 bill in change (the outputs). A Zcash transaction simply consumes old inputs and creates new outputs.
2. Transparent vs. Shielded
Zcash supports two entirely different ways of transacting within the same network:
- Transparent Transactions (
t-addrs): Function exactly like Bitcoin. The sender, receiver, and amount are visible to anyone looking at the public blockchain. - Shielded Transactions (
z-addrs&u-addrs): The sender, receiver, and amount are completely encrypted. To outside observers, it merely looks like a mathematically valid transaction occurred, but the details are hidden.
3. Zero-Knowledge Proofs (The Magic)
If a transaction is encrypted, how does the network know you aren't creating counterfeit ZEC? Zcash uses Zero-Knowledge Proofs (specifically zk-SNARKs and Halo 2). When your wallet constructs a shielded transaction, it generates a complex mathematical proof. This proof guarantees to the network that:
- You actually own the funds you are trying to spend.
- You haven't spent them before (no double-spending).
- The inputs equal the outputs (no ZEC was created out of thin air). It proves all of this without ever revealing the amounts or addresses involved.
4. The Anatomy of a Transaction
A standard Zcash transaction contains several key components:
- Version / Group ID: Tells the network which cryptographic ruleset to apply (e.g., v5 for NU5/Orchard).
- Transparent Inputs/Outputs: (If applicable) Publicly visible data.
- Shielded Spends/Actions: The encrypted data and zero-knowledge proofs.
- Signatures: Cryptographic signatures proving authorization by the Spending Key.
- Network Fee: A small amount of ZEC paid to the miners for processing the transaction.
5. The Encrypted Memo Field
One of the most powerful and unique features of a shielded Zcash transaction is the Memo Field. Every shielded transaction can carry up to 512 bytes of encrypted data. Because it uses the same encryption as the financial transfer, the memo is completely invisible to the public. It can only be read by the sender and the receiver using their Full Viewing Keys.
6. The Privacy Pools (Sapling vs. Orchard)
Zcash has upgraded its cryptography over the years, creating different "pools" of privacy.
- Sapling: The older, highly efficient privacy pool.
- Orchard: The state-of-the-art privacy pool. It removes the "trusted setup" requirement of older cryptography and uses the highly advanced Halo 2 proving system. Modern Unified Addresses default to Orchard. Moving funds between these pools requires a transaction that temporarily reveals the amount (a turnstile), but keeping funds within the shielded pool ensures maximum privacy.
7. The Network Fee
To prevent spam and denial-of-service attacks on the network, every transaction must include a fee. Zcash uses ZIP-317: a fee of 5,000 zatoshi per logical action, with a minimum of two actions (10,000 zatoshi, 0.0001 ZEC) for a simple transaction. This fee goes to the miner who includes your transaction in the next block.