4

I'm trying to submit a transaction that includes a payment operation. Sometimes the transaction succeeds. However, sometimes it fails. I believe this has something to do with the decimal being submitted.

Before submitting the transaction, the decimal prints as:

11.776242893769199616

On failed transactions, if I browse the XDR response (via Stellar laboratory), I see a negative amount:

amount: -6.6705011 (raw: -66705011)

Any idea why this is a negative number?

Response:

Post Payment Error: Horizon request error of type request failed with message: {
  "type": "https://stellar.org/horizon-errors/transaction_failed",
  "title": "Transaction Failed",
  "status": 400,
  "detail": "The transaction failed when submitted to the stellar network. The `extras.result_codes` field on this response contains further details.  Descriptions of each code can be found at: https://www.stellar.org/developers/learn/concepts/list-of-operations.html",
  "extras": {
    "envelope_xdr": "[XDR INFO]",
    "result_codes": {
      "transaction": "tx_failed",
      "operations": [
        "op_malformed"
      ]
    },
    "result_xdr": "AAAAAAAAAGT/////AAAAAQAAAAAAAAAB/////wAAAAA="
  }
}
  • 2
    What SDK are you using. The first problem I see is that the amount has too many decimal places (7 is max). – Bartek Nowotarski May 10 '18 at 21:41
4

When I pasted the decimal you posted into the stellar transaction builder I got the following error: "Amount can only support a precision of 7 decimals."

Perhaps whatever method it uses to encode decimals does not support that level of precision and fails spectacularly (underflow, overflow?).

https://www.stellar.org/laboratory/#txbuilder?params=eyJvcGVyYXRpb25zIjpbeyJpZCI6MCwiYXR0cmlidXRlcyI6eyJhbW91bnQiOiIxMS43NzYyNDI4OTM3NjkxOTk2MTYifSwibmFtZSI6InBheW1lbnQifV19&network=test

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.