diff --git a/docs/architecture/assets.md b/docs/architecture/assets.md index 82638b8df..d01981d71 100644 --- a/docs/architecture/assets.md +++ b/docs/architecture/assets.md @@ -41,7 +41,7 @@ If the `faucet_id` of MATIC is `2`, 100 MATIC are encoded as `[100, 0, 0, 2]`; t ### Non-fungible assets -A non-fungible asset is encoded by hashing the asset data into a `word` and then replacing the second element with the `faucet_id` of the issuing account: For example `[e0, faucet_id, e2, e3]`. Note that the second element is guaranteed to be non-zero. +A non-fungible asset is encoded by hashing the asset data into a `word` and then replacing the second element with the `faucet_id` of the issuing account: For example `[e0, faucet_id, e2, e3]`. Note that the second element is guaranteed to be non-zero. Together with the fungible asset encoding, this makes it easy to differentiate between both asset types by inspecting the second element. Examples of non-fungible assets are all NFTs, e.g., a DevCon ticket. The ticket's data might be represented in a JSON string representing which DevCon, the date, the initial price, etc. Now, users can create a faucet for non-fungible DevCon tickets. This DevCon faucet would hash the JSON string into a `word` to transform the ticket into an asset. diff --git a/docs/architecture/notes.md b/docs/architecture/notes.md index 38f93a535..ac5bbe805 100644 --- a/docs/architecture/notes.md +++ b/docs/architecture/notes.md @@ -251,7 +251,7 @@ hash(hash(hash(serial_num, [0; 4]), script_hash), input_hash) This concept restricts note consumption to those users who know the pre-image data of `RECIPIENT` - which might be a bigger set than a single account. -During the [transaction prologue](transactions/kernel.md) the users needs to provide all the data to compute the note hash. That means, one can create notes that can only be consumed if the `serial_num` and other data is known. This information can be passed on off-chain by the sender to the consumer. This is only useful with private notes.For public notes, all note data is known, and anyone can compute the `RECIPIENT`. +During the [transaction prologue](transactions/kernel.md) the users needs to provide all the data to compute the note hash. That means, one can create notes that can only be consumed if the `serial_num` and other data is known. This information can be passed off-chain from the sender to the consumer. This is only useful with private notes. For public notes, all note data is known, and anyone can compute the `RECIPIENT`. You can see in the standard [SWAP note script](https://github.com/0xPolygonMiden/miden-base/blob/main/miden-lib/asm/note_scripts/SWAP.masm) how `RECIPIENT` is used. Here, using a single hash, is sufficient to ensure that the swapped asset and its note can only be consumed by the defined target. diff --git a/docs/architecture/state.md b/docs/architecture/state.md index eb6fec7fa..093149a87 100644 --- a/docs/architecture/state.md +++ b/docs/architecture/state.md @@ -61,7 +61,7 @@ Notes are recorded in an append-only accumulator, a [Merkle Mountain Range](http ![Architecture core concepts](../img/architecture/state/note-db.png){ width="80%" } -As described in [the notes section](notes.md, there are two types of notes: +As described in [the notes section](notes.md), there are two types of notes: * Public notes where the entire note content is recorded in the state. * Private notes where only a note's hash is recorded in the state. diff --git a/docs/architecture/transactions/execution.md b/docs/architecture/transactions/execution.md index b3c11c277..e4149cc9a 100644 --- a/docs/architecture/transactions/execution.md +++ b/docs/architecture/transactions/execution.md @@ -27,7 +27,8 @@ The data store defines the interface that transaction objects use to fetch the d - `InputNotes` consumed by the transaction that include the corresponding note data, e.g. the [note script](../notes.md#the-note-script) and serial number. !!! note - - `InputNotes` must be already recorded on-chain in order for the transaction to succeed. - There is no nullifier-check during a transaction. Nullifiers are checked by the Miden operator during transaction verification. So at the transaction level, there is "double spending". + - `InputNotes` must be already recorded on-chain in order for the transaction to succeed. + - There is no nullifier-check during a transaction. Nullifiers are checked by the Miden operator during transaction verification. So at the transaction level, there is "double spending". ## Transaction compiler diff --git a/docs/architecture/transactions/overview.md b/docs/architecture/transactions/overview.md index ee1a20b26..d3e2903a7 100644 --- a/docs/architecture/transactions/overview.md +++ b/docs/architecture/transactions/overview.md @@ -59,7 +59,7 @@ Both transactions can be executed asynchronously: first `transaction1` is execut This opens up a few interesting possibilities: * Owner of `account_b` may wait until they receive many notes and process them all in a single transaction. -* A note script may include a clause which allows the source account to consume the note after some time. Thus, if `account_b` does not consume the note after the specified time, the funds can be returned. This mechanism could be used to make sure funds sent to non-existent accounts are not lost. +* A note script may include a clause which allows the source account to consume the note after some time. Thus, if `account_b` does not consume the note after the specified time, the funds can be returned. This mechanism can be used to make sure funds sent to non-existent accounts are not lost (see the [P2IDR note script](https://github.com/0xPolygonMiden/miden-base/blob/main/miden-lib/asm/note_scripts/P2IDR.masm)). * Neither sender nor the recipient need to know who the other side is. From the sender's perspective they just need to create `note1` (and for this they need to know the assets to be transferred and the root of the note's script). They don't need any information on who will eventually consume the note. From the recipient's perspective, they just need to consume `note1`. They don't need to know who created it. * Both transactions can be executed "locally". For example, we could generate a zk-proof that `transaction1` was executed and submit it to the network. The network can verify the proof without the need for executing the transaction itself. The same can be done for `transaction2`. Moreover, we can mix and match. For example, `transaction1` can be executed locally, but `transaction2` can be executed on the network, or vice-versa. diff --git a/docs/architecture/transactions/procedures.md b/docs/architecture/transactions/procedures.md index 87f807e9c..08bb80b60 100644 --- a/docs/architecture/transactions/procedures.md +++ b/docs/architecture/transactions/procedures.md @@ -8,7 +8,8 @@ There are user-facing procedures and kernel procedures. Users don't directly inv These procedures can be used to create smart contract/account code, note scripts, or account scripts. They basically serve as an API for the underlying kernel procedures. If a procedure can be called in the current context, an `exec` is sufficient. Otherwise the context procedures must be invoked by `call`. Users never need to invoke `syscall` procedures themselves. -!!! tip - If capitalized, a variable representing a `word`, e.g., `ACCT_HASH` consists of four `felts`. If lowercase, the variable is represented by a single `felt`. +!!! tip + If capitalized, a variable representing a `word`, e.g., `ACCT_HASH` consists of four `felts`. If lowercase, the variable is represented by a single `felt`. ### Account