Bitcoin Forum

Bitcoin => Development & Technical Discussion => Topic started by: wangsw on May 18, 2013, 03:17:51 AM



Title: Can TXID be caculated before TX commited?
Post by: wangsw on May 18, 2013, 03:17:51 AM
Hello all!
Is TXID predictable before transaction broadcast to peers?
Or in other words,can someone choose a certain txid he want when broadcast a transaction?


Title: Re: Can TXID be caculated before TX commited?
Post by: kfreds on May 18, 2013, 02:38:21 PM
Hello all!
Is TXID predictable before transaction broadcast to peers?
Or in other words,can someone choose a certain txid he want when broadcast a transaction?

Hi!

Yes, it's a hash based on the content of the transaction. See the bitcoin wiki or this question:
http://bitcoin.stackexchange.com/questions/2859/how-are-transaction-hashes-calculated

The answer to the second question is no. Furthermore that would be an undesirable feature of a hash function. See "preimage attack".


Title: Re: Can TXID be caculated before TX commited?
Post by: wangsw on May 19, 2013, 02:55:34 AM
Hello all!
Is TXID predictable before transaction broadcast to peers?
Or in other words,can someone choose a certain txid he want when broadcast a transaction?

Hi!

Yes, it's a hash based on the content of the transaction. See the bitcoin wiki or this question:
http://bitcoin.stackexchange.com/questions/2859/how-are-transaction-hashes-calculated

The answer to the second question is no. Furthermore that would be an undesirable feature of a hash function. See "preimage attack".
So we can still have a hash set to choose from by select different vin or nLockTime without ruin a transaction.


Title: Re: Can TXID be caculated before TX commited?
Post by: grue on May 19, 2013, 03:04:51 AM
So we can still have a hash set to choose from by select different vin or nLockTime without ruin a transaction.
yes. you can change the txids as much times as you want, but there's no easy way to get a specific txid.