Sometimes our back end is able to create a transaction in the stellar network, but for some instability or bug or unknown problem, discards the transaction hash.
When retrying the transaction after fixing the instabilities, we get op_already_exists as a result. We want to automatically treat that exception as a success, and return the original transaction.
But skimming at Horizon API reference, there's no such thing as querying for a duplicated transaction - the only options are querying for all transactions for an account or ledger. Parsing and finding the original transaction in the full transaction history for an account seems like a huge waste.

Is there any way for querying for the original transaction or operation in a op_already_exists scenario without combing the full account transaction history?

  • I think there are a couple of misunderstandings here. First of all op_already_exists means that account you are trying to create already exists. So I think that when you submit the second transaction it's not a duplicate transaction but the duplicated account. Second, what do you mean by saying that the network "discards the transaction hash"? Mar 6, 2020 at 15:59

1 Answer 1


I don't think that's possible, because a horizon server is not even aware of a brand new transaction until it was published to the network, the containing ledger was received by your stellar-core node and finally that was ingested by horizon. You can probably query your stellar-core but I guess even that will have an uncertainty.

You should better focus on finding+fixing the cause for not getting a successful result after publishing a transaction.

Besides: Not sure, but doesn't the op_already_exists exception also come along with the according transactionId?

Update: The error message refers to "account exists" and not to "transaction exists". Just tested in stellar laboratory, if you repeatedly publish the very same transaction multiple times, you always get the very same response including the same unique hash and not an error at all. This said, I assume you don't repeatedly send the same transaction but a newly created transaction with the same content (difference is an increased sequence number) which only fails due to being a "create account" transaction and account creation can obviously only be done once (be aware, if for example you handle a payment transaction the same way, then you will repeatedly send a payment without any error). Now all you have to do is to repeat the exact original transaction and not a newly crafted one .

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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