You are on page 1of 5

ZCASH

Shreyasi Katiyar
Banasthali Vidyapith, katiyarshreyasi2000@gmail.com

Abstract - Bitcoin’s transparent, immutable, publicly Zcash addresses are either private (z-addresses or shielded
auditable ledger allows any party to trivially verify the through zero-knowledge proofs) or transparent (t-addresses).
correctness of transactions. This transparency means A Z-to-Z transaction appears on the public blockchain, so it
that an adversary may, while obeying the rules of the is known to have occurred and that the fees were paid. But
network, trace the flow of transactions. By the addresses, transaction amount and the memo field are all
corresponding a transaction to an individual, the encrypted and not publicly visible. Using encryption on a
adversary may determine the source and destination of blockchain is only possible through the use of zero-
that user’s funds, resulting in a serious loss of privacy. knowledge proofs. The owner of an address may choose to
Several alternative cryptocurrencies ("altcoins") have disclose z-address and transaction details with trusted third
endeavored to create systems that preserve privacy. The parties — auditory and compliance needs — through the use
chief difficulty in creating such a system is devising a of view keys and payment disclosure. Transactions between
way that the correctness of transactions can be easily two transparent addresses (t-addresses) work just like
verified while obscuring the underlying details of the Bitcoin: the sender, receiver and transaction value are
transactions. Zcash is an implementation of the publicly visible. The two Zcash address types are
Decentralized Anonymous Payment scheme Zerocash, interoperable. Funds can be transferred between z-addresses
with security fixes and improvements to performance and t-addresses.
and functionality. It bridges the existing transparent
payment scheme used by Bitcoin with a shielded WHAT ARE ZK-SNARKS
payment scheme secured by zero-knowledge succinct
non-interactive arguments of knowledge (zk-SNARKs). Zcash is the first widespread application of zk-SNARKs.
It attempted to address the problem of mining The strong privacy guarantee of Zcash is derived from the
centralization by use of the Equihash memory-hard fact that shielded transactions in Zcash can be fully
proof-of-work algorithm. This specification defines the encrypted on the blockchain, yet still be verified as valid
Zcash consensus protocol at launch. under the network’s consensus rules by using zk-SNARK
proofs.
Index Terms - cryptographic protocols, electronic commerce It refers to a proof construction where one can prove
and payment, proof of work, zero knowledge. possession of certain information, e.g. a secret key, without
revealing that information, and without any interaction
WHAT IS ZCASH between the prover and verifier.
“Zero-knowledge” proofs allow one party (the prover) to
Zcash is a decentralized and open-source peer-to-peer digital
prove to another (the verifier) that a statement is true,
currency(or cryptocurrency) based on bitcoin.It was
without revealing any information beyond the validity of the
launched in October, 2016 by scientists at MIT, Johns
statement itself. For example, given the hash of a random
Hopkins and other respected academic and scientific
number, the prover could convince the verifier that there
institutions. It inherits basic properties like $21M mining
indeed exists a number with this hash value, without
limit with minor changes in incentive structure. It has many
revealing what it is. In a zero-knowledge “Proof of
core features and capabilities such as low transaction fees of
Knowledge” the prover can convince the verifier not only
0.0001 ZEC, address and transaction privacy, encrypted
that the number exists, but that they in fact know such a
memos, viewing keys and payment disclosure.
number – again, without revealing any information about the
number.
“Succinct” zero-knowledge proofs can be verified within a
HOW IT WORKS few milliseconds, with a proof length of only a few hundred
bytes even for statements about programs that are very large.
At the core of Zcash technology are zero-knowledge proofs,
In “non-interactive” constructions, the proof consists of a
which allow transaction data to be validated without
single message sent from prover to verifier, a common
revealing information about the amount and the parties
reference string shared between prover and verifier. We refer
involved. Zcash uses specific zero-knowledge proofs called
to this common reference string as the public parameters of
zk-SNARKs (zero-knowledge succinct non-interactive
the system.
arguments of knowledge).

Multiple transaction types

