<p>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.</p>

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

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

CC BY-SA 4.0
2019-07-01T06:18:36.833Z
@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
CC BY-SA 4.0
2019-07-01T06:39:47.710Z
@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
CC BY-SA 4.0
2019-07-01T07:03:14.377Z
@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
CC BY-SA 4.0
2019-07-01T13:10:58.867Z
@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
CC BY-SA 4.0
2019-07-02T06:31:19.857Z
@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
CC BY-SA 4.0
2019-07-02T07:29:04.017Z
@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
CC BY-SA 4.0
2019-07-02T09:41:07.650Z
@Ugam, Thank you. I got it. you are right. it's ok now.
Saeed
CC BY-SA 4.0
2019-06-22T08:27:42.083Z
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
CC BY-SA 4.0
2019-06-22T11:33:01.877Z
@Ugam I open my pcap file with wireshark and copy tx message structure as hex stream. and then hash it twice.
Saeed
CC BY-SA 4.0
2019-06-23T08:51:04.997Z
follow the process that is mentioned in the question I have linked.
Ugam Kamat
CC BY-SA 4.0
2019-06-24T13:41:37.797Z
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
<address><sha256><transaction-id>
Generating TXID from transaction's data
Saeed
# Generating TXID from transaction's data

(Asked by: username_0 on 2019-06-22)

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.

**Tags:** address, sha256, transaction-id

> **Comments:**
> **username_1**: 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.  
> **username_0**: @username_1 I open my pcap file with wireshark and copy tx message structure as hex stream. and then hash it twice.  
> **username_1**: follow the process that is mentioned in the question I have linked.  
> **username_2**: 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.  
> **username_0**: @username_1  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?  
> **username_1**: @username_0 As @username_2 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.  
> **username_0**: @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!  
> **username_1**: @username_0 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'`  
> **username_0**: @username_1 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.  
> **username_1**: @username_0 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.  
> **username_0**: @username_1, Thank you. I got it. you are right. it's ok now.  

---

## 0 answers

