0

我正在尝试发送一些具有相同帐户但不同源和目标标签的 xrp。

@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;
}

示例说明:这里源帐户(my_ripple_account)=目标帐户(my_ripple_account)和sourceTag = 400123和destinationTag=400555。所以在这里用同一个账户进行交易。

示例输出:

{
  "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"
    }
  }
}

输出说明:输出表示状态=成功,但engine_result=temREDUNDANT,即使状态=成功,标签余额也没有变化。

4

1 回答 1

1

想象一下,如果你有一个钱包(真正的实体钱包),里面有一些钞票。你正在做同样的事情,就好像你已经:

  • 掏出你的钱包
  • 拿出几张钞票
  • 交换他们的位置
  • 把它们放回你的钱包

最后,您仍然获得了与最初相同的金额。
账单的顺序对您来说重要吗?
如果yes那么你跟踪它到yourself. (你不会支付额外费用!)

这就是瑞波的帐户和目的地标签模型的工作原理。
destinationTag没有余额,它只是衡量您交易差异化的指标。

于 2019-04-08T04:31:53.893 回答