
    ZIP: 270
    Title: Key Rotation for Tracked Signing Keys
    Owners: Jack Grigg <thestr4d@gmail.com>
            Kris Nuttycombe <kris@nutty.land>
            Daira-Emma Hopwood <daira@jacaranda.org>
            Arya <arya@zfnd.org>
    Status: Draft
    Category: Consensus
    Created: 2025-09-16
    License: MIT
    Discussions-To: <https://github.com/zcash/zips/issues/1047>
    Pull-Request: <https://github.com/zcash/zips/pull/1473>


# Terminology

The key words "MUST", "MUST NOT", "SHOULD", and "MAY" in this document are to
be interpreted as described in BCP 14 [^BCP14] when, and only when, they appear
in all capitals.

The term "full validator" in this document is to be interpreted as defined in
the Zcash protocol specification [^protocol-blockchain].

The term "network upgrade" in this document is to be interpreted as described in
ZIP 200. [^zip-0200]

The character § is used when referring to sections of the Zcash Protocol
Specification. [^protocol]

The terms "v7 transaction", "bundle", "effecting data", and "authorizing data"
are to be interpreted as described in ZIP 248. [^zip-0248]

# Abstract

This ZIP describes a mechanism for keys registered at the consensus level
to be rotated, or migrated between supported signing protocols.

A tracked signing key is a public key that is held in the global chain state
under an identifier that never changes. Each identifier has an application key,
which authorizes the actions of the ZIP that registered it (such as disbursing
from a fund, or issuing an asset), and a rotation key, which authorizes
replacing either of the two.

This ZIP defines a bundle for the v7 transaction format that carries key
rotation operations. An operation states the key state that it modifies, and is
signed by both the current rotation key and the new key.

Tracked signing keys, and every rotation of them, are public.

# Motivation

Most Zcash funds are controlled by "off-chain" signing keys, where a user
controls some signing key authorizing spends. The consensus rules allow the
keyholder to rotate these keys at any time, by sending funds to a new address
(possibly in a different wallet).

In a few recent ZIPs [^zip-1016] [^zip-0227], a second category of key
management has been defined: consensus-tracked signing keys. Whether they are
initially defined by consensus rules in a network upgrade or registered via a
trust-on-first-use mechanism, from that point onward the consensus rules
enforce that a specific key is used to authorize relevant on-chain actions.

There are several reasons why the ability to rotate these keys is necessary:

* For multisig-controlled signing keys, it can be necessary, for operational
  reasons or in response to governance decisions, to change the set of parties
  with authority to act as a signer. Some multisig protocols (including FROST
  [^frost]) support refreshing key material, changing the signing keys without
  altering the corresponding public key, but that does not provide a rotation
  capability because the old key material can still be used to authorize
  actions.
* If there is concern that a particular signing protocol could be insecure, and
  the ZIP(s) using that protocol support an alternative signing protocol,
  having the capability to rotate tracked signing keys to the new protocol
  means that users can choose to do so before any insecurity in the original
  protocol can be exploited. Defining a general mechanism to support this
  avoids each ZIP needing to provide its own migration pathway.

Funding Stream addresses are also hard-coded into consensus, but rotation of
these addresses is outside the scope of this ZIP.

Two facilities define, or are proposed to define, authorization keys in
consensus:

* The Coinholder-Controlled Fund introduced by the Community and Coinholder
  Funding Model ZIP [^zip-1016] is administered by the Key-Holder
  Organizations. That ZIP requires the fund to be held in a multisig that
  resists compromise of some of the parties' keys, in which no single party's
  non-cooperation or loss of keys can lock the funds up unrecoverably. A
  disbursement key that is fixed by the consensus rules [^zip-0272] can meet
  both requirements only if it can be replaced without a network upgrade. A
  change to the set of Key-Holder Organizations has already been proposed.
  [^draft-keyholders]
* Each ZSA Issuer has an issuance authorizing key [^zip-0227-issuer] that it
  uses to authorize asset issuance. The corresponding validating key identifies
  the issuer, and is part of the identifier of every asset that the issuer
  creates. If that key is compromised, the issuer can only finalize those
  assets and issue new ones under a new identifier.

