difference between litecoin and bitcoin transaction id format

1

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?

mulllhausen

Posted 2013-09-16T08:22:37.270

Reputation: 1 533

Answers

2

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.

MaxSan

Posted 2013-09-16T08:22:37.270

Reputation: 3 680

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 2013-09-17T05:52:45.857

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!mulllhausen 2013-09-18T20:52:58.693

Collisions are extremely unlikely since the hashes for both are sha256. (10^77 possibilities)weex 2013-10-04T05:40:33.543