我正在尝试发送一些具有相同帐户但不同源和目标标签的 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,即使状态=成功,标签余额也没有变化。