Skip to content
Solana’s memo program lets you attach invoice numbers, order IDs, or custom references to any payment. These memos are permanently recorded onchain and visible in transaction logs, making it easy to match payments to your internal systems.

​How It Works

The Memo program writes text to the transaction’s logs. These logs are indexed by explorers and RPC providers, making memos searchable for payment reconciliation.
See How Payments Work on Solana for core payment concepts.
Adding a memo requires building instructions directly, which gives you control over what’s included in the transaction. The steps below show the core flow. See the Demo for complete runnable code.
1

Import Memo Program

Import getAddMemoInstruction from @solana-program/memo to create memo instructions.
Payment with Memo
2

Create Transfer Instruction

Create the token transfer instruction specifying the source ATA, destination ATA, authority (signer), and amount in base units.
Payment with Memo
3

Create Memo Instruction

Create a memo instruction with a message. This message will be visible in the program logs of the transaction.
Payment with Memo
4

Send Transaction with Memo

Combine the transfer and memo instructions in a single transaction.
Payment with Memo
5

View Memo in Transaction Logs

After the transaction confirms, fetch it to view the memo in the logs. The memo appears as a log message from the Memo program.
Payment with Memo
Example Transaction Logs

​Demo

To run this demo, create a project and install its packages. "type": "module" lets the demo use top-level await:
In a second terminal, start a local network on 127.0.0.1:8899 that forks mainnet with the Surfpool CLI, and leave it running. The demo needs the current Memo program, which an offline Surfpool doesn’t have:
Save the demo as demo.ts and run it with npx tsx demo.ts.
Demo