1
How zk-SNARKs are constructed in Zcash computed and guarantee the computation was correct one
step at a time. We include as variables in our R1CS:
The function determining the validity of a transaction
according to the network’s consensus rules must return the  the constant 1
answer of whether the transaction is valid or not, without  all the public inputs to our original function
revealing any of the information it performed the  the outputs of our original function
calculations on.  the private inputs to the original function
This is done by encoding some of the network’s consensus  all the auxiliary variables created during the
rules in zk-SNARKs. At a high level, zk-SNARKs work by computation
first turning what you want to prove into an equivalent form
about knowing a solution to some algebraic equations. An assignment can be divided in two parts:

Computation → Arithmetic Circuit → R1CS → QAP →  Primary assignment: the constant 1, public inputs
zk-SNARK and outputs
 Auxiliary assignment: private inputs and all
Arithmetic Circuit auxiliary variables

Similar to a boolean circuit where a program is compiled Example : Prove that you know (p,q) such that (p+3)(q+2) =
down to discrete, single steps like AND, OR, NOT, when a n+1. The values (p,q) are private to you, while the value n is
program is converted to an arithmetic circuit, it’s broken publicly known.
down into single steps consisting of the basic arithmetic
operations of addition, subtraction, multiplication, and v0 = = p + 3 (1)
division. Here is an example of what an arithmetic circuit v1 = = q + 2 (2)
looks like for computing the expression (a+b)*(b*c) : v2 = = v0 * v1 (3)
v3 = = n + 1 (4)
v2 = = v3 (5)
output = = 1 (6)
 Primary: [1, n, output]
(7)
 Auxiliary: [p, q, v0, v1, v2, v3]
(8)

How Constraints Work

Multiplication Gates :
Take (7) and (8) and put them together like this.

V = [1, n, output, p, q, v0, v1, v2, v3]

An assignment is just a vector with these variable names


replaced by values. For example for p =3 , q = 5, a
successful computation will look like this (n = 41):
FIGURE 1
EXAMPLE ARITHMETIC CIRCUIT s = [1, 41, 1, 3, 5, 6, 7, 42, 42]
R1CS Now for example, to encode the third constraint, we want to
express (3).
A Rank 1 Constraint System, or R1CS, to check that the We can do this by taking two copies of V, filtering out the
values are “traveling correctly”. The verifier has to check only terms we care about, and multiplying them. We do that
many constraints — one for almost every wire of the circuit. using the dot product. So, if we want to isolate v0 only, we
The R1CS must receive as input an assignment of the full do:
state of the computation. This is defined by the value of all
the variables used in the process, and because each was set <V . [0, 0, 0, 0, 0, 1, 0, 0 ,0]> = v0 + a bunch of 0s
only once, its final value is equal to what it was when it was
used. Therefore, by getting a snapshot of the values of all and to isolate v1 we do
variables we can verify they have all been properly

2
Using Polynomial Interpolation-Lagrangian
<V . [0, 0, 0, 0, 0, 0, 1, 0 ,0]> = v1 + a bunch of 0s Interpolation and Fast Fourier Transform ,this can
be implemented.
The product of these will be, naturally, v0 * v1.
Now, to test for equality, I can isolate v2, and subtract both
terms. They are equal only if the result is 0.
How zk-SNARKs are applied to create a shielded
<V . [0, 0, 0, 0, 0, 0, 0, 1 ,0]> = v2 transaction

If I use s instead of V, I will have actual values on either side The sender of a shielded transaction constructs a proof to
of the equality sign, and the condition will make perfect show that, with high probability:
mathematical sense.
Then, defining
 the input values sum to the output values for each
A3 = [0, 0, 0, 0, 0, 1, 0, 0 ,0] shielded transfer.
 the sender proves that they have the private
B3 = [0, 0, 0, 0, 0, 0, 1, 0 ,0] spending keys of the input notes, giving them the
authority to spend.
C3 = [0, 0, 0, 0, 0, 0, 0, 1 ,0],  The private spending keys of the input notes are
cryptographically linked to a signature over the
third constraint can be written whole transaction, in such a way that the
transaction cannot be modified by a party who did
<A3.s> * <B3.s> - <C3.s> == 0 not know these private keys.

Bitcoin tracks unspent transaction outputs (UTXOs) to


