恒星交叉货币交易不起作用

时间:2015-05-20 05:00:52

标签: json transactions blockchain stellar

我无法在Stellar testnet中执行付款交易。

最初我使用find_path:

curl -X POST https://test.stellar.org:9002 -d '
{
  "method": "static_path_find",
  "params": [
    {
      "source_account": "g4e5v2ERpKvdBZrchn6DrWUtvezkXsu5wo",
      "destination_account": "gJ3e65GzqERgeeS5oXsv8NGfdZWzm93ej6",
      "source_currencies" : [ { "currency" : "SGD", "issuer" : "gDfapfG5hDHuYkbVpugtupkGYVTKXwd59r"} ],
      "destination_amount": {
        "currency": "MYR",
        "value": "1",
        "issuer": "gsQuUKcxM68nEX9tKR71UH5hZXwrvT2mpS"
      }
    }
  ]
}'

我得到的结果:

{
  "result": {
    "alternatives": [
      {
        "paths_computed": [
          [
            {
              "currency": "MYR",
              "issuer": "gsQuUKcxM68nEX9tKR71UH5hZXwrvT2mpS",
              "type": 48
            },
            {
              "account": "gsQuUKcxM68nEX9tKR71UH5hZXwrvT2mpS",
              "type": 1
            }
          ]
        ],
        "source_amount": {
          "currency": "SGD",
          "issuer": "gDfapfG5hDHuYkbVpugtupkGYVTKXwd59r",
          "value": "0.375"
        }
      }
    ],
    "destination_account": "gJ3e65GzqERgeeS5oXsv8NGfdZWzm93ej6",
    "destination_currencies": [
      "MYR",
      "STR"
    ],
    "status": "success"
  }
}

然后我尝试在网络中广播交易:

curl -X POST https://test.stellar.org:9002 -d '
{
  "method": "submit",
  "params": [
    {
      "secret": "sfk7dUd4N8cxVFVowsZL4DQgonNP9k8WFBgaV2NmwEQKGzWuqXT",
      "tx_json": {
        "TransactionType": "Payment",
        "Account": "g4e5v2ERpKvdBZrchn6DrWUtvezkXsu5wo",
        "Destination": "gJ3e65GzqERgeeS5oXsv8NGfdZWzm93ej6",
        "Amount": {
          "currency": "MYR",
          "value": "1",
          "issuer": "gsQuUKcxM68nEX9tKR71UH5hZXwrvT2mpS"
        },
        "Paths": [
          [
            {
              "currency": "MYR",
              "issuer": "gsQuUKcxM68nEX9tKR71UH5hZXwrvT2mpS",
              "type": 48
            },
            {
              "account": "gsQuUKcxM68nEX9tKR71UH5hZXwrvT2mpS",
              "type": 1
            }
          ]
        ]
      }
    }
  ]
}' 

最后,当交易达成共识时,我的结果不成功:

{
  "engine_result": "tecPATH_PARTIAL",
  "engine_result_code": 101,
  "engine_result_message": "Path could not send full amount.",
  "ledger_hash": "82BCF42941EF00BEA9E575B696CD88EC7E14FDE8CFD39FDA6A76B5710FDD0755",
  "ledger_index": 704612,
  "meta": {
    "AffectedNodes": [
      {
        "ModifiedNode": {
          "FinalFields": {
            "Account": "g4e5v2ERpKvdBZrchn6DrWUtvezkXsu5wo",
            "Balance": "199999960",
            "Flags": 0,
            "OwnerCount": 1,
            "Sequence": 5
          },
          "LedgerEntryType": "AccountRoot",
          "LedgerIndex": "D3433DEE556200D8AB72DED7156A597A273103D2BC50F526193EB9C4D8C8B735",
          "PreviousFields": {
            "Balance": "199999970",
            "Sequence": 4
          },
          "PreviousTxnID": "6ADF48B45D95B3ABD20FD78F95F7E4F20D91FF5D169ECC5EFD6DB0CA78BEA486",
          "PreviousTxnLgrSeq": 704445
        }
      }
    ],
    "TransactionIndex": 0,
    "TransactionResult": "tecPATH_PARTIAL"
  },
  "status": "closed",
  "transaction": {
    "Account": "g4e5v2ERpKvdBZrchn6DrWUtvezkXsu5wo",
    "Amount": {
      "currency": "MYR",
      "issuer": "gsQuUKcxM68nEX9tKR71UH5hZXwrvT2mpS",
      "value": "1"
    },
    "Destination": "gJ3e65GzqERgeeS5oXsv8NGfdZWzm93ej6",
    "Fee": "10",
    "Flags": 2147483648,
    "Paths": [
      [
        {
          "currency": "MYR",
          "issuer": "gsQuUKcxM68nEX9tKR71UH5hZXwrvT2mpS",
          "type": 48
        },
        {
          "account": "gsQuUKcxM68nEX9tKR71UH5hZXwrvT2mpS",
          "type": 1
        }
      ]
    ],
    "Sequence": 4,
    "SigningPubKey": "4B640AC0C64AEF1C97EAAD0629CADDCA95FBA5F095BD20BD6282BEC450A125B1",
    "TransactionType": "Payment",
    "TxnSignature": "7BF5772EB916F20F56C5F148E99C3C3DD77C2916EAA47AB2D7FA8306F2B4A9D3FA4B789BDB79899A634B0C33F50A6ACB447CA6A9633C1C73BAB754FBFE74C105",
    "date": 485412700,
    "hash": "846AB6502D3B7A3137B2B538E6616B9C4459D2A67C48E58AF6B64F4659FF0016"
  },
  "type": "transaction",
  "validated": true
}

为什么呢?我做错了什么?我真的无法理解......

1 个答案:

答案 0 :(得分:0)

无论如何我发现了这个问题。

我在提交交易时忘了添加所需的SendMax参数。

curl -X POST https://test.stellar.org:9002 -d '
{
"method": "submit",
"params": [
{
"secret": "sfk7dUd4N8cxVFVowsZL4DQgonNP9k8WFBgaV2NmwEQKGzWuqXT",
"tx_json": {
"TransactionType": "Payment",
"Account": "g4e5v2ERpKvdBZrchn6DrWUtvezkXsu5wo",
"Destination": "gJ3e65GzqERgeeS5oXsv8NGfdZWzm93ej6",
"Amount": {
"currency": "MYR",
"value": "1",
"issuer": "gsQuUKcxM68nEX9tKR71UH5hZXwrvT2mpS"
},
"Paths": [
[
{
"currency": "MYR",
"issuer": "gsQuUKcxM68nEX9tKR71UH5hZXwrvT2mpS",
"type": 48
},
{
"account": "gsQuUKcxM68nEX9tKR71UH5hZXwrvT2mpS",
"type": 1
}
]
],
"SendMax" : { "currency" : "SGD", "value" : "0.375", "issuer": "gDfapfG5hDHuYkbVpugtupkGYVTKXwd59r" }
}
}
]
}'