Generating TXID from transaction's data

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

Posted 2019-06-22T06:51:55.150

Reputation: 115

Question was closed 2019-06-26T03:52:11.703

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 2019-06-22T08:27:42.083

@Ugam I open my pcap file with wireshark and copy tx message structure as hex stream. and then hash it twice.Saeed 2019-06-22T11:33:01.877

follow the process that is mentioned in the question I have linked.Ugam Kamat 2019-06-23T08:51:04.997

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 2019-06-24T13:41:37.797

@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 2019-07-01T06:18:36.833

@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 2019-07-01T06:39:47.710

@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 2019-07-01T07:03:14.377

@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 2019-07-01T13:10:58.867

@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

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 2019-07-02T06:31:19.857

@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 2019-07-02T07:29:04.017

@Ugam, Thank you. I got it. you are right. it's ok now.Saeed 2019-07-02T09:41:07.650

No answers