Note Changes
The note system has been redesigned. NoteMetadata no longer stores aux or NoteExecutionHint — use NoteAttachment instead.
Quick Fix
// Before
let metadata = NoteMetadata::new(sender, note_type, tag, aux, execution_hint)?;
// After
let metadata = NoteMetadata::new(sender, note_type, tag)?;
let attachment = NoteAttachment::new(aux_data, execution_hint)?;
let note = Note::new(metadata, script, inputs, attachment)?;
Note Attachments
NoteMetadata no longer stores aux or NoteExecutionHint. Use NoteAttachment instead.
- // Before: aux and hints in metadata
- let metadata = NoteMetadata::new(
- sender,
- note_type,
- tag,
- aux, // No longer here
- execution_hint, // No longer here
- )?;
+ // After: use attachments
+ let metadata = NoteMetadata::new(sender, note_type, tag)?;
+ let attachment = NoteAttachment::new(aux_data, execution_hint)?;
+ let note = Note::new(metadata, script, inputs, attachment)?;
This separation makes note metadata more lightweight and allows attachments to be optional.
Tag Semantics
NoteTag is now a plain u32. Use with_account_target() for account targeting:
- // Before: tag with embedded target
- let tag = NoteTag::from_account_id(target_account)?;
+ // After: plain tag with explicit targeting
+ let tag: u32 = 12345;
+ let note = note.with_account_target(target_account)?;
Network Account Target
Implement NetworkAccountTarget attachment for network-account notes:
use miden_protocol::notes::NetworkAccountTarget;
let target = NetworkAccountTarget::new(account_id, network_id)?;
let note = note.with_attachment(target)?;
MINT Notes
New MintNoteInputs enum supports private and public output notes:
- // Before
- let mint_note = MintNote::new(amount, recipient)?;
+ // After: explicit private/public choice
+ use miden_standards::notes::MintNoteInputs;
+
+ // For private notes
+ let inputs = MintNoteInputs::Private { amount, recipient };
+
+ // For public notes
+ let inputs = MintNoteInputs::Public { amount, recipient, metadata };
Choose MintNoteInputs::Private for most use cases. Use Public only when the note contents should be visible on-chain.
Input Notes API
Unified interface accepts full Note objects instead of IDs:
- // Before: separate authenticated/unauthenticated lists
- let tx = TransactionRequest::new()
- .with_authenticated_input_notes(auth_note_ids)
- .with_unauthenticated_input_notes(unauth_note_ids)?;
+ // After: unified input notes
+ let tx = TransactionRequest::new()
+ .with_input_notes(notes)?; // Full Note objects
FetchedNote Structure
Private notes now carry NoteHeader; public notes expose note and inclusionProof:
match fetched_note {
FetchedNote::Private { header, .. } => {
// Access header fields
let note_id = header.id();
}
FetchedNote::Public { note, inclusion_proof } => {
// Access full note and proof
let inputs = note.inputs();
}
}
Migration Steps
- Remove
auxandexecution_hintfromNoteMetadataconstructors - Create
NoteAttachmentobjects for aux data and hints - Update
NoteTagusage to plainu32values - Use
with_account_target()for targeted notes - Implement
NetworkAccountTargetfor network notes - Update mint note creation to use
MintNoteInputsenum - Refactor input notes to pass full
Noteobjects - Update
FetchedNotehandling for new structure
Common Errors
| Error | Cause | Fix |
|---|---|---|
NoteMetadata::new takes 3 arguments | aux/hint removed | Use NoteAttachment |
NoteTag::from_account_id not found | API changed | Use with_account_target() |
with_authenticated_input_notes not found | API unified | Use with_input_notes() |