Replies: 2 comments 6 replies
-
|
I think this is an interesting and well-thought through proposal. Thank you for describing it so clearly! The part I'm primarily thinking about is the premise that nullifier trees are growing constantly. If we can solve this differently, e.g. conceptually have a new nullifier tree every x months or something like that, would implementing this proposal still make sense? Or in other words, is there a second motivation? So, at first glance, if we could solve the nullifier growth at a more fundamental level, so it does not only slow down but is somehow reset at regular intervals, this would benefit the Miden protocol at large. |
Beta Was this translation helpful? Give feedback.
-
|
This seems reasonable though I question this assumption
My understanding was that network notes (and therefore network transactions) can be consumed (and produced) by anyone. Right now we have restricted it so that network transactions can only be produced internally within the node, but this is an artificial limitation which we were planning on removing. Network notes & transactions look like they'll feature centrally in the bridging design as well, so iiuc it must be possible for anyone to create them. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
TL;DR
network_note_idwith value as{empty / created / spent}0. Intro
Triggered by the discussion around
NoteTag/NoteAttachmentin #2109, I kept coming back to the split between local and network notes:While some ideas in #2109 already push in the direction of some separation via
NoteTypeand separate metadata structs, I think we could take this a step further and treat these as two distinct note classes at the protocol level, most importantly with distinct double-spend protection mechanisms.The key motivation is to reduce the growth rate of the nullifier tree by not inserting nullifiers for network notes.
This discussion is somewhat complementary to #2109. It would function sort of like a Bitcoin-style UTXO set for network notes - but with a cryptographically backed data structure (SMT), so its root can be included in the L2 state commitment succinctly.
1. Motivation / observations
From reviewing #2109:
There is a lot of structure that’s shared between local and network notes:
NoteTagfor discovery & routing.NoteAttachmentas a general mechanism to carry extra data.But there are also obvious differences:
Right now, both note families share the same data structures:
This is simple and uniform, but has two downsides:
But network notes need neither of these two properties.
2. Recap: why the current model works well for local notes
Just to restate the local note side, because it’s important for what follows:
nullifier ∉ NullifierDBbefore block, then insert it.So to consume a note, the user needs, among other things:
The local tx proof proves inclusion in Note DB + correct nullifier computation; then at block construction the protocol handles the nullifier part (non-membership + finally the insertion into the Nullifier DB).
3. Proposal: explicit separation of Local vs Network notes
The high-level idea:
So we’d end up with four top-level state commitments:
Network notes would not contribute to the Nullifier DB at all ✅
As discussed in some calls, it's hard to predict what mainnet usage of network vs. local notes would look like. But it is likely that network notes will be used heavily alongside local notes, and the nullifier state growth is the one we cannot reduce.
3.1 Network Note DB structure
Data structure:
A sparse Merkle tree (SMT)
Key:
network_note_id(can use the same ID as we use today)Value:
Can be as small as an
empty/created/spentenum (SMT starts off with all keys initialized toempty)State commitment:
The root of this SMT becomes an additional state component, alongside the existing Account DB, Local Note DB (MMR), and Nullifier DB.
3.2 Network Note DB lifecycle
Creation of a network note
"empty-membership" proof in the Network Note DB (show that value under
network_note_idisempty).State transition updates leaf to:
Consumption of a network note
"created-membership" proof in Network Note DB (
network_note_id → { created })State transition updates leaf to:
Double-spend prevention
network_note_idwill seespentand fail.No nullifier is generated for network notes; the consumption is tracked directly in this SMT.
4. Why not reuse the note-ID SMT for public local notes as well?
One tempting thought: “If this works for network notes, can we use the same trick for public local notes and avoid nullifiers there too?”
We could, but we'd lose the persistent witness guarantee for public local notes, making client-side more costly due to an extra trip to the RPC needed.
5. Shared bits
Even with this split, there is still room for shared structure, e.g. for
NoteTag/NoteAttachmentthat can be used by both note families where it makes sense. As such, this proposal is somewhat complementary to #2109 as mentioned at the start.6. Open questions
Beta Was this translation helpful? Give feedback.
All reactions