4

Querying thetangle.org for one of my addresses, displays all TXs (= transactions) for this address and their state. thetangle.org displays pending, confirmed and reattached confirmed.

I am wondering, how to find out whether a TX has been reattached. I copied the response from findTransactionObjects for a TX which thetangle.org shows to be reattached below. If I get the inclusions for this TX (via getLatestInclusion) the response is either true (confirmed) or false (pending) but there is no state for reattached confirmed or anything similar.

So it boils down to: How do I find out, whether a TX has been attached multiple times? What are the correct API methods to use?

{
    "hash": "MZWKIBSZCTXQHGVIRHEBSOXQQRIQLZTXWAEKHENPCDCOOMPZRCNNIJLKSVEMUHVDLDOPYUOUPHPE99999",
    "signatureMessageFragment": "BVWSAPWUODFAYKTGUUDN[...]",
    "address": "ZOWKEWUCNRDICY9DWEPWGYCUZBZIFHR9MFK9ECSEDDTWNHVQYYHH9YMTVFODAWEEMNLURHCTXDXPGIVAD",
    "value": 114500000,
    "obsoleteTag": "999999999999999999999999999",
    "timestamp": 1513188557,
    "currentIndex": 16,
    "lastIndex": 22,
    "bundle": "ARLGWHSAGU9YPPKZWCDKPBIJSOQG9KGZHPWY9YLLLIPBPJXQUDBTLIVWIYKJCYZGDESTWRAJHEJOAEHZC",
    "trunkTransaction": "LXBCVAUIHNRYZAZVJDUMNAZ99HIZLPXRHFVXXDYAAVYEHVKPQD9SLOFEJBMAEFSXKIRFYMADGPPGZ9999",
    "branchTransaction": "IILWVKCHFVD9ZAZSBGNTZNKMXQFEEUAIBIDVLGSNYXLNY9X9VEXUT9AOJTKSRU9SNGOJPSDRV9UT99999",
    "tag": "999999999999999999999999999",
    "attachmentTimestamp": 1513188938868,
    "attachmentTimestampLowerBound": 0,
    "attachmentTimestampUpperBound": 3812798742493,
    "nonce": "AECEQEDICORQBOIWRLFQYYAIZDQ"
},
4

When you reattach a transaction bundle, you will have two or more sets of transactions (the bundles) with identical bundle hash.

Therefore, query transactions by bundle hash, and then group the transactions based on the links between them into the individual bundles (trunk transaction hash of Transaction "x of y" in bundle points to "x+1 of y" in same bundle). For a quick check, you can also count the number of transactions and divide them by the number of transactions in the bundle. If there is more than one bundle, the bundle has been reattached. If one of the bundles is confirmed and the other is not, you know that the unconfirmed bundle was reattached and the reattachment confirmed.

In case you have to distinguish whether the original or the reattached bundle confirmed, you can confirm the attachment timestamp in both bundles to check which one is older.

There is no convenience API function available for this, so you have to get your hands dirty and implement it yourself if you need this kind of information.

  • Thanks for taking so much time to respond to many of my questions. Unfortunately, I don’t completely understand your answer. Maybe you can illustrate on a concrete case? Here is a transaction which is tagged as reattached: thetangle.org/transaction/…. And here is the corresponding Bundle: thetangle.org/bundle/…. Now, I don’t understand „group the transactions based on the links between them into the individual bundles.“ – ralf Dec 15 '17 at 2:18
  • Replying to @mihi here: I’m querying my full node by bundle via getTransactionObjects(). I have three transactions with currentIndex: 0. Does this mean, the bundle has been reattached twice? In other words: Wouldn't a more simple solution be to check whether I see more than a single Tx with currentIndex: 0? – ralf Dec 15 '17 at 14:14
  • @ralf: Yes this will also work (assuming the risk of having an actual hash collision in the bundle hash negligible). – mihi Dec 15 '17 at 20:25

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.