从一个本地钱包到交换钱包的波纹交易(例如crex24)使用Java

时间:2019-03-15 05:05:58

标签: java ripple rippled

我在本地服务器上安装了涟漪钱包。我创建了一个钱包,并用20 XRP激活了它。

现在,当我从活动帐户中的硬币发送到crex24.com的帐户时,它会给出tecDST_TAG_NEEDED错误代码

波纹:http://127.0.0.1:5005

代码(使用提交方法):

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);

错误

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

1 个答案:

答案 0 :(得分:1)

您在crex24.com上的帐户需要一个destination tagXRPL使用account model类似于ETH。与BTC使用UTXO model不同。

某些交易所要求destination tag的原因是您可能正在与交易所中的其他人共享该地址。例如:

  • Person1的存款地址是:Addr1
  • Person2的存款地址也是Addr1
  • 有人将100XRP存入Addr1

在上述情况下,交易所无法区分是Person1还是Person2
因此XRPL引入了destination tag,它看起来类似于以下内容:

  • Exchange使用accountSet交易将tfRequireDestTag的{​​{1}}标志设置为Addr1
  • true的存款地址是:Person1
  • Addr1:1234的存款地址也是Person2
  • 有人将Addr1:1235存入100XRP。由于Addr1被设置为XRPLtfRequireDestTag拒绝了/这是您的情况/
  • 有人将true发送到50XRPAddr1:1234