Last updated

Require Destination Tags

The Require Destination Tag setting is designed for addresses that host balances for multiple people or purposes, to prevent people from sending money and forgetting to use a destination tag to identify whom to credit. When this setting is enabled on your address, the XRP Ledger rejects any payment to your address if it does not specify a destination tag.

This tutorial demonstrates how to enable the Require Destination Tag flag on your account.

Note: The meanings of specific destination tags are entirely up to the logic built on top of the XRP Ledger. The ledger has no way of knowing whether any specific tag is valid in your system, so you must still be ready to receive transactions with the wrong destination tag. Typically, this involves providing a customer support experience that can track down payments made incorrectly and credit customers accordingly, and possibly also bouncing unwanted payments.


  • You need a funded XRP Ledger account, with an address, secret key, and some XRP. For production, you can use the same address and secret consistently. For this tutorial, you can generate new test credentials as needed.
  • You need a connection to the XRP Ledger network. As shown in this tutorial, you can use public servers for testing.
  • You should be familiar with the Getting Started instructions for your preferred client library. This page provides examples for the following:

Example Code

Complete sample code for all the steps of these tutorials is available under the MIT license.


1. Get Credentials

To transact on the XRP Ledger, you need an address and secret key, and some XRP. For development purposes, you can get these using the following interface:

Caution: Ripple provides the Testnet and Devnet for testing purposes only, and sometimes resets the state of these test networks along with all balances. As a precaution, do not use the same addresses on Testnet/Devnet and Mainnet.

When you're building production-ready software, you should use an existing account, and manage your keys using a secure signing configuration.

2. Connect to the Network

You must be connected to the network to submit transactions to it. The following code shows how to connect to a public XRP Ledger Testnet server a supported client library:

// In browsers, use a <script> tag. In Node.js, uncomment the following line:
// const xrpl = require('xrpl')

// Wrap code in an async function so we can use await
async function main() {

  // Define the network client
  const client = new xrpl.Client("wss://")
  await client.connect()

  // ... custom code goes here

  // Disconnect when done (If you omit this, Node.js won't end the process)
  await client.disconnect()


For this tutorial, click the following button to connect:

Connection status: Not connected

3. Send AccountSet Transaction

To enable the RequireDest flag, set the asfRequireDest value (1) in the SetFlag field of an AccountSet transaction. To send the transaction, you first prepare it to fill out all the necessary fields, then sign it with your account's secret key, and finally submit it to the network.

For example:

  // Send AccountSet transaction -----------------------------------------------
  const prepared = await client.autofill({
    "TransactionType": "AccountSet",
    "Account": wallet.address,
    "SetFlag": xrpl.AccountSetAsfFlags.asfRequireDest
  console.log("Prepared transaction:", prepared)

  const signed = wallet.sign(prepared)
  console.log("Transaction hash:", signed.hash)

  const submit_result = await client.submitAndWait(signed.tx_blob)
  console.log("Submit result:", submit_result)


4. Wait for Validation

Most transactions are accepted into the next ledger version after they're submitted, which means it may take 4-7 seconds for a transaction's outcome to be final. If the XRP Ledger is busy or poor network connectivity delays a transaction from being relayed throughout the network, a transaction may take longer to be confirmed. (For information on how to set an expiration for transactions, see Reliable Transaction Submission.)

Transaction ID:(None)
Latest Validated Ledger Index:(Not connected)
Ledger Index at Time of Submission:(Not submitted)
Transaction LastLedgerSequence:(Not prepared)

5. Confirm Account Settings

After the transaction is validated, you can check your account's settings to confirm that the Require Destination Tag flag is enabled.

  // Confirm Account Settings --------------------------------------------------
  let account_info = await client.request({
    "command": "account_info",
    "account": address,
    "ledger_index": "validated"
  const flags = xrpl.parseAccountFlags(account_info.result.account_data.Flags)
  console.log(JSON.stringify(flags, null, 2))
  if (flags.lsfRequireDestTag) {
    console.log("Require Destination Tag is enabled.")
  } else {
    console.log("Require Destination Tag is DISABLED.")


For further confirmation, you can send test transactions (from a different address) to confirm that the setting is working as you expect it to. If you a payment with a destination tag, it should succeed, and if you send one without a destination tag, it should fail with the error code tecDST_TAG_NEEDED.


See Also