XRP destination tag explained: memo vs tag, X-addresses and code
An exchange gives all its customers the same XRP address and each of them a different number. That number is the destination tag: it tells the exchange whose deposit just arrived. Leave it out and the XRP still lands in the exchange's account, but nothing on the payment says which customer to credit.
This post covers what the tag is on the ledger, why exchanges call it a "memo", how an address makes the tag mandatory, X-addresses, and code that sends tagged payments and reads them the way an exchange credits deposits.
You need curl and jq, Node.js 22 or newer, and npm install xrpl for one example.
What a destination tag is
DestinationTag is a field of a Payment: a whole number from 0 to 4,294,967,295 (a 32-bit unsigned integer). The ledger itself does nothing with it. In the words of the XRPL docs, tags "merely provide information about how off-ledger systems should process a payment."
Exchanges use tags instead of one address per customer because "an address must be a funded, permanent account to receive payments" on the XRP Ledger, and every account locks up a reserve of XRP. One address with millions of tags costs nothing extra.
The sender's side has a twin, SourceTag. When you send a payment back, the docs say to use the incoming payment's source tag as the destination tag of the return.
1. Read the tag of a real deposit
This is a 40 XRP deposit to a Coinbase deposit address, read from a full-history server that needs no key.
Request:
curl -s https://s1.xrpl.stream/ \
-H 'Content-Type: application/json' \
-d '{"method":"tx","params":[{"transaction":"6348E8FB9606A798DBA08B76BA37F4FAD2679435C7CED65887CE48C520C3F223","api_version":2}]}' \
| jq '.result | {type: .tx_json.TransactionType, from: .tx_json.Account, to: .tx_json.Destination, destination_tag: .tx_json.DestinationTag, delivered: .meta.delivered_amount, result: .meta.TransactionResult, date: .close_time_iso}'
Response:
{
"type": "Payment",
"from": "rsevE8NdRxeAmdzh84gfStCtUcwZ6MUuRj",
"to": "rw2ciyaNshpHe7bCHo4bRWq6pqqynnWKQg",
"destination_tag": 196106657,
"delivered": "40000000",
"result": "tesSUCCESS",
"date": "2026-11-21T23:24:10Z"
}
196106657 is the number Coinbase gave one customer. delivered is in drops: 1 XRP is 1,000,000 drops, so 40 XRP arrived.
A tag sits in a public field, so anyone can see which wallets pay into it. That does not make them one owner: one Bitrue tag took deposits from eleven wallets of unrelated token projects, because it was Bitrue's intake for listing supply.
2. Memo or tag?
On the ledger they are two different fields:
| Destination tag | Memo |
|---|---|
Field: DestinationTag |
Field: Memos |
| Holds one number, 0 to 4,294,967,295 | Holds any data, in hex, up to 1 KB in all (common fields) |
| Read by the receiver, to know whom to credit | Read by anyone, as a note |
Exchanges blur the names. Binance.US lists XRP among the coins that need a memo, and adds that "other platforms or wallets may refer to a memo as a 'tag,' 'tag name,' 'digital ID,' 'label,' or 'note'" (Binance.US). Trezor's guide opens with "A Destination Tag (or Memo)" (Trezor).
So when an exchange asks for a "memo" on an XRP deposit, it means the destination tag: put that number in your wallet's destination tag field.
3. Addresses that require a tag
An address can make the tag mandatory. With that setting on, the ledger rejects a payment that has no tag, and the XRP never leaves the sender.
Request:
curl -s https://s1.xrpl.stream/ \
-H 'Content-Type: application/json' \
-d '{"method":"account_info","params":[{"account":"rw2ciyaNshpHe7bCHo4bRWq6pqqynnWKQg","ledger_index":"validated","api_version":2}]}' \
| jq '.result.account_flags | {requireDestinationTag, disallowIncomingXRP, depositAuth}'
Response:
{
"requireDestinationTag": true,
"disallowIncomingXRP": false,
"depositAuth": false
}
The deposit addresses of Binance, Coinbase, Kraken, Uphold and Bitstamp all have it on.
- An account turns it on with an
AccountSetthat sets flag 1 (asfRequireDest). The docs walk through it. - A payment without a tag then fails with
tecDST_TAG_NEEDED. - The server only checks that a tag is there (rippled source), so tag 0 counts as a tag.
Sending to your own wallet in Xaman, Trust Wallet, Ledger or Tangem? That address is yours alone, so it needs no tag unless you turned the setting on.
4. X-addresses: the address and the tag in one
An X-address packs a classic address and a tag into one string, so a customer copies one thing instead of two. The docs put it this way: "An X-address combines a classic address with a tag into a single address that encodes both." Mainnet X-addresses start with X and Testnet ones with T. The next example makes one and pays to it.
5. Send payments with and without a tag
This script runs on Testnet, where XRP is free. It makes two accounts funded by the xrpl.to faucet: an "exchange" and a "customer". The exchange turns on the tag requirement. The customer then pays it three times: without a tag, with tag 12345, and to an X-address holding the same tag.
Save it as tags.mjs next to npm install xrpl and run node tags.mjs.
Payload:
import { Client, Wallet, classicAddressToXAddress } from 'xrpl';
const client = new Client('wss://s1.xrpl.stream/testnet');
await client.connect();
// A new Testnet account, funded by the xrpl.to faucet (589 test XRP)
async function newAccount() {
const wallet = Wallet.generate();
const res = await fetch('https://api.xrpl.to/v1/faucet', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ destination: wallet.address }),
});
if (!(await res.json()).success) throw new Error('faucet refused');
return wallet;
}
const exchange = await newAccount();
const customer = await newAccount();
console.log('exchange', exchange.address);
// 1. The exchange turns on "require destination tag" (asfRequireDest = 1)
const set = await client.submitAndWait(
{
TransactionType: 'AccountSet',
Account: exchange.address,
SetFlag: 1
},
{ wallet: exchange },
);
console.log('AccountSet:', set.result.meta.TransactionResult);
// 2. The customer pays 10 XRP, first without a tag, then with one
const pay = async (to, extra = {}) => {
const r = await client.submitAndWait(
{
TransactionType: 'Payment',
Account: customer.address,
Destination: to,
Amount: '10000000',
...extra
},
{ wallet: customer },
);
return `${r.result.meta.TransactionResult}, DestinationTag ${r.result.tx_json.DestinationTag}`;
};
console.log('no tag: ', await pay(exchange.address));
console.log('tag 12345:', await pay(exchange.address, { DestinationTag: 12345 }));
// 3. The same address and tag as one X-address
const xAddress = classicAddressToXAddress(exchange.address, 12345, true);
console.log('X-address:', xAddress);
console.log('to X-address:', await pay(xAddress));
await client.disconnect();
Response:
exchange rhcoS35ZcM4zKLGbXyVCwamB1atbDnbkdv
AccountSet: tesSUCCESS
no tag: tecDST_TAG_NEEDED, DestinationTag undefined
tag 12345: tesSUCCESS, DestinationTag 12345
X-address: T72i1vkHJWLftXvFWMLSESmjXhrn4cYiiADBo73s3TL9SRx
to X-address: tesSUCCESS, DestinationTag 12345
The payment without a tag went into the ledger as failed: the 10 XRP stayed with the customer, who paid only the transaction fee. When paying to the X-address, xrpl.js split it back into the classic address and DestinationTag 12345 before signing.
6. Credit deposits by tag, live
An exchange listens to its deposit address and credits each payment to the customer its tag points to. This script watches the Coinbase address from step 1 and prints the first three XRP deposits. Save it as deposits.mjs and run node deposits.mjs.
Request:
const address = 'rw2ciyaNshpHe7bCHo4bRWq6pqqynnWKQg'; // a Coinbase deposit address
const ws = new WebSocket('wss://s1.xrpl.stream/');
let seen = 0;
ws.onopen = () => ws.send(JSON.stringify({ command: 'subscribe', accounts: [address], api_version: 2 }));
ws.onmessage = (e) => {
const m = JSON.parse(e.data);
if (m.type !== 'transaction' || !m.validated) return;
const tx = m.tx_json ?? m.transaction; // API v2 names it tx_json, API v1 transaction
if (tx.TransactionType !== 'Payment' || tx.Destination !== address) return;
if (m.meta.TransactionResult !== 'tesSUCCESS') return;
const got = m.meta.delivered_amount; // what arrived, not the Amount the sender asked for
if (typeof got !== 'string') return; // a token, not XRP
console.log(`tag ${tx.DestinationTag ?? 'none'}: ${Number(got) / 1e6} XRP`);
if (++seen === 3) ws.close();
};
Response:
tag 762357550: 19.879605 XRP
tag 4093840912: 250 XRP
tag 1542616186: 268.125972 XRP
Three things in this script matter in production:
- Credit
delivered_amount, neverAmount. A sender can set the partial payment flag, and thenAmountcan be far more than what arrived. The docs: "When processing any Payment, use the delivered_amount metadata field, not the Amount field" (partial payments). - Credit only validated transactions. Before validation, the result can still change.
- Read both message shapes. API v2 puts the transaction under
tx_json, API v1 undertransaction(subscribe), and servers differ in which one they send.
A deposit with no tag, or a tag no customer has, should wait for a person to sort it out, not be credited to anyone.
The examples use xrpl.stream's keyless endpoints for Mainnet and Testnet, from the team behind xrpl.to (docs). The faucet and the address pages come from xrpl.to: if you show data from api.xrpl.to in an app, put <a href="https://xrpl.to">Data by xrpl.to</a> on the same screen. The full reference is at xrpl.to/docs.
Comments
No comments yet. Start the discussion.