Keys, nonces and rotation
The wallet does not keep one key for a public account: every transaction it signs names a fresh key for the account’s next nonce, and the chain tracks only the current one. Per-nonce rotation came with bunker mode: the chain stores only a hash of the current public key, and the key itself appears only beside a signature (lee/state_machine/src/signature/schnorr.rs). Since the wallet never signs twice with one key, a public key it has revealed on chain is already retired and no longer controls the account.
What a public account is
You hold one 32-byte secret, and the wallet derives a key pair per nonce from it.
The account id is fixed for life, derived from the nonce-0 key alone:
id = SHA256(prefix ‖ SHA256(type prefix ‖ commitment of the nonce-0 key))
That is a double hash with a per-key-type prefix, AccountId::for_initial_key (lee/state_machine/core/src/account.rs). Every stored key names its scheme, a KeyType (lee/state_machine/core/src/signing_key.rs): the list is append-only and holds only Schnorr today, so more schemes can be added later.
Because the id commits to the first key and nothing else, rotation changes what signs without changing where you are.
Where the current key lives
In an actor state. The signature system program holds each account’s current key type and a commitment to its signing key, written at settlement (lee/state_machine/core/src/signing_key.rs, applied in lee/state_machine/src/state/mod.rs). There is no guest code behind that program: it exists to own that state.
So “what key does this account use now” is a state read, not something you can compute from the id.
Watching it happen
--scope all prints the signature program’s record alongside the balance, captured on a local devnet:
$ wallet account get --scope all --account-id Public/7VDm7YRP...
Balance 9999944009032, nonce 9
Record of program 4bfm5whUyngutaHD2uj1kwa6PWtKK6U7URfwq3vHypry
00e927d53f9453e95c048342959d29e116b739e9d263f686a9aecbb9f3bfe00d5d
Send one transaction from it:
$ wallet auth-transfer send --from Public/7VDm7YRP... --to alice --amount 1
Transaction hash is 34bbded2aa32730d4f8b9f84a383c52b5537c5529829f1da1893f3dbb96eb8fd
Transaction is included in block 590
Then read it again:
$ wallet account get --scope all --account-id Public/7VDm7YRP...
Balance 9999944004599, nonce 10
Record of program 4bfm5whUyngutaHD2uj1kwa6PWtKK6U7URfwq3vHypry
005cf79f6021860f8401a84798f0398260c28b4e71647b3dd38a64a24727427a0d
The nonce went from 9 to 10 and the key changed from 00e927d5… to 005cf79f…, while the account id did not move. The next signature is checked against that record, held by the signature program 4bfm5whU…, so rotation needs no announcement: it is a state transition like any other. It happens even when a transaction reverts after its fee is charged: the effects are dropped, but every signer’s key rotates and its nonce advances.
What a transaction carries
One witness entry per public signer, in the same order as nonces (Public transactions). This public witness is signature data, unrelated to the private witness a private account’s owner hands the prover. Each entry holds that signer’s authentication data and a commitment to its next key, and every signer signs a message that covers the transaction plus all signers’ next key commitments together (lee/state_machine/src/transaction_message.rs).
Entries pair with nonces positionally and carry no account id of their own, so a count that does not match the signers is refused outright, and an entry in the wrong position fails authentication rather than a name check. A signature also commits to the next key, so you cannot sign now and decide later what the account rotates to.
Signatures also cover the zone id, a hash of the zone’s L1 channel id and its genesis, so the same transaction cannot be replayed on another zone (The zone a signature is for).
What this breaks
The protocol accepts a next key equal to the current one, but the wallet derives a fresh key for every nonce, which hardware holding one fixed key cannot do, so the wallet refuses Keycard accounts outright with Keycard accounts are not supported: a Keycard key cannot rotate.
An initial key is also how a never-used account is admitted: you pay one with --to-initial-key, and name one in wallet program call as ik:<hex>. An account that has transacted is addressed by its id as usual.
Sending several transactions at once
Because each signature commits to the next key, a queue of transactions from one account is a chain, not a set. The mempool enforces that:
- one pending transaction per account and nonce, and the first one seen wins
- a transaction whose nonce is ahead of the account’s is admitted only on top of a pending one, and only against the key that pending transaction commits to
- at most
mempool_max_per_accountof them, 16 by default (lez/sequencer/core/src/config.rs)
So build a batch in order, against the keys each step rotates to. Submitted out of order, the later ones are refused rather than queued.