Skip to main content
Version: 0.13 (unstable)

Note Changes

The note system has been redesigned. NoteMetadata no longer stores aux or NoteExecutionHint — use NoteAttachment instead.

Quick Fix

src/note.rs
// 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.

src/note.rs
- // 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:

src/note.rs
- // 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:

src/network_note.rs
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:

src/mint.rs
- // 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:

src/transaction.rs
- // 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:

src/fetch.rs
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

  1. Remove aux and execution_hint from NoteMetadata constructors
  2. Create NoteAttachment objects for aux data and hints
  3. Update NoteTag usage to plain u32 values
  4. Use with_account_target() for targeted notes
  5. Implement NetworkAccountTarget for network notes
  6. Update mint note creation to use MintNoteInputs enum
  7. Refactor input notes to pass full Note objects
  8. Update FetchedNote handling for new structure

Common Errors

ErrorCauseFix
NoteMetadata::new takes 3 argumentsaux/hint removedUse NoteAttachment
NoteTag::from_account_id not foundAPI changedUse with_account_target()
with_authenticated_input_notes not foundAPI unifiedUse with_input_notes()