It would be beneficial for this mechanism to support rotation of both of these
key types, and any similar key types defined by future facilities of the Zcash
consensus protocol.

## Use cases

### Small-scale single issuer (e.g. toy usage)

- Each issued asset uses `ik` as both the issuance key and rotation key (per default)
- User's backup includes `isk` (or its derivation root)
- If both consensus and the wallet is upgraded to prefer ML-DSA, then the
  wallet can migrate the user's assets to ML-DSA by deriving `ik_ML-DSA` (or
  generating and backing it up), then creating a single key rotation bundle
  that:
    - Rotates issuer `ik`'s issuance key from `ik` to `ik_ML-DSA`
    - Rotates issuer `ik`'s rotation key from `ik` to `ik_ML-DSA`

### ZSA asset bridges

- `ik` is a FROST key shared among the bridge validators
- Rotation key is held by the bridge operator (or operators via FROST)
- Bridge operator can change the bridge validator set by rotating `ik`
- Two bridge operators can choose to use the same validator set `ik_C`:
    - Bridge operator A uses `rotation_key_A` to rotate their `ik_A` issuer to
      `ik_C` (with `ik_C`'s consent)
    - Bridge operator B uses `rotation_key_B` to rotate their `ik_B` issuer to
      `ik_C` (with `ik_C`'s consent)
    - If bridge operator A decides to unmerge, they use `rotation_key_A` to
      rotate their `ik_A` issuer to `ik_A'` (or back to `ik_A`), with the
      consent of `ik_A'` but not `rotation_key_B` or `ik_C`

### Issuer merging

An issuer can choose to transfer all of their controlled assets to another issuer, by creating a single key rotation bundle that:
- Rotates issuer `ik_A`'s issuance key from `ik_A` to `ik_B`, authorized by `rotation_key_A` and `ik_B`
- Rotates issuer `ik_A`'s rotation key from `rotation_key_A` to `rotation_key_B`, authorized by `rotation_key_A` and `rotation_key_B`
- Issuer B now can issue all of issuer `ik_A`'s assets, without knowledge of `ik_A` (but needs to continue to use `ik_A` as the identifier for those assets due to how `assetDigest` is defined)

# Privacy Implications

The mechanisms defined in this ZIP are only suitable for rotation of keys that
are publically visible in the state of the consensus protocol.

Every key rotation operation is public. It links the new key to the keys that
it replaces, and to every action authorized under the same identifier. The fee
paid by its transaction links the key holders to the funds that paid it, unless
those funds are shielded.

A threshold signature scheme that produces ordinary signatures, such as FROST
[^frost], reveals neither the threshold nor which of the parties signed.

# Requirements

- The mechanism must support both keys that are initially hard-coded in
  consensus rules, and keys that are "register on first use".
- The key rotation mechanism must not impose any additional requirements
  beyond those of the signature scheme for the public key used to verify
  the rotation being authorized.
- The mechanism should be able to accommodate future signing protocols.
- Public keys that are incidentally the same but used for different purposes
  should not accidentally be rotated together.
- A key cannot become a tracked signing key without the consent of its holder.
- A key rotation that was authorized on the basis of one set of keys cannot
  take effect after any of those keys has changed.
- Signatures by tracked signing keys can be validated without access to chain
  state, and a full validator can track the keys with a constant number of
  state lookups and updates per signature or key rotation.

# Non-requirements

- This ZIP does not address rotation of spending keys associated with user
  addresses. If users need to rotate spending keys (for example if a wallet
  seed is compromised), it is recommended to transfer all funds out of the
  wallet into a new wallet, and to inform counterparties that the old addresses
  should no longer be used.
- If a threshold signature scheme is used, the threshold need not be
  consensus-visible.
- This ZIP does not provide a way to recover when a rotation key is lost, or to
  remove a tracked signing key. Either requires a network upgrade.

# Specification

## Tracked signing keys

A tracked signing key is a public key that is held in the global chain state,
and that full validators use to validate signatures in any transaction that
refers to it. These are distinct from untracked (normal) signing keys, which
are provided by transactions themselves, and are only used within the context
of validating that single transaction.

Each tracked signing key has an associated `protocol_type`, identifying the
signing protocol that the key is for. Tracked signing keys MUST use a protocol
type defined in this ZIP. The encoding `TrackedKey` of a tracked signing key is
its `protocol_type` as a single byte, followed by its public key.

The following protocol types are currently valid in consensus:

| `protocol_type` | Signing protocol                                                                             | Public key | Signature |
|-----------------|----------------------------------------------------------------------------------------------|------------|-----------|
| `0x00`          | BIP 340 [^bip-0340]                                                                          | 32 bytes   | 64 bytes  |
| `0x01`          | RedPallas, as instantiated for Orchard spend authorization [^protocol-concretespendauthsig] | 32 bytes   | 64 bytes  |

A signature over a 32-byte message is *valid for* a tracked signing key if:

* for BIP 340, the `Verify` algorithm of BIP 340 succeeds for that public key,
  message, and signature;
* for RedPallas, the public key is the encoding of a validating key
  $\mathsf{vk}$ of $\mathsf{SpendAuthSig^{Orchard}}$, and
  $\mathsf{SpendAuthSig^{Orchard}.Validate_{vk}}$ returns $1$ for that message
  and signature.

Protocol types, and the key usages defined below, are allocated by the ZIP
Editors. A ZIP that needs a new one specifies it as a modification to the
corresponding table in this ZIP.

## Key usages and key pointers

Each tracked signing key has an associated `key_usage`, specifying which
sub-protocol (within the overall Zcash protocol) it is used within, and a key
identifier `key_id` that identifies it within that usage. The pair
`(key_usage, key_id)` is a *key pointer*. A key pointer does not change when
its keys are rotated.

The set of defined key usages for tracked signing keys is as follows:

| `key_usage` | Defining ZIP                            | `key_id`                           |
|-------------|-----------------------------------------|------------------------------------|
| `0x01`      | ZIP 272: Consensus accounts [^zip-0272] | The 32-byte `consensus_account_id` |
| `0x02`      | ZIP 227: ZSA issuance [^zip-0227]       | The 33-byte `issuer`               |

`key_id` is treated as an opaque byte sequence within the context of this ZIP.
The ZIP that defines a key usage specifies:

* the length of `key_id`, which is the same for every key pointer of that
  usage;
* how its key pointers are registered (see [Key registration]);
* which signatures are validated against the application key;
* the protocol types that it permits for the application key, if it does not
  permit all of them.

That ZIP SHOULD require a transaction containing a signature by an application
key to state the key pointer and the key that the signature was made for, with
a consensus rule that the stated key is the current application key. The
signature can then be validated without access to chain state.

## Key state

The global chain state is extended with a map from key pointers to key states.
A key state is a pair of tracked signing keys:

* `application_key` is the public key used to authorize subprotocol operations,
  such as ZSA issuance or disbursement from a consensus account;
* `rotation_key` is the public key used to authorize rotations of both
  `application_key` and `rotation_key`.

The two MAY be the same key, and the rotation key MAY be of any protocol type.
The encoding `KeyState` of a key state is the encoding of `application_key`
followed by that of `rotation_key`.

An entry is added to this map only by [Key registration], and is modified only
by [Key rotation operations]. Entries are never removed.

## Key registration

Registering a key pointer adds an entry for it to the map of key states.
Registration MUST NOT replace an existing entry.

The ZIP that defines a key usage specifies how its key pointers are registered,
in one or both of the following ways:

* By consensus rule. The key pointer and its key state are constants of the
  consensus rules, and the entry is added at a specified block height, before
  any transaction of that block is processed.
* By transaction. A bundle defined by that ZIP registers a key pointer when it
  is processed, with a key state determined by the bundle's effecting data.
  That ZIP MUST require the transaction to contain a signature that is valid
  for each key of the registered key state.

## Key rotation bundle

This ZIP defines the key rotation bundle, a bundle type for the v7 transaction
format. [^zip-0248] Its bundle type identifier $\mathsf{KeyRotationBundleId}$
is to be allocated in the bundle type registry of ZIP 248
[^zip-0248-registry], and its only variant is `bundleVariant = 0`. The bundle
moves no value, and so has no entry in `mValuePoolDeltas`.

A transaction that has an entry for the key rotation bundle in `mEffectBundles`
MUST also have one in `mAuthBundles`.

### Key rotation effecting data

| Bytes  | Name            | Data Type                    | Description                                             |
|--------|-----------------|------------------------------|---------------------------------------------------------|
| varies | `nKeyRotations` | `compactSize`                | The number of key rotation operations. MUST be nonzero. |
| varies | `vKeyRotations` | `KeyRotation[nKeyRotations]` | The key rotation operations.                            |

#### KeyRotation

| Bytes  | Name        | Data Type    | Description                                                                         |
|--------|-------------|--------------|-------------------------------------------------------------------------------------|
| 1      | `keyUsage`  | `uint8`      | The `key_usage` of the key pointer.                                                 |
| varies | `keyId`     | `byte[]`     | The `key_id` of the key pointer, of the length specified for `keyUsage`.            |
| 1      | `keyRole`   | `uint8`      | The key to be replaced: `0x00` for `application_key`, or `0x01` for `rotation_key`. |
| varies | `prevState` | `KeyState`   | The key state that this operation modifies.                                         |
| varies | `newKey`    | `TrackedKey` | The key that replaces the one selected by `keyRole`.                                |

`keyUsage` MUST be a defined key usage, `keyRole` MUST be `0x00` or `0x01`, and
the `protocol_type` of each of the three keys MUST be a defined protocol type.
With the protocol types defined above, a `TrackedKey` is 33 bytes and a
`KeyState` is 66 bytes.

### Key rotation authorizing data

| Bytes  | Name                | Data Type                        | Description                                                                        |
|--------|---------------------|----------------------------------|------------------------------------------------------------------------------------|
| varies | `vKeyRotationAuths` | `KeyRotationAuth[nKeyRotations]` | The signatures for each operation, in the same order as `vKeyRotations`.          |

#### KeyRotationAuth

| Bytes  | Name              | Data Type             | Description                                                                     |
|--------|-------------------|-----------------------|---------------------------------------------------------------------------------|
| varies | `rotationAuthSig` | `TrackedKeySignature` | A signature by the `rotation_key` of `prevState`, authorizing the operation.    |
| varies | `newKeySig`       | `TrackedKeySignature` | A signature by `newKey`, showing that its holder can sign with it and consents. |

#### TrackedKeySignature

| Bytes             | Name              | Data Type               | Description                                                                                        |
|-------------------|-------------------|-------------------------|----------------------------------------------------------------------------------------------------|
| varies            | `sizeSighashInfo` | `compactSize`           | The size in bytes of `sighashInfo`.                                                                |
| `sizeSighashInfo` | `sighashInfo`     | `byte[sizeSighashInfo]` | The sighash variant and associated information, as defined in ZIP 248.                             |
| varies            | `signature`       | `byte[]`                | A signature, of the length specified for the `protocol_type` of the key it is to be valid for.    |

Sighash variant 0 is the only variant defined for the key rotation bundle, and
its `associatedData` is the empty byte string. Both signatures in
`vKeyRotationAuths[i]` are over the digest defined in ZIP 248, 'Variant 0
Signature Digest' [^zip-0248-sigdigest], with
$\mathsf{bundleType} = \mathsf{KeyRotationBundleId}$, `bundleVariant = 0`, and
`signature_context` set to the two-byte unsigned little-endian encoding of $i$.

### Key rotation digests

The `bundle_effects_digest` of the key rotation bundle is a BLAKE2b-256 hash of
the encodings of the elements of `vKeyRotations`, concatenated in order. The
personalization field of this hash is set to:

    "ZTxIdKeyRot_Hash" (1 underscore character)

The `bundle_auth_digest` of the key rotation bundle is a BLAKE2b-256 hash of
the encodings of the elements of `vKeyRotationAuths`, concatenated in order.
The personalization field of this hash is set to:

    "ZTxAuthKeyRoHash"

## Key rotation operations

Full validators process the key rotation bundle of a transaction after its
other bundles. Those bundles are therefore validated against the key states as
they were before the transaction's own key rotations, and a key pointer
registered by a transaction can be rotated by the same transaction.

The operations of a key rotation bundle are processed in order. For the
operation `vKeyRotations[i]`, a full validator MUST reject the transaction
unless all of the following hold:

1. The key pointer `(keyUsage, keyId)` has an entry in the map of key states,
   and that entry is equal to `prevState`.
2. The signature in `rotationAuthSig` is valid for the `rotation_key` of
   `prevState`.
3. The signature in `newKeySig` is valid for `newKey`.
4. If `keyRole` is `0x00`, the protocol type of `newKey` is one that the key
   usage permits for the application key.

It then replaces the key selected by `keyRole` in that entry with `newKey`.

## Changes to ZIP 248

In the section 'v7 Transaction Bundle Type Registry' [^zip-0248-registry], add
the following row, and remove the row for key rotation from 'Potential Future
Bundle Types':

| BundleType | BundleVariant | `mValuePoolDeltas` | `mEffectBundles` | `mAuthBundles` | Defining ZIP | Bundle kind  |
|------------|---------------|--------------------|------------------|----------------|--------------|--------------|
| TBD        | 0             | ❌                 | ✅               | ✅             | ZIP 270      | Key rotation |

# Rationale

## Rationale for the key state

Key states are looked up only by key pointer, never by key, so a full validator
needs no index from keys to the key pointers that use them and no links between
key states. A key that is used by several key pointers is rotated in each by a
separate operation, which keeps keys that are incidentally the same from being
rotated together.

Separate key usages enable independent rotation. For example, if a Key-Holder
Organization accidentally uses its disbursement key to issue an asset, it can
recover from that mistake.

The rotation key is part of the key state, not a tracked signing key with a key
pointer of its own, so that it needs no rotation key in turn.

Protocol type `0x00` is BIP 340 because ZIP 227 already uses that byte for it.
The `issuer` of ZIP 227 is therefore the `TrackedKey` encoding of an issuer's
first issuance validating key.

## Rationale for stating the previous key state

An operation that named only the new key would remain valid for as long as the
rotation key was unchanged. If a rotation key's holders signed one rotation of
the application key and later a different one, anyone holding the first
transaction could still have it mined after the second, replacing the key that
the holders chose with one that they had abandoned. With `prevState`, an
operation takes effect only on the key state that its signers saw.

It also puts both of the keys that an operation's signatures are validated
against in the transaction, so signature validation needs no chain state and
can be batched. What depends on chain state is one comparison. A full validator
can store the map of key states as one record per key pointer, which an
operation checks by comparing it with `prevState`, applies by overwriting one
of its two keys, and rolls back by writing `prevState` back, with no undo data.

## Rationale for the signatures

The new key signs so that a key state cannot be changed to a key that nobody
can sign with, which would leave it unusable or unrotatable until a network
upgrade, and so that actions such as asset issuance cannot be attributed to a
key whose holder did not agree to it.

Both signatures commit to the transaction identifier, and to the position of
the operation in the bundle. A transaction can be mined only once: a v7
transaction that is not a coinbase transaction spends a transparent output or
reveals a nullifier (§ 7.1.2 'Transaction Consensus Rules'
[^protocol-txnconsensus] as modified by ZIP 248), and a coinbase transaction
commits to its block height. A key rotation therefore cannot be replayed, even
if later operations restore the key state that it applied to. Until it is
mined, it stays valid while the key state equals its `prevState`; signers bound
this with the transaction's expiry height.

## Rationale for replacing one key per operation

A sequence of operations that each replace a single key is equivalent to one
operation with optional fields, without the need to define which fields are
present, and each operation carries exactly two signatures. It also allows the
rotation key concept to be extended in future, for example to permit multiple
rotation keys, without a transaction format change.

Processing the key rotation bundle after a transaction's other bundles allows
an issuer to register a key and give it a separate rotation key in a single
transaction.

## Prior art

The `did:plc` method used by Bluesky [^did-plc] solves a similar problem for
account identities. As in this ZIP, an identifier is derived from the initial
operation and never changes, rotation keys are distinct from the keys used for
signing, and each operation names the one that it supersedes.

Unlike this ZIP, `did:plc` does not require a new key to sign. It also gives an
identifier up to five rotation keys in order of authority, and lets a
higher-authority key replace operations signed by a lower-authority one within
72 hours. This ZIP does not adopt that recovery window, which would make the
outcome of a key rotation, and of every action authorized by the new key,
provisional for its length.

# Open issues

* The bundle type identifier needs to be allocated in the ZIP 248 registry.
* ZIP 317 [^zip-0317] does not yet say how key rotation operations contribute
  to the conventional fee.
* ZIP 227 does not yet define its key usage: registering the key pointer of an
  issuer by its first issuance, and stating the current issuance validating
  key in later issuance bundles separately from `issuer`.

# Deployment

TBD. This ZIP can only be deployed with or after the v7 transaction format.
[^zip-0248]

# Reference implementation

TBD

# References

[^BCP14]: [Information on BCP 14 — "RFC 2119: Key words for use in RFCs to Indicate Requirement Levels" and "RFC 8174: Ambiguity of Uppercase vs Lowercase in RFC 2119 Key Words"](https://www.rfc-editor.org/info/bcp14)

[^protocol]: [Zcash Protocol Specification, Version 2026.8.0 [NU6.3] or later](protocol/protocol.pdf)

[^protocol-blockchain]: [Zcash Protocol Specification, Version 2026.8.0 [NU6.3]. Section 3.3: The Block Chain](protocol/protocol.pdf#blockchain)

[^protocol-concretespendauthsig]: [Zcash Protocol Specification, Version 2026.8.0 [NU6.3]. Section 5.4.7.1: Spend Authorization Signature (Sapling and Orchard)](protocol/protocol.pdf#concretespendauthsig)

[^protocol-txnconsensus]: [Zcash Protocol Specification, Version 2026.8.0 [NU6.3]. Section 7.1.2: Transaction Consensus Rules](protocol/protocol.pdf#txnconsensus)

[^zip-0200]: [ZIP 200: Network Upgrade Mechanism](zip-0200.rst)

[^zip-0227]: [ZIP 227: Issuance of Zcash Shielded Assets](zip-0227.rst)

[^zip-0227-issuer]: [ZIP 227: Issuance of Zcash Shielded Assets — Issuer Identifier](zip-0227.rst#issuer-identifier)

[^zip-0248]: [ZIP 248: Extensible Transaction Format](zip-0248.rst)

[^zip-0248-registry]: [ZIP 248: Extensible Transaction Format — v7 Transaction Bundle Type Registry](zip-0248.rst#v7-transaction-bundle-type-registry)

[^zip-0248-sigdigest]: [ZIP 248: Extensible Transaction Format — Variant 0 Signature Digest](zip-0248.rst#variant-0-signature-digest)

[^zip-0272]: [ZIP 272: Zcash Consensus Accounts](https://github.com/zcash/zips/pull/1162)

[^zip-0317]: [ZIP 317: Proportional Transfer Fee Mechanism](zip-0317.rst)

[^zip-1016]: [ZIP 1016: Community and Coinholder Funding Model](zip-1016.md)

[^draft-keyholders]: [Draft ZIP: Update to ZIP 1016 & ZIP 271: Key-Holder Organizations](draft-mcgee-keyholders-organizations.md)

[^bip-0340]: [BIP 340: Schnorr Signatures for secp256k1](https://github.com/bitcoin/bips/blob/master/bip-0340.mediawiki)

[^frost]: [RFC 9591: The Flexible Round-Optimized Schnorr Threshold (FROST) Protocol for Two-Round Schnorr Signatures](https://datatracker.ietf.org/doc/rfc9591/)

[^did-plc]: [did:plc Method Specification v0.1](https://web.plc.directory/spec/v0.1/did-plc)
