A community reference
Build apps on Zcash
An app on Zcash can attach data and rules to shielded notes. Anyone can use chain data to verify the data and the rules. We call this near-programmability.
This site is for developers who look for smart contracts on Zcash. Its patterns operate with the consensus rules of today.
Start with the basics. They show the parts of a usual shielded payment, and how a shop or an app receives one. The patterns use these parts for near-programmability. Each page has a live demo.
The basics
-
Concepts
Notes, pools, actions, memos, keys, addresses and trial decryption, in a few lines each.
-
Payment links
Ask a wallet for a payment with a ZIP 321 URI and its QR code.
-
Address per customer
One key gives many addresses. Each address identifies a customer or an order.
-
Watch-only keys
Give a server a viewing key. It sees the payments, and the spending key stays offline.
Patterns
Each pattern page gives the problem, the mechanism, the cost, the spec, a demo and a toy example.
-
Bound notes
Put a hash of app data in the
rseedof a zero-value note. Standard wallets can decrypt the note. -
Polite actions
Each wallet must try to decrypt each action. Thus, an app must use a small number of actions.
-
Wallet-native orders
Put an order in the memo of a ZIP 321 payment URI.
-
Canonical action pairing
Use a keyed sort to put the actions of a bundle in order. The order sets the pairs.
-
Threshold keys
Give each app role one FROST group key. Any n of m members can sign for the role.