I would like to know if it's possible for someone to create a raw transaction using bitcoind or bitcoinJ and predict the Transaction hash.How exactly is the transaction ID(hash) calculated ?


For the details of computing a transaction ID, see How to calculate a hash of a Tx? Basically, it is the double SHA256 hash of the raw transaction data.

SHA256 is believed to be a secure hash function, and part of what it means to be a secure hash function is that there is no reasonable way to "predict" what the hash of some input data will be, short of actually computing it. It also means that there is no reasonable way to compute some input data whose hash will have a specified value. So if you are trying to create a transaction whose ID is DEADBEEFCAFEBABE0123456789ABCDEFFEDCBA9876543210FACEFEEDACEDBEAD, or matches the ID of some existing transaction, sorry, you cannot (unless you figure out how to break SHA256). But you can safely assume that nobody else can do so, either.

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.