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:
- The wallet sets the consensus branch ID of the target height. The target height is the height of the next block.
- The wallet sets the expiry height as for a transaction that it signs now. This value must be independent of the signing time.
- 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.
- 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
- Offline signing. A hardware wallet or a wallet on an offline device signs. A wallet on a different device completes the transaction and sends it later. That wallet needs the binding signing keys, and the private inputs for new proofs. See Who can send the transaction.
- Threshold groups. A FROST group signs with variant 1. The members can finish the signing session later, also after a network upgrade. The approval stays valid until one of the inputs is spent. If a completed transaction expires, each participant can complete it again. Changes to ZIP 312 are necessary before this. See Parts of a spec and Threshold keys.
- Scheduled payments. A wallet signs a series of payments in one session. Then it sends them over days or weeks, as in the ZIP 318 migration. Current nodes ignore the lock time of a payment with only shielded inputs. Thus, the wallet that keeps the payments decides when to send them. See Lock time.
-
Inheritance and dead-man switch. These jobs are outside the text of the draft. Only the
rules above, from the draft and the Zebra code, are used in this item. An owner signs a payment to an heir. The
owner gives it to a second party, with the binding signing keys and the private inputs for new proofs. If the
owner stops contact with that party, the party sends the payment. Current nodes ignore the lock time of a payment with
only shielded inputs. Thus, that party decides when to send the payment. The owner must trust that party. The
payment can have a lock time and a transparent input with a sequence number other than
0xFFFFFFFF. Then current nodes apply an earliest height or time. The payment has fixed inputs. After the owner spends one of them, the payment is invalid. Then the owner signs a new payment. With the binding signing keys, that party can also complete the payment again until one of the inputs is spent.
Comparison
| Signature | Consensus branch ID signed | Expiry height signed | Anchor signed | Valid until | Status |
|---|---|---|---|---|---|
| v5 (ZIP 225) | Yes | Yes | Yes | The expiry height, a network upgrade, or when an input is spent | Deployed |
| v6 (ZIP 229) | Yes | Yes | No | The expiry height, a network upgrade, or when an input is spent | Deployed |
| v7, variant 0 (ZIP 248) | Yes | Yes | No | The expiry height, a network upgrade, or when an input is spent | Draft |
| v7, variant 1 (the draft) | No | No | No | When an input is spent, or the end of its transaction version or bundle variant | Draft |
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.
- Variant 1 digest. The signed data of variant 1, as a change to the variant 0 digest of ZIP 248. It is in the draft.
- Consensus rules. The variant of binding signatures is 0. The consensus branch ID field of a v7 transaction is the consensus branch ID of the epoch of its block. Both rules are in the draft on main. In zcash/zips#1484, the second rule is in ยง 7.1.2 of the protocol specification instead.
- Wallet rules. The rules to sign, complete, keep and cancel presigned transactions. They are in the draft. In zcash/zips#1484, their text is changed, and the cancellation rules are removed.
- Lock time. The field and its effect in a v7 transaction. In ZIP 248, the field is in the transparent bundle. It is present only when the transaction has transparent inputs.
- Transparent-only transactions. An open issue in the draft. One option is a rule that each v7 transaction has at least one variant 0 signature.
- PCZT fields. An open issue in the draft. ZIP 374 (Draft) must contain a field for the sighash variant of each signature. A role for the two fields is also necessary in ZIP 374.
- Threshold signing. An open issue in the draft. ZIP 312 (Draft) must contain the signed message for each variant. A statement that an approval stays valid until a wallet spends an input must also be in its threat model.
- Variant number and test vectors. Open issues in the draft. The number 1 is provisional until the ZIP Editors confirm it.