Addition Gates : determine what transactions are spendable. In Zcash, the
shielded equivalent of a UTXO is called a “commitment”,
All the constraints in the R1CS specify a term is equal to the and spending a commitment involves revealing a “nullifier”.
product of two other terms. Each term is a linear Commitments and nullifiers are stored as hashes, to avoid
combination of the system’s variables. We can add any disclosing any information about the commitments, or which
multiple of each variable before multiplying them. Even if nullifiers relate to which commitments. Each unspent
we have an addition gate we have to craft the constraint as a transaction output (UTXO) can be thought of as an unspent
product of something. ‘note’ that is described by the address/public key of its
In the previous example, taking (1), the righthand side can owner and the amount of ZEC it contains. dFor each new
be encoded as note created by a shielded payment, a commitment is
published which consists of a hash of the address to which
V0= =1 * (p + 3) the note was sent, the amount being sent, a number “rho”
which is unique to this note and a random nonce.
A1 = [1, 0, 0, 0, 0, 0, 0, 0, 0]
Commitment = HASH(recipient address, amount, rho, r)
B1 = [3, 0, 0, 1, 0, 0, 0, 0, 0]
When a shielded transaction is spent, the sender uses their
C1 = [0, 0, 0, 0, 0, 1, 0, 0, 0] spending key to publish a nullifier which is the hash of the
secret unique number (“rho”) from an existing commitment
QAP that has not been spent, and provides a zero-knowledge
proof demonstrating that they are authorized to spend it.
To “bundle all these constraints into one”, the method uses a This hash must not already be in the set of nullifiers tracking
representation of the circuit called a Quadratic Arithmetic spent transactions kept by every node in the blockchain.
Program (QAP).
Once we have the full set of constraints, we can create the Nullifier = HASH(spending key, rho)
QAP. Our goal is to devise a set of polynomials that
simultaneously encode all of the constraints, so that we can TABLE 1
verify the satisfiability thereof with a single check on the COMMITMENT AND NULLIFIERS STORED AS HASH
polynomials instead of a check over each constraint. The
clever trick is to build the polynomials in a way that they can Hashed notes Nullifier set
generate all of the constraints.
H1 = HASH(Note1) nf1 = HASH(r2)

3
Alice will publish a proof-string π convincing the nodes
Hashed notes Nullifier set that whomever published this transaction knows
H2 = HASH(Note2) valuesPK1, sk1, and r1 such that
 The hash of the note Note1= (PK1, r1) exists in the
H3 = HASH(Note3) set of hashed notes.
 sk1 is the private key corresponding to PK1 (and
thus, whomever knows it is the rightful owner
(Zcash uses a type of mining algorithm called of Note1).
Equihash)  The hash of r1 is nf2, (and thus, if nf2 – that we
now know is the nullifier of Note1 – is not
The zero-knowledge proof for a shielded transaction verifies currently in the nullifier set, Note1 still hasn’t been
that, in addition to the conditions listed above, the following spent).
assertions are also true:
 For each input note, a revealed commitment exists. How to mine Zcash
 The nullifiers and note commitments are computed
correctly. Each time a block is added to the Zcash blockchain, a new
 It is infeasible for the nullifier of an output note to ZEC is created. In fact, new blocks are created about every
collide with the nullifier of any other note. 2.5 minutes.

How a transaction is made


Selecting the Right Hardware
Now suppose Alice owns Note1 and wishes to send it to
Bob, whose public key is PK4. We will assume for
simplicity that Alice and Bob have a private channel Zcash uses the Equihash algorithm, which relies on high
between them although this is not actually necessary in RAM requirements, so miners can’t use the
Zcash. Basically, Alice will invalidate her note by ASIC(application-specific integrated circuit) setup for
publishing its nullifier, and at the same time create a new mining(large upfront investment) the cryptocurrency. As a
note that is controlled by Bob. result, you have two options to consider - CPUs and
 She randomly chooses a new serial number r4 and GPUs(Graphics Processing Unit).
defines the new note  Note4= (PK4,r4). CPU equipment. The benefit of mining Zcash is that we can
 She sends Note4 to Bob privately. use your existing CPU, which we can’t do with other
 She sends the nullifier of  Note1,  nf2= HASH(r1) options, such as Bitcoin If you’re purchasing a new CPU,
to all nodes. make sure that it has adequate cooling because units can get
 She sends the hash of the new note  H4=  very hot during mining.
