0

As I understand, we can generate a TXID by hashing transaction data through SHA256 twice, and as you know probably, A bitcoin transaction is just a bunch of data that describes the movement of bitcoins.

after that, to search a TXID in the blockchain, we should search for it in reverse byte order.

I tried this instruction to generate a TXID for some sample tx messages, but i didn't find it in blockchain explorers.

Saeed
  • 125
  • 8
  • The most common mistake many people do is hashing the serialized transaction as an encoded text rather than using the bytes that the hexadecimal represents. – Ugam Kamat Jun 22 '19 at 08:27
  • @Ugam I open my pcap file with wireshark and copy tx message structure as hex stream. and then hash it twice. – Saeed Jun 22 '19 at 11:33
  • follow the process that is mentioned in the question I have linked. – Ugam Kamat Jun 23 '19 at 08:51
  • It will be easier to help you if you share the steps you took and the data you are hashing so it can be reproduced. – JBaczuk Jun 24 '19 at 13:41
  • @Ugam Finally I completed my C++ program to calculate TXID with double hashing of TX data and after that reverse it. but sometimes generated TXID is not in some bitcoin explorers like https://www.blockchain.com. why some TXID's are found and some others not found? – Saeed Jul 01 '19 at 06:18
  • @Saeed As @Jbaczuk said, it would be easier for us to help you if you post the data related to the transaction and the steps that you took to get the `txid`. Otherwise we are shooting in the dark as we do not know which data matched and which did not. – Ugam Kamat Jul 01 '19 at 06:39
  • @Uragm. you are right. this is my tx raw hex data: `01000000000102baec426dc550de28b4380ffa66d3f19bdce6ed6bc51a708145dbccadd6bd38400100000000ffffffff8cbc8d7ad78f1675ad3806` I do double sha256 on this raw data and the output was : `e38cc8977dba1999cf03640a997dacd1e9e6bcae255522b38d5ea43296e2fbbd` after reverse it, final TxID is : `bdfbe29632a45e8db3225525aebce6e9d1ac7d990a6403cf9919ba7d97c88ce3` but it is not found! – Saeed Jul 01 '19 at 07:03
  • @Saeed First of all your raw hex data is not a valid transaction. Secondly, your dsha256 is also incorrect related to that data you posted. The dsha256 of the incorrect data you posted should be `'af40edfde85a4a53256ed85df9f9b19a3c5181167431e0442421b5e6c5032b89'` – Ugam Kamat Jul 01 '19 at 13:10
  • @Ugam I just coppied tx message structure hex stream data from wireshark. and I created that trasnaction myself. so the hex deta should be true, also I double hash it with sha256 online in this site: [sha256online](https://learnmeabitcoin.com/tools/sha256/) so it is a true way, especially that with this way I generate a lot of TXID for other transactions which all were true and found in blockchain. – Saeed Jul 02 '19 at 06:31
  • @Saeed for the incorrect transaction that you have mentioned, the website hashes to the data I have mentioned. You need to check the binary option next to the box to tell the program that you are hashing hexadecimals. Now, coming back to your transaction, I don't mind how you are capturing it, but it is not a valid Bitcoin transaction. – Ugam Kamat Jul 02 '19 at 07:29
  • @Ugam, Thank you. I got it. you are right. it's ok now. – Saeed Jul 02 '19 at 09:41

0 Answers0