Skip to content

chore(docs): docs keys page update#11449

Closed
sthwnd wants to merge 17 commits into
AztecProtocol:masterfrom
sthwnd:master
Closed

chore(docs): docs keys page update#11449
sthwnd wants to merge 17 commits into
AztecProtocol:masterfrom
sthwnd:master

Conversation

@sthwnd

@sthwnd sthwnd commented Jan 23, 2025

Copy link
Copy Markdown
Contributor

New version of the keys page.

@rahul-kothari rahul-kothari left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice!! Think hyperlinks are missing
content is great thanks Lisa!!

Comment thread docs/docs/aztec/concepts/accounts/keys.md Outdated
### Incoming viewing keys

During private function execution these keys are obtained via an oracle call from PXE.
The incoming viewing public key (`Ivpk`) is used by the sender to encrypt a note for the recipient. The corresponding incoming viewing secret key (`ivsk`) is used by the recipient to decrypt the note.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nt: here we use Ivpk (capital I) and later we use ivsk (small i). Do public keys usually start off with capital letters? If not can we make it consistent?
Same for esk/Epk - again maybe this is a convention I never knew

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I got from @iAmMichaelConnor – this is a convention that all secret keys start with small letter and public – with a large letter.


This also allows per-application auditability.
A user may choose to disclose their incoming and outgoing viewing keys for a given application to an auditor or regulator (or for 3rd party interfaces, e.g. giving access to a block explorer to display my activity), as a means to reveal all their activity within that context, while retaining privacy across all other applications in the network.
Address keys are used for account address derivation.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

link to approrpiate place in the docs that also talks about addresses/accounts

This mechanisms prevents double-spends, since nullifiers are checked by the protocol to be unique.
Now, in order to preserve privacy, a third party should not be able to link a note hash to its nullifier - this link is enforced by the note implementation.
Therefore, calculating the nullifier for a note requires a secret from its owner.
Thanks to the native account abstraction, authorization logic can be implemented in an alternative way using Google authorization credentials, vanilla password logic or Face ID mechanism. In all these cases signing keys are not relevant.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

link to the concept docs that talk about account abstraction on Aztec

and also backlink from that page to here, since we should talk about signing keys there too!

#### Using an immutable private note​

Used to compute tags in a tagging note discovery scheme.
Similar to using a private note, but using an immutable private note removes the need to nullify the note on every read. This generates no nullifiers and commitments per transaction. However, it does not allow the user to rotate their key if they lose it.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add the code snippet like you did with is_valid_impl

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

are you thinking to add a code snippet about private immutable, like this? or like the public key note like this?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

former!


Usually, an account contract will validate a signature of the incoming payload against a known signing public key.
:::note
By Shared Mutable we mean privately readable publicly mutable state.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

link to shared mutable in docs

### Keys derivation

Similar to using a private note, but using an immutable private note removes the need to nullify the note on every read. This generates less nullifiers and commitments per transaction, and does not enforce an order across transactions. However, it does not allow the user to rotate their key should they lose it.
All key pairs are derived using elliptic curve public-key cryptography on the [Grumpkin curve](https://hackmd.io/@aztec-network/ByzgNxBfd#2-Grumpkin---A-curve-on-top-of-BN-254-for-SNARK-efficient-group-operations). Where the secret key is represented as a scalar and the public key is represented as an elliptic curve point multiplied by that scalar.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we check that the hackMD is accessible publicly?
Better yet can we just move it to this doc rather than hyperlinking to some hgackMD?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed for GitHub repo link instead. Doesn't seem relevant to introduce the definition of EC here.

The address private key is an exception and derived in a way described above in the section “Address keys”.

A compromise between the two solutions above is to use shared state. This would not generate additional nullifiers and commitments for each transaction while allowing the user to rotate their key. However, this causes every transaction to now have a time-to-live determined by the frequency of the mutable shared state, as well as imposing restrictions on how fast keys can be rotated due to minimum delays.
### The special case of escrow contracts

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

beautiful <3

public_keys_hash := poseidon2("az_public_keys_hash", Npk_m, Ivpk_m, Ovpk_m, Tpk_m)
address := poseidon2("az_contract_address_v1", public_keys_hash, partial_address)
```
App-siloed keys are derived in PXE every time the user interacts with the application.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mention siloing derivation? Or hyperlink ot protocol page where we have it

@critesjosh critesjosh changed the title Chore: docs keys page update chore(docs): docs keys page update Jan 30, 2025
Comment thread docs/docs/aztec/concepts/accounts/keys.md Outdated
Above we mentioned that the notes typically contain `Npk_m`.
It might seem like a mistake given that the notes are nullified with `nsk_app`.
This is intentional and instead of directly trying to derive `Npk_m` from `nsk_app` we instead verify that both of the keys were derived from the same `nsk_m` in our protocol circuits.
Address keys are a pair of keys `AddressPublicKey` and `address_sk` where `address_sk` is a scalar defined as `address_sk = pre_address + ivsk` and `AddressPublicKey` is an elliptic curve point. `pre_address` can be thought of as a hash of all account’s key pairs and functions in the account contract: `pre_address := poseidon2(public_keys_hash, partial_address)` where `partial_address := poseidon2(contract_class_id, salted_initialization_hash)` and `public_keys_hash := poseidon2(Npk_m, Ivpk_m, Ovpk_m, Tpk_m)`.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the relationship between the address_sk and the AddressPublicKey point? Is it just AddressPublicKey = address_sk * G?

@sthwnd sthwnd Jan 31, 2025

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, that's correct. I added it explicitely.

Comment thread docs/docs/aztec/concepts/accounts/keys.md Outdated

This also allows per-application auditability.
A user may choose to disclose their incoming and outgoing viewing keys for a given application to an auditor or regulator (or for 3rd party interfaces, e.g. giving access to a block explorer to display my activity), as a means to reveal all their activity within that context, while retaining privacy across all other applications in the network.
### Address keys

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It might be good to move this section above the section on 'Incoming view keys' since you explain where address_sk and AddressPublicKey come from in here, and you reference them above.

sthwnd and others added 4 commits January 31, 2025 11:00
Co-authored-by: josh crites <jc@joshcrites.com>
Co-authored-by: josh crites <jc@joshcrites.com>
@critesjosh

Copy link
Copy Markdown
Contributor

closing in favor of #11665

@critesjosh critesjosh closed this Jan 31, 2025
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.

4 participants