In almost every case, this error indicates that the transaction submitted in the initial request will never succeed. There is one exception: a transaction that fails with the tx_bad_seq result code (as expressed in the result_code field of the error) may become valid in the future if the sequence number it used was too high.

that is info from stellar developer. What is actually create this error? I've got this error and I catch this as error, so I resend the payment. After that my previous error payment suddenly become valid.

What is the best practice to handle this situation?


Every Stellar account has a sequence number. When submitting transactions to the network, validators check that this sequence number is strictly increasing, one at a time. So say we have the Account A with sequence number 1. If we submit anything but sequence number 2, the transaction will fail with tx_bad_seq. Thus, everytime a user makes a transaction, they must increment the sequence number of their account.

So that is how sequence numbers work in Stellar and that is why your transactions were failing.

Now to answer your more specific question:

so I resend the payment. After that my previous error payment suddenly become valid.

I am unsure how that is happening because failed transactions do not increment the sequence number. Unless you are submitting other transactions between the time of the failed tx and the resent successful transaction, this should not work.

Best practice: I believe the best practice is to always get the latest sequence number for an account before constructing a transaction -- this is built into the Stellar Laboratory and there is also a nice example of how to do this is in NodeJS.

  • 1
    I figure out now, I used zulucrypto stellar api, and that sdk still very beta. on some transaction i found that i got sequence number bigger than sequence number +1. So if i made another transaction until filling those sequence number gap, my previous failed transaction become valid – Ahmad Hidayat Mar 27 '18 at 2:25
  • Awesome! If you were able to get this solved, would you mind closing this question :) – Rob Mar 28 '18 at 18:09

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.