javaripplerippled

Ripple Transaction from one local wallet to exchange wallet(example : crex24) gives error code tecDST_TAG_NEEDED using java


i installed ripple wallet on my local server. i created one wallet and activate it with 20 XRP.

Now when i send coin from my active account to account(of crex24.com) then it gives tecDST_TAG_NEEDED error code

Ripple : http://127.0.0.1:5005

Code (using submit method):

RestTemplate template = new RestTemplate();
Map<String,Object> mainMap = new HashMap<>();
mainMap.put("secret", "sxxxxxxxxxxx");
mainMap.put("Fee", "1000"); // in drops

Map<String,String> subMap = new HashMap<>();
subMap.put("Account", "raxxxxxxxxx"); // amount will be deducted from this account
subMap.put("Amount", "1000000"); // in drops
subMap.put("Destination", "rdxxxxxxxxx"); // receiver address
subMap.put("TransactionType", "Payment"); // since we are making a  payment request

mainMap.put("tx_json", subMap);

JSONObject json = new JSONObject();
json.put("method", "submit");
json.put("params", new JSONArray(mainMap)); 
String requestData = json.toString();
System.out.println(requestData);
String response = template.postForObject("http://127.0.0.1:5005", requestData,String.class);
System.out.println(response);

Error

{
  "status": 200,
  "message": "Transaction achieved successfully.",
  "data": {
    "result": {
      "deprecated": "Signing support in the 'submit' command has been deprecated and will be removed in a future version of the server. Please migrate to a standalone signing tool.",
      "engine_result": "tecDST_TAG_NEEDED",
      "engine_result_code": 143,
      "engine_result_message": "A destination tag is required.",
      "status": "success",
      "tx_blob": "120000228000000024000000096140000000000F424068400000000000000A7321036CB83FF75DAxxxxxxxxxxxxxxxxxx",
      "tx_json": {
        "Account": "raxxxxxxxxx",
        "Amount": "1000000",
        "Destination": "rdxxxxxxxxx",
        "Fee": "10",
        "Flags": 214482148,
        "Sequence": 9,
        "SigningPubKey": "036Cxxxxxxxxxxxxxxx6",
        "TransactionType": "Payment",
        "TxnSignature": "txxxxxxxxx",
        "hash": "hxxxxxxxxxx"
      }
    }
  },
  "path": "/api/ripple_wallet/makeTransaction"
}

Solution

  • Your account on crex24.com requires a destination tag. XRPL uses account model similar to ETH. Unlike BTC which uses an UTXO model.

    The reason some exchanges require destination tag is that you might be sharing that address with some other person on the exchange. e.g:

    In the case above the exchange wouldn't be able to differentiate if it was Person1's or Person2's.
    So the XRPL introduced destination tag which would look something similar to this: