Skip to main content

Export a note for sharing

What this lets you do

Serialize a note into portable JSON to move it to another of your own devices or back it up.

You rarely need this: on any device with the same wallet, discovery rebuilds your notes from chain on its own. The exception is a note received out-of-band, which was never published on-chain, so no device can discover it (registering with the keystore later doesn't help). Export and import are the only way to move that note between your devices or recover it if you lose your local copy.

Constraints & limits

  • An export reveals the note: the noteSecret lets anyone recompute the note's commitment and link it to your address and value. It does not let them spend the note, since that also needs your keys and keystore registration, but it does expose what the pool otherwise keeps private. Share exports offline only or via secure channels, and never post them anywhere public.
  • Status is point-in-time: an exported note marked ACTIVE could be SPENT by the time someone imports it. Re-sync the importing side afterward.
  • Exporting a note does not send it to anyone: the ownerAddress is binding. Handing your export to someone else, or re-importing it under a different wallet, does not let that wallet spend it. The note stays yours. To pay another person, use a transfer, which creates a new note bound to them.

What it unlocks next

How to use it

// Full account export: returns all notes plus account metadata.
const account = await session.exportAccount();

// Pick the note(s) you want to ship.
const noteToShip = account.notes.find((n) => n.commitment === targetCommitment);
if (!noteToShip) throw new Error("note not found: " + targetCommitment);

const portable = {
commitment: noteToShip.commitment,
value: noteToShip.value,
tokenId: noteToShip.tokenId,
label: noteToShip.label,
ownerAddress: noteToShip.ownerAddress,
noteSecret: noteToShip.noteSecret,
noteAddressHash: noteToShip.noteAddressHash,
status: noteToShip.status,
createdAtBlock: noteToShip.createdAtBlock,
txHash: noteToShip.txHash,
};

// Now encrypt it for transport to your other device.
await fs.writeFile("note.json", JSON.stringify(portable, null, 2));

Behind the scenes

SDK call session.exportAccount(). It returns the NoteManager's notes and sync cursor (lineages are derived from notes on import, not serialised separately) plus the export envelope's owner, chainId, and pending paymentRequests. Keys are excluded.
No chain interaction Pure read of local state. Free, instant.

Ship only the fields you need. exportAccount() does not include the account's protocol keys, which are provided at construction time and excluded from the export. It does return every note's noteSecret, which is sensitive (see Constraints above). When exporting a note for someone else, copy only the note fields shown above.