vishvas4u
vishvas4u

Reputation: 41

In XRP, When source account = destination account and sourceTag != destinationTag at that time error is temREDUNDANT(Sends same currency to self.)

I am trying to send some xrp with same accouts but different source and destination tag.

@SuppressWarnings("unchecked")
@Override
public Map<String, Object> makeTransaction() {

    Map<String, Object> mainMap = new HashMap<>();


    mainMap.put("secret", "my_secret_key");
    mainMap.put("Fee", "1000"); // in drops

    Map<String, Object> subMap = new HashMap<>();
    subMap.put("Account", "my_ripple_account"); // source account(my_ripple_account) == destination account(my_ripple_account)
    subMap.put("Amount", "1000000"); // in drops

    subMap.put("Destination", "my_ripple_account"); // // source account(my_ripple_account) == destination account(my_ripple_account)

    subMap.put("TransactionType", "Payment"); // since we are making a payment request

    subMap.put("SourceTag", 400123);
    subMap.put("DestinationTag", 400555);

    mainMap.put("tx_json", subMap);

    JSONObject j = new JSONObject(mainMap);

    JSONObject json = new JSONObject();
    json.put("method", "submit");
    json.put("params", new JSONArray("[" + j.toString() + "]"));
    String requestData = json.toString();

    Map<String, Object> responseMap = restTemplate.postForObject("http://my_ip:5005",
            requestData, HashMap.class);

    LOGGER.debug("makeTransaction() : Response is {}.", responseMap);

    return responseMap;
}

Example Explanation: Here source account(my_ripple_account) = destination account (my_ripple_account) and sourceTag = 400123 and destinationTag=400555. So transaction withing same account here.

Example Output:

{
  "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": "temREDUNDANT",
    "engine_result_code": -276,
    "engine_result_message": "Sends same currency to self.",
    "status": "success",
    "tx_blob": "12000022800000002300061AFB24000000022E000F13066140000000000F424068400000000000000A732102898F54F50F2FCEC11B164D7AA7528B4D7261077913F20579EE99F064C1D1500874473045022100AB07788C4C19D642C60BC552986022E31885E93CD92D6DBEA2B6A1FC9B3AA3B002207837AEA67150CE5CC84FB22C4E90F5D1954BB5446460D2852E7F08E1A1EDF52F811436DB2A0AD63A50E5188C806E2EA5595F2D777D91831436DB2A0AD63A50E5188C806E2EA5595F2D777D91",
    "tx_json": {
      "Account": "rarhswhyFr8TGFPCsY9tTiK5KHUZn4hQaA",
      "Amount": "1000000",
      "Destination": "rarhswhyFr8TGFPCsY9tTiK5KHUZn4hQaA",
      "DestinationTag": 987910,
      "Fee": "10",
      "Flags": 2147483648,
      "Sequence": 2,
      "SigningPubKey": "02898F54F50F2FCEC11B164D7AA7528B4D7261077913F20579EE99F064C1D15008",
      "SourceTag": 400123,
      "TransactionType": "Payment",
      "TxnSignature": "3045022100AB07788C4C19D642C60BC552986022E31885E93CD92D6DBEA2B6A1FC9B3AA3B002207837AEA67150CE5CC84FB22C4E90F5D1954BB5446460D2852E7F08E1A1EDF52F",
      "hash": "559DB6081DF88E699EDC5ECFFDA7CFC669D40975AFA4E5C376123D7EB7AC2A10"
    }
  }
}

Output Explaination: Output indicates status=success but engine_result=temREDUNDANT and there is no change in tag balance even if status=success..

Upvotes: 0

Views: 290

Answers (1)

Atu
Atu

Reputation: 937

Imagine if you had a wallet(real physical wallet) with some bills in it. You're doing the same thing as if you've:

  • pull out your wallet
  • bring a few bills out
  • swap their places
  • put them back in your wallet

In the end you've still got the same amount of money you had in the first place.
Is the order of the bills important to you?
If yes then you keep track of it to yourself. (you wouldn't pay a fee as a plus!)

That's just how ripple's account & destination tag model works.
destinationTag does not have a balance, It's just a measure of differentiation of your transactions.

Upvotes: 2

Related Questions