HASH(Note4) to all nodes.
GPU equipment. The benefit of GPU mining is that it’s
Now, when a node receives nf2 and  H4, it will check faster and more efficient than CPU mining. But it’s also a
whether the note corresponding to nf2 has already been more expensive investment. When looking to purchase this
spent, simply by checking if nf2 already exists in the type of equipment, check the hashing power of the unit
nullifier set. If it doesn’t, the node adds nf2 to the nullifier (which is directly tied to how much you’ll earn). Some
set and adds H4 to the set of hashed notes; thereby validating miners decide to purchase a used setup, which is fine, but
the transaction between Alice and Bob. GPUs get hot and if the cooling isn’t working properly, it
could quickly destroy your investment. As with the CPU
TABLE 2 units, ensure that all fans are working correctly upon
HASH TABLE AFTER A TRANSACTION receiving the equipment.

Hashed notes Nullifier set


H1= HASH(Note1) nf1= HASH(r2) Mining Reward
H2= HASH(Note2) nf2= HASH(r1)
H3= HASH(Note3) However, 10 percent of that reward is distributed to the
H4= HASH(Note4) stakeholders in the Zcash company, which includes the
founders, investors, advisors and employees. Zcash calls this
the "Founders Reward". For the first four years of
operation, 50 ZEC will be created every 10 minutes, and 80

4
percent of that newly created ZEC goes to the miners while profit responsible for developing on the cryptocurrency,
20 percent goes to the founders. Every four years, the rate of since its launch in 2016. Due to the technical changes
ZEC being created will halve, similar to Bitcoin. Currently, included in Sapling, exchanges and wallets will be more
the reward is set at 12.5 ZEC per block. However, each four- readily able to accept shielded transactions. Light and
year period (or 840,000 blocks mined) that reward is cut in mobile wallets will also be a possibility – meaning that users
half. can send anonymized transactions straight from their mobile
devices. Light clients are those that don’t store the full data
from the blockchain but still have the assurance of being
Determining Profitability secure. These are typically clients working on a mobile
device, which doesn’t have as much storage space or
computing power as laptop or desktop computers.The
Sapling protocol will allow shielded transfers to be
The amount of your reward will depend on a variety of completed with about 100 times less memory and probably
factors, including the equipment purchased, electricity cost
in your area, and whether you belong to a mining pool or six or more times faster.
mine alone. But regardless, you can figure out your unique It’s a notable step given currently, shielded transactions are
situation by using a profit calculator. For example, this only possible for users running a full node.  And with the
calculator allows you to input the hashing power, power upgrade, the team at the Zcash Company hopes it can
consumption and cost per kW/h to determine your profit ultimately remove transparent transactions, the non-private
ratio per day and per month. Prior to purchasing equipment, zcash transactions that can be damaging to zcash anonymity
you can use this type of calculator to determine whether the when used together with shielded transactions.
initial investment is worth the potential profit. Another feature Sapling includes that will encourage more
use of shielded transactions is so-called “diversified
Setting Up a Zcash Wallet Address addresses,” which make it easier for exchanges to support
more users utilizing the transaction type.
 Internet wallets. Internet wallets have apps that
you can download to your smartphone to view and References
manage your wallet. [1] https://z.cash/
[2] https://electriccoin.co//blog/anatomy-of-zcash/
Ex. Coinomi [3] http://coders-errand.com/
[4] https://dagcoin.org/
 Hardware wallets. According to Zcash, a
hardware wallet is the safest method for storing your
Zcash. The drawback is that they currently support only
Zcash transparent addresses, and those costs ranges
from $40 to $99.
Ex.Ledger Nano S
 Exchange wallets. The exchange wallets are
among the easiest options to set up. You simply need to
create an account with an exchange that supports Zcash.
However, check out the security of the exchange when
considering this option.
Ex.Coinbase

Your money isn’t backed with insurance and if the location


where it’s stored gets hacked or the coins get stolen - you’re
out of luck. Once they’re stolen, you can’t get the coins
back.

Future of Zcash

Zcash’s core differentiator, shielded transactions, are


computationally heavy – so much so that most users and
exchanges can’t support it. Sapling, the hard fork upgrade
has been the primary focus of the Zcash Company, the for-

You might also like