i will be storing litecoin and bitcoin transaction ids in the same table in my database, and i want to make the transaction id into a primary key. if litecoin and bitcoin transaction ids overlap then i can work around this by appending a BTC or LTC to each transaction id. can someone tell me if they do overlap?

1 Answer 1


They do not overlap. A transaction is always unique. a cryptographic hash algorithm is designed in such a way that they do not collide. This is one main requirement of a hash function.

The inputs to create the transaction ID is partially based on the inputs which are being used to create the actual spend request in the chain, thus you will never have a collision between Bitcoin and Litecoin.

  • One issue however is that a single transaction can have multiple outputs so you might want to make your primary key a concatenation of the transaction id and output address. That way if you have someone build a single transaction that pays more than one of your addresses, it'll still work.
    – weex
    Commented Sep 17, 2013 at 5:52
  • it sounds like you are saying that it is impossible for a collision to happen? is this the case, or is it merely extremely unlikely? thanks! Commented Sep 18, 2013 at 20:52
  • Collisions are extremely unlikely since the hashes for both are sha256. (10^77 possibilities)
    – weex
    Commented Oct 4, 2013 at 5:40

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.