Skip to content

Nonce cache - #223

Draft
pythcoiner wants to merge 22 commits into
odudex:masterfrom
pythcoiner:nonce_cache
Draft

pythcoiner wants to merge 22 commits into
odudex:masterfrom
pythcoiner:nonce_cache

Conversation

@pythcoiner

@pythcoiner pythcoiner commented Nov 17, 2026 •

Copy link
Copy Markdown
Collaborator

require #222 and #218

… read under the descriptor, captioned with its alias and path
… request's inputs and change under the aliases it names
…d with other signers

A PSBT with silent payment outputs gets the seed's ECDH shares and DLEQ
proofs, global when it holds every eligible input, per input otherwise.
Once the shares cover every eligible input the output scripts are derived;
until then the review shows the amounts and adds the shares alone. Our
silent payment inputs, change and self-transfers are classified, reviewed
and signed.
BIP375 has every input of a silent payment send signed with SIGHASH_ALL.
A PSBT with silent payment outputs and an explicit PSBT_IN_SIGHASH_TYPE
other than SIGHASH_ALL, SIGHASH_DEFAULT included, is refused at parse
time; an input naming no sighash type is signed with SIGHASH_ALL, the field
removed again after the signing pass.
Get Keys answers a private key only on the BIP352 scan branch,
m/352'/coin'/0'/1'/*, so a wallet can scan for the account's payments;
any other private key is refused with 0x0C. The confirmation says what the
scan key reveals, and the encoded response is wiped once shown.
…r requests name alone

Register Descriptor takes FORM 0x03 silent payment keys: our spend key
with our scan key, or with a scan key that is not ours. The alias is stored
on flash as a record the seed marks, listed in the session descriptors
settings beside the descriptors, and named alone by later Address
Verification and Signing requests. Address Verification answers the
account's base or labelled sp address, captioned with its alias and label;
Signing takes the account, a FORM 0x03 body or our own sp() descriptor,
and change paying our spend key under a scan key not ours is ours.
Get Info advertises silent payment accounts.
Unregister Descriptor also removes a silent payment account alias and its
record on flash, once the user confirms the alias, our fingerprint, our
spend key path and whether the scan key is external.
A Signing request for a silent payment send is no longer refused. The
response carries Kern's ECDH shares and DLEQ proofs beside its signatures,
and only the shares while another signer still owes one; a signed PSBT
leaves out the scripts of the silent payment outputs still pending. Get
Info advertises silent payment sends, so CAPABILITIES is 0x7F.
A musig() is taken as the tr() internal key and inside tapscript leaves,
where it is rewritten into the key it stands for before libwally parses it
and written back as it came. Its participants are the BIP138 backup's
recipients, and a registry input or output whose script a musig() of ours
generates is claimed as CLAIM_MUSIG.
Round 1 stores a new session of the nonce cache BIP draft and adds our
public nonce to each of our MuSig2 signatures, with no signature of any kind.
Round 2 takes the session, deleted durably before any partial signature is
written, and signs each one every participant's nonce is in for, the
tr() internal key on the key path and a leaf musig() on its leaf, keyed as
BIP-373 keys them. The sessions live in NVS through the bip_nonces_cache C
binding and a device wipe erases them. A PSBT naming a nonce cache session
is refused: signing from one is the nonce cache capability.
…res, advertising MuSig2

A musig() descriptor body is taken and a Signing request's PSBT is checked
for its MuSig2 step before the user is asked: a missing, consumed or
mismatched session answers 0x0D, a PSBT waiting for another participant's
nonce with nothing else of ours to sign 0x09, and a PSBT naming a nonce cache
session 0x0F, Kern not advertising the nonce cache. Our public nonces and
partial signatures are returned as SIG_KIND 0x04 and 0x05. CAPABILITIES
gains bit 7 (0xFF).
A PSBT naming a nonce cache session (PSBT_GLOBAL_NONCE_CACHE_SESSION) is
signed in one round from the session it names: the reference must match
the one the session holds, a nonce of one of our participant keys the
session did not prepare answers a session error, and the session is taken,
deleted durably before any partial signature is written. Issuance creates
or extends a session and returns the public nonces of the key at a path,
for the Nonce Preparation request to answer with.
…dvertising the nonce cache

A Nonce Preparation request (TYPE 0x06) is answered with the public nonces
of our key at its path, from the session it names or a new one whose ID is
drawn when it names none. An optional descriptor must hold that key as a
participant of one of its musig(). A missing or mismatched session answers
0x0D. CAPABILITIES gains bit 8 (0x1FF).

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant