After successfully creating an offer via the Horizon API, I use the transaction hash to get the effects. This may include trades. Later I retrieve all trades for my account. Now I want to match the trade effects with the respective trades. However, the ids are not exactly the same.

The ids have the form 123456789012-1 for trades or 00123456789012-0 for the effects. The long prefix is shared (ignoring leading zeros) but the suffix is different for the same trades. What do the parts of the ids stand for and how can I match them?

1 Answer 1


Effect id consists of two parts: {operation_id}-{effect_application_order}.

Operation ID is an encoded unique identifier of the operation, which contains:

  • Ledger sequence
  • Transaction application order within ledger tx set
  • Operation application order within tx

The second part is a particular effect order (each operation yields zero or more effects).

The difference is that /effects Horizon endpoint returns all effects including set_options, change_trust, manage_data etc, while /trades endpoints allows you to retrieve only trade effects. And trade id does not match effect id.

  • Thanks a lot for the clarification. So you mean the second part, the effect order, should be identical, too? My problem is that they are not. However, it seems the effects are generated in symmetrical pairs. Maybe I'm picking the wrong ones.
    – lex82
    Oct 21, 2018 at 8:58
  • Yes, when a trade occurs, you get two effects (one per each account participating in trade): selling asset1 for asset2 and selling asset2 for asset1. Note the account field of Horizon response.
    – Orbit Lens
    Oct 21, 2018 at 9:09
  • 1
    I can't confirm that the effect order matches the trade id. I just tried the last trades on the platform. Several ended with "-0" while the respective effects ended with "00...001" and "00..002" respectively. But I can't really figure out a pattern. For operations with many effects the trade order seems arbitrary to me.
    – lex82
    Oct 21, 2018 at 11:27
  • Just checked, you are right, effects from the /trade endpoint have different ids if you compare them to entries from /effects endpoint. Also, the id order counter in trades starts from 0 while effects counter starts from 1. Sorry, my mistake.
    – Orbit Lens
    Oct 21, 2018 at 17:27

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.