Applied Zcash

Wishlist

Presigned transactions

A key holder signs a transaction now. A wallet on a different device completes the transaction and sends it later, also after a network upgrade.

The design is in a draft ZIP by Kris Nuttycombe (nuttycom): Sighash Variant for Deferred Broadcast. The draft has no ZIP number yet. Its deployment is not scheduled. Thus, no wallet or node has this function today. On this page, a presigned transaction is a transaction that a key holder signs now. A wallet sends it later.

Necessary changes

Improves
Threshold keys, offline signing and scheduled payments.
Wallets
New rules to sign, complete, keep and cancel presigned transactions. Support for the v7 transaction format.
ZIP
Sighash variant 1 is in the draft, as an addition to the v7 format of ZIP 248 (Draft). Changes to the draft are in an open pull request, zcash/zips#1484. A change to the lock time of ZIP 248 is in zcash/zips#1497 (merged).
Consensus
A network upgrade with the v7 format and variant 1. The v7 format is outside NU7 (ZIP 259).
Status
Draft. The deployment is not scheduled. The draft has no reference implementation yet.

Problem

In v5 and v6, the consensus branch ID and the expiry height are signed (ZIP 244, ZIP 229). Both ZIPs are Final. Thus, a key holder must know both values at the time of signing.

In ZIP 203, the default expiry height is 40 blocks after the current height. From NU7, the recommendation in ZIP 218 is 120 blocks (ZIP 203, Changes for NU7). If the transaction is sent later, the key holder must sign a later expiry height or no expiry. Both values are different from the values of other wallets. Thus, an observer can find the transactions with these values. The signing time can also be found from a later expiry height.

A signature is valid on one consensus branch only. After a network upgrade, the signed transaction is invalid. A key holder can sign one copy for each consensus branch. This is possible only for a network upgrade with a known consensus branch ID.

In ZIP 318 (Draft), a wallet should sign the Orchard to Ironwood migration transactions in advance and keep them. It sends each one at its scheduled height. The wallet must sign one copy for each consensus branch in the validity range of a transaction. The expiry height is calculated from 30-day periods. That value is still different from the default.

Before v6, the anchors were part of the signed data too. In the v6 format, the anchors are authorizing data (ZIP 229). Thus, a wallet can make the proofs after the signature, with a new anchor.

Mechanism

Sighash variant 1

In the v7 format of ZIP 248, each signature has a sighash variant. The signed data of variant 0 is all the effecting data of the transaction. This data contains the consensus branch ID and the expiry height.

Variant 1 is in the draft. The signed data of variant 1 is the same data, without these two fields. Variant 1 is for spend authorization signatures and transparent input signatures. Variant 0 is necessary for binding signatures. That is a consensus rule in the draft.

The sighash variant of each signature is visible on the chain. Thus, the draft has a recommendation for wallets with this function. They should use variant 1 for each v7 transaction with a shielded bundle. This includes the transactions that they send immediately.

Complete and send

Before a wallet sends a presigned transaction, it completes the transaction in these steps:

  1. The wallet sets the consensus branch ID of the target height. The target height is the height of the next block.
  2. The wallet sets the expiry height as for a transaction that it signs now. This value must be independent of the signing time.
  3. If the proofs do not exist yet, the wallet selects the anchor of each shielded bundle. Then it makes the proofs against that anchor. If the proofs exist, the wallet keeps their anchor. If the wallet selects a new anchor, it must make new proofs.
  4. The wallet makes the binding signature of each shielded bundle.

Thus, these fields are independent of the signing time. The exception is the anchor of existing proofs. The wallet needs the binding signing key of each shielded bundle. To make new proofs, the wallet also needs the private inputs of the proofs. The values and the addresses of the notes are in these inputs. The spending key stays with the key holder.

Who can send the transaction

The builder of a shielded bundle knows its binding signing key. Each party that receives the value commitment randomness from the builder also knows it. In the draft, a FROST coordinator sends each participant the openings of the value commitments. Then each participant can check the values. These openings contain the value commitment randomness. Thus, each participant has the binding signing keys. With the private inputs of the proofs, a participant can complete the transaction. In ZIP 312, the coordinator "possibly" sends these openings, and the mechanism is outside its scope. Without them, a participant does not have the binding signing keys, and only the coordinator could complete the transaction. The draft has an open issue on this point: whether participants can check the values without the openings.

Only a shielded bundle has a binding signature. If each transparent input of a transparent-only transaction has a variant 1 signature, any party can change the two fields. The transaction identifier is then different too.

Validity and cancellation

A variant 1 signature stays valid until an input of the transaction is spent. The signature also becomes invalid when nodes stop accepting the transaction version or a bundle variant. The signature stays valid after an expiry height and after a network upgrade. Each time a wallet completes the transaction, the transaction identifier is different. All these transactions have the same inputs. Thus, at most one of them can be mined.

In the draft on main, a wallet can cancel a presigned transaction. To do this, it spends an input of that transaction in a different transaction. The wallet treats the cancellation as effective only after that different transaction is mined. After a completed transaction expires, the wallet does not treat the presigned transaction as cancelled or failed. In zcash/zips#1484 (open), these rules are removed, and other rules are added. One new rule is for an expired transaction. While another party can complete it again, a wallet must not assume that its effects can no longer be applied.

A variant 1 signature has no upper limit on the height at which the transaction is mined. In the draft, a wallet that asks a user to confirm such a signature should say this. It must not show an expiry height as a limit on the approval. In a transaction with transparent inputs, the lock time is in the signed data. Thus, a lower limit is possible. When nodes use the lock time, the transaction has an earliest height or time. See Lock time. A variant 1 signature has no limit on the consensus branch. After the signatures and the proofs are public, each party with the binding signing keys can complete the transaction again. This is possible later, until an input is spent, on each consensus branch where nodes accept the transaction. Thus, in the draft, a wallet should give a binding signing key only to a party that needs it.

Lock time

A lock time is a block height or a time. Nodes accept the transaction only in a block with a height or a time after the lock time. Current nodes use the lock time only if a transparent input has a sequence number other than 0xFFFFFFFF. This rule is in the zcashd code (IsFinalTx) and in the Zebra code: lock_time and lock_time_has_passed. This rule is not explicit in the protocol specification yet (zcash/zips#539, open).

Thus, for a transaction with only shielded inputs, current nodes ignore the lock time. The result is the same in the v7 format of ZIP 248 (Draft). The wallet that keeps such a presigned transaction decides when to send it. In the draft, a key holder that uses variant 1 should sign only transactions with a lock time of zero. The exception is a transaction for which a lock time is necessary. In the v7 format, the lock time is in the transparent bundle. There, the lock time field is present only when the transaction has transparent inputs.

Use cases

Comparison

SignatureConsensus branch ID signedExpiry height signedAnchor signedValid untilStatus
v5 (ZIP 225)YesYesYesThe expiry height, a network upgrade, or when an input is spentDeployed
v6 (ZIP 229)YesYesNoThe expiry height, a network upgrade, or when an input is spentDeployed
v7, variant 0 (ZIP 248)YesYesNoThe expiry height, a network upgrade, or when an input is spentDraft
v7, variant 1 (the draft)NoNoNoWhen an input is spent, or the end of its transaction version or bundle variantDraft

Parts of a spec

The draft has the first three parts. ZIP 248 has the fourth part. The other parts are open issues in the draft.

Change this page on GitHub