Memo Program — Program ID & Instructions
MemoSq4gqABAXKb96qnH8TysNcWxMyWCqXgDLGmfcHr The Memo Program attaches arbitrary text data to transactions. Memos are stored in the transaction log and are commonly used for transaction identification, compliance tagging, and exchange deposit tracking.
Program ID
MemoSq4gqABAXKb96qnH8TysNcWxMyWCqXgDLGmfcHr
An older version also exists: Memo1UhkJBfCVL82tnuFCbfZfWN7eFoGzPCz6DVCo1M. Both are active on mainnet. The newer version (MemoSq4...) validates that signers are present in the accounts list.
How it works
The Memo instruction takes a single argument: a UTF-8 encoded string (the memo text). The program validates the input and logs it. The memo appears in transaction logs and can be queried by block explorers and indexers.
import { PublicKey, TransactionInstruction } from "@solana/web3.js";
const MEMO_PROGRAM_ID = new PublicKey("MemoSq4gqABAXKb96qnH8TysNcWxMyWCqXgDLGmfcHr");
const memoIx = new TransactionInstruction({
keys: [{ pubkey: signer.publicKey, isSigner: true, isWritable: false }],
programId: MEMO_PROGRAM_ID,
data: Buffer.from("Payment for invoice #12345", "utf-8"),
});
Common use cases
| Use case | Description |
|---|---|
| Exchange deposits | Exchanges use memos to identify which user a deposit belongs to |
| Compliance | Attach reference numbers or identifiers for audit trails |
| On-chain notes | Record human-readable metadata alongside transfers |
| Token-2022 MemoTransfer | Token-2022’s MemoTransfer extension requires a memo on every incoming transfer |
Limitations
- Maximum memo size is limited by transaction size (1232 bytes total).
- Memos are not indexed by default — you need to parse transaction logs to find them.
- The memo program does not validate memo content — any valid UTF-8 string is accepted.
FAQ
What is the difference between Memo v1 and v2?
Memo v2 (MemoSq4...) requires that at least one signer is present in the instruction’s accounts. Memo v1 (Memo1Uhk...) does not enforce this, allowing unsigned memos. Most new implementations should use v2.
Can I read memos from a transaction?
Yes. Memos appear in the transaction’s log messages as Program log: Memo (len N): "your memo text". Parse the log output from getTransaction.
Is there a gas cost for memos? The memo instruction itself costs minimal compute units (~200 CUs). The main cost is the transaction fee (5,000 lamports base fee), which you pay regardless of the memo.
Updated: