diff --git a/docs/architecture/notes.md b/docs/architecture/notes.md index 7f3b081d9..38f93a535 100644 --- a/docs/architecture/notes.md +++ b/docs/architecture/notes.md @@ -2,11 +2,11 @@ comments: true --- -Two of Miden's key goals are parallel transaction execution and privacy. +Two of Miden's key goals are parallel transaction execution and privacy. -Polygon Miden implements a hybrid UTXO and account-based [state model](state.md) which enforces these goals with notes. Notes interact with, and transfer assets between, accounts. They can be consumed and produced asynchronously and privately. +Polygon Miden implements a hybrid UTXO and account-based [state model](state.md) which enforces these goals with notes. Notes interact with, and transfer assets between, accounts. They can be consumed and produced asynchronously and privately. -The concept of notes is a key divergence from Ethereum’s account-based model. +The concept of notes is a key divergence from Ethereum’s account-based model. ## Note design @@ -23,11 +23,11 @@ The concept of notes is a key divergence from Ethereum’s account-based model. ## Note lifecycle -New notes are created by executing transactions. +New notes are created by executing transactions. -After verifying the transaction proof the operator adds either only the note hash (private notes) or the full note data (public notes) to the note database. +After verifying the transaction proof the operator adds either only the note hash (private notes) or the full note data (public notes) to the note database. -Notes can be produced and consumed locally by users in local transactions or by the operator in a network transaction. +Notes can be produced and consumed locally by users in local transactions or by the operator in a network transaction. Note consumption requires the transacting party to know the note data to compute the nullifier. After successful verification, the operator sets the corresponding entry in the nullifier database to "consumed". @@ -35,11 +35,11 @@ Note consumption requires the transacting party to know the note data to compute ![Architecture core concepts](../img/architecture/note/note-life-cycle.png) -## Note creation +### Note creation Notes are created as the outputs (`OutputNotes`) of Miden transactions. Operators record the notes to the [note database](state.md#note-database). After successful verification of the underlying transactions, those notes can be consumed. -## The note script +### The note script Every note has a script which gets executed at note consumption. It is always executed in the context of a single account, and thus, may invoke zero or more of the [account's functions](accounts.md#code). The script allows for more than just asset transfers; actions which could be of arbitrary complexity thanks to the Turing completeness of the Miden VM. @@ -52,11 +52,10 @@ There are [standard note scripts](https://github.com/0xPolygonMiden/miden-base/t * P2ID and P2IDR scripts are used to send assets to a specific account ID. The scripts check at note consumption if the executing account ID equals the account ID that was set by the note creator as note inputs. The P2IDR script is reclaimable and thus after a certain block height can also be consumed by the sender itself. * SWAP script is a simple way to swap assets. It adds an asset from the note into the consumer's vault and creates a new note consumable by the first note's issuer containing the requested asset. -!!! info "Example note script pay to ID (P2ID)" - Want to know how to ensure a note can only be consumed by a specified account?