Applied Zcash

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 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 record sequence 1: The user logs in, and the service examines the code. 2: The service writes the record in a bound note. 3: The service gives the receipt to the user. 4: The user gives the receipt to a verifier. 5: The verifier calculates cmx and compares it with the chain. user service verifier 1 login, code 2 writes record 3 receipt 4 receipt 5 compares cmx
Each arrow is one message. Amber: a step that uses the chain.
  1. The user logs in with an address. The service examines the code. See Log in with Zcash.
  2. The service makes a salt and calculates the claim:
claim = BLAKE2b-256(P, salt ‖ address)
  1. The service builds a bound note to the directory address. The fields are the claim. prev is the cmx of the tip of the directory.
  2. The service spends the tip in the action of the new note. Then it sends the transaction.
  3. When the transaction is in a block, the service gives the receipt to the user.
  4. 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:

  1. calculates the claim from the salt and the address;
  2. reads nf_old and cmx from the action of the receipt;
  3. calculates rseed from the kind, the claim and prev;
  4. calculates the note commitment and compares its x-coordinate with cmx;
  5. 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 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

Limits

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:

Demo parameters
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.

Demo

Wait

Next record

Directory

    The directory is empty. Add a record.

    Examine a receipt

    Change this page on GitHub