Pattern · Experimental
Verified address
A service examines that a user controls a Zcash address. Then the service writes a record of the check in a bound note. A verifier with the receipt finds the record on the chain.
This pattern is a combination of Log in with Zcash and Bound notes. The login is the check. The bound note is the record.
Warning
This pattern is a proposal of this site. It has no implementation and no review. Use it on Testnet only.
Problem
A login is a fact between two parties: the user and the app. The app examines the code, and the session starts. For a login, a record on the chain is unnecessary.
Some claims must stay valid for other parties, and for a long time:
- a user must show that an address was verified before a deadline, for example for a vote;
- a second app accepts the check of the first service;
- an auditor examines the full list of a service that gives "verified" marks.
A signed token from the service is sufficient while the service is honest. A dishonest service can put an old date on a new token. It can also show different lists to different persons.
A record in a chain of bound notes has a place in a block. Nodes accept one successor for each note. Thus, each record has a height, and the service has one list.
Mechanism
Roles
- User
- A person who logs in with a Zcash address.
- Service
- The app and its server wallet. It examines login codes and writes records.
- Verifier
- A person or an app that examines a receipt.
- Directory
- The chain of bound notes of the service. Each record is one note of the chain.
- Salt
- A secret value of 32 random bytes. The service makes a new salt for each record.
- Claim
- A hash of the salt and the address. The claim is the fields of the record.
- Receipt
-
The data for the check of one record: the address, the salt, the transaction ID, the action index and
prev.
Sequence
- The user logs in with an address. The service examines the code. See Log in with Zcash.
- The service makes a salt and calculates the claim:
claim = BLAKE2b-256(P, salt ‖ address)
- The service builds a bound note to the directory address. The fields are the claim.
previs thecmxof the tip of the directory. - The service spends the tip in the action of the new note. Then it sends the transaction.
- When the transaction is in a block, the service gives the receipt to the user.
- The user gives the receipt to each verifier that must examine the claim.
P is a personalization of 16 bytes. The address is the text of the address from the login, with
no space before or after it. The salt has a fixed length. Thus, two different pairs of salt and address always have two different hash
inputs.
Public list
The service publishes the claim and the place of each record. The place is the transaction ID and the action index. With this list, anyone can examine each listed record and its lineage.
Each claim is a hash of the address and a secret salt of 256 bits. Thus, the address stays secret from a person who has only the list.
A service can publish only the first part of its chain. Thus, a count of the listed records is a minimum. For a full audit, the auditor selects a block height as a checkpoint. With the full viewing key, the auditor calculates the nullifier of the last listed record. The auditor accepts the list as complete only if that nullifier is absent from the chain up to the checkpoint.
Verification
The service publishes the directory address, its full viewing key and the pin of the genesis note. A verifier with a receipt:
- calculates the claim from the salt and the address;
- reads
nf_oldandcmxfrom the action of the receipt; - calculates
rseedfrom the kind, the claim andprev; - calculates the note commitment and compares its x-coordinate with
cmx; - examines the lineage from the genesis note to the record, with the public list.
The height of the block of the record is the time of the claim. Steps 3 to 5 are the usual checks for a chain of bound notes. See Bound notes: Verification.
What the record shows
A valid record shows three facts:
- the service wrote this claim;
- the claim was on the chain at this height;
- the directory has one sequence of records.
The code check stays with the service. A verifier must trust the service for that step. As in Log in with Zcash, a correct code shows that the user can read the memos of the address.
Private and public records
For a private record, only the user and the service have the receipt. The user selects each verifier. For a public directory, the service publishes each address and its salt. Then anyone can examine each record.
Cost
- Each record In a usual record transaction, the tip and one funding note are spent. The outputs are the new record and a change note. That is two actions. The ZIP 2009 fee for two actions is 2,000 zatoshis.
- Wallets Each wallet tries to decrypt each action on the chain. A service with many logins can put many claims in one record. The fields are then the Merkle root of the claims, and each receipt has a Merkle path. See Polite actions.
- Verifiers One BLAKE2b hash for the claim. Then one BLAKE2b hash and one Sinsemilla commitment for each record of the lineage.
-
Builders The transaction builder must accept an
rseedfrom its caller. See Bound notes: Cost.
Limits
- Trust. The record is the statement of the service. A dishonest service can write a record for an address with no login. Use a record only if you trust the service for the code check.
- Viewing keys. A holder of the incoming viewing key of the address can log in. Thus, the record is a claim about the viewing key. The spending key can have a different holder.
- Receivers. The service sends the login code to one receiver of the address. Thus, the record is a claim about that receiver only. See Log in with Zcash: Limits.
- Count. One user can register many addresses, and a verifier cannot link them. Thus, the number of records is a number of addresses. The number of users can be smaller.
- Time. The record is correct for its height. The user can lose control of the address after that height. For a new claim, the user logs in again.
- Receipts. A receipt discloses the address to the verifier. The verifier can give the receipt to other persons. Use a different address for each claim that must stay apart.
- Salts. A check of an address against a record is possible only with the salt. The service or the user must keep each receipt.
- Public data. The number of records and the height of each record are public.
Spec
This pattern has no spec. The record format of the demo is a proposal. The rules for the binding and the lineage are in the draft ZIP for Bound notes.
Demo: a toy directory
These are the values of the toy directory:
D "VerifiedAddr_v1_"
kind 1 (verified)
fields claim = BLAKE2b-256("VerifiedAddr_clm", salt ‖ address)
prev the cmx of the previous record
The demo starts after a correct login code. It uses the orchard crate, compiled to WebAssembly.
The directory key is a demo key. The ρ of the first record is a demo value. The demo calculates the values of
each note only. For each next record, ρ is the nullifier of the previous record. Each record is an
Ironwood-pool note.
Wait
Next record
Directory
The directory is empty. Add a record.