0xMiden / 0xMiden/rust-sdk

Automate the submission of note scripts for public ntx notes

Ouverte
#1,457 2 commentaires 0 réactions 0 personnes assignées Voir sur GitHub
Langage dominant
Rust
Étoiles
78
Forks
129
Merge moyen
4 j 14 h
PR mergées (30 j)
52

Description

> From the user's standpoint the process should be relatively simple:
>
> - To add a note script to this "registry" they'd need to execute one transaction that created a public note with the script they care about (this needs to be done once per script and could be done by the app developer).
>
> Continuing the excellent thread by @partylikeits1983 [on Slack](https://midengroup.slack.com/archives/C08VBMR0JP2/p1761045805054059):
> I think this could lead to a particularly obscure DevEx if not abstracted well. Specifically, if _Note A_ directed at a ntx account were to create a previously-unseen note, the transaction that creates _Note A_ would succeed from the users' point of view. However, it would later fail at the ntx transaction builder, with the details (logs) only available to us on the node, making it near impossible to debug for the users/developers.
>
> A good abstraction on the client that handles the scenario of ntx transactions creating public notes would look like:
> 1. Client detects that a note created by the user is for a ntx account (presumably by the `NoteTag` prefix?)
> 2. Client dry-runs this transaction, and sees that it would create a public output note.*
> 3. Client queries the node to see if this note's script is available in the registry.
>
> If it is available, proceed as normal.
> If it is not available, the client effectively needs to do something equivalent to a `POST /add_note_script_to_registry` request to the node. However, due to spam concerns, this needs gatekeeping and is likely best achieved at the protocol level. Namely, as mentioned above, the client would have to "execute one transaction that created a public note with the script they care about".
> One optimization here: I don't think this needs to be a **separate** transaction: we can extend the transaction script to output the desired note (`TransactionRequestBuilder::own_output_notes`) and just create one transaction.
>
> I'm not a huge fan of creating an output note just for the purpose of registering its script. For one, it's an anti-pattern for using notes in Miden. Then there might be unforeseen security implications we might need to think about: can such an "empty" note be exploited?
> While there are mechanisms that let users add note scripts to the node's registry (e.g. API-key - based), atm I can't convince myself of a better solution than what was originally suggested^, but I wanted to at least mention that there might be alternatives in case others have better ideas for populating the note script registry outside the protocol.
>
> ---
>
> *How the client dry-runs a transaction where the network account consumes the note is not implemented AFAIK. It's still unclear to me how this would be done, but likely along the lines of running the ntx transaction builder locally.

_Originally posted by @mmagician in [#1748](https://github.com/0xMiden/miden-base/issues/1748#issuecomment-3428269948)_

Guide de contribution

Ouvrir le guide de contribution

Évaluation

Cette issue n'a pas encore été évaluée.

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.