Notes that deploy an Account via the ntx builder #3039
Replies: 2 comments 7 replies
-
|
The tricky part here is not how to encode the account data inside the
This flow requires that 3b. has a special meaning inside the ntx builder, s.t.:
Then 4. is processed using the existing ntx rules This is just one approach, there might be other simpler ones. In terms of complexity, it's relatively straightforward, but requires tying the ntx builder to another standard (which I think is ok, since ntx builder is already aware of the |
Beta Was this translation helpful? Give feedback.
-
|
Small update on the fees part now that #2901 / #2968 have moved along. I don't think the deploy note needs anything special here. It's just a network note, so the fee goes in the One nice side effect of @bobbinth's simplification above: if we end up adding an Still to decide: full serialized account vs component recipe (I'd start with the recipe, the 1024-felt cap makes the full version tight), and how the deploy + note consumption actually get wired into one network tx. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Problem
A note cannot create an account. Today a network transaction executes against an account that already exists and consumes notes targeted at it. There is no note type that carries account data and has the ntx builder deploy that account.
This is a proposal for a note standard that carries the data for an account. The note holds everything the ntx builder needs to build a transaction that deploys that account. The note is self-contained. The ntx builder reads it, reconstructs the account, deploys it as a new account, and consumes the note in the same transaction. No further interaction from the creator.
This is a general capability, not tied to one source. Anything that can create a note can deploy an account: a Miden transaction, or an L1 transaction through the agglayer bridge.
Use cases
CREATE2in the EVM: a note deterministically describes an account and the ntx builder deploys it.bridgeMessage/bridgeAndCall) whose payload encodes a Miden account. The bridge produces the note on Miden, and the ntx builder deploys the account. One L1 transaction, one deployed Miden account.Proposal
Add a network note type whose storage carries everything needed to deploy an account: a full serialized
Account(theSerializableform ofAccountCode+AccountStorage, plus account type, id version, and seed). The ntx builder deserializes the account from the note, validates it, deploys it as a new account (nonce 0, empty vault, valid seed), and consumes the note.The protocol-side pieces this needs:
NoteStorage. It is a public note and should be discoverable the same way other network notes are (seeis_network_noteand theNetworkAccountTargetattachment incrates/miden-standards/src/note/network_note.rs).Accountfrom the note storage and checks it against the new-account invariants the prologue already enforces (validate_new_accountinasm/kernels/transaction/lib/prologue.masm: nonce 0, empty vault, valid seed).Accountalready implementsDeserializable(crates/miden-protocol/src/account/mod.rs);AccountPatch(feat: IntroduceAccountPatchandAccountVaultPatch#3010) is the absolute new-account state representation withcode: Some(..).Account encoding
Primary approach: full serialized account data in
NoteStorage.Constraint to resolve:
NoteStorageholds at mostMAX_NOTE_STORAGE_ITEMS = 1024felts (~8 KB), andAccountCodeis anArc<MastForest>that can exceed this for non-trivial code. Fallback if the full code does not fit: encode a recipe of known standard component template ids plus init storage values, and reconstruct withAccountBuilder(crates/miden-protocol/src/account/builder/mod.rs). Faucet, multisig, and wallet are all standard components, so the recipe form covers those use cases at a fraction of the size. Decide whether to ship full-data, recipe, or both.Fees
The note must fund the network transaction. The kernel deducts the fee from the executing account vault (
compute_and_remove_feeinasm/kernels/transaction/lib/epilogue.masm), which for a network transaction is the network account, not the creator. So a deploy note needs a way to fund the fee on the network account's behalf.The path here is not decided. It should follow whatever the network-note fee model lands on. One candidate is the
FeeManagercomponent from #2901, where the note carries a fee asset and callspay_feefirst (as BURN and CLAIM do). This also overlaps with the open question of separating note business logic from fee logic, discussed in #2968. Treat the fee path as an open question to resolve against those, not as settled.Related
FeeManageraccount component for network accounts #2901 FeeManager account component for network accountsAccountPatchandAccountVaultPatch#3010 AccountPatch / AccountVaultPatchBeta Was this translation helpful? Give feedback.
All reactions