<p>A <code>txid</code> is little-endian representation of the double <code>sha256</code> of the serialized tx. Hence, if they send you a wrong or incomplete <code>txid</code> there is no way of validating it without the serialized tx.</p>

<p>Moreover, you should be careful when identifying txs just by its <code>txid</code>, if not careful enough (you accept 0-confirmation txs, or txs that has not gone deep enough in the blockchain), they could double spend the same utxo thas has been used to pay you.</p>

CC BY-SA 3.0
2017-02-14T10:29:39.987Z
Thanks for the answer but I'm asking for somehow validate just user input on frontend. Something like `if($txid_length < 50) elseif ($tx .... )...` for my validation of the payment I have check the blockchain.
S.I.
CC BY-SA 3.0
2017-02-14T10:33:23.263Z
You can check that the ´txid´ length is 64 characters long, since sha256 output is always 256-bit long (32 bytes, 64 hex characters).

However, this will not ensure that the id is correct.
sr_gi
CC BY-SA 3.0
2017-02-14T10:25:35.650Z
2017-02-14T10:25:35.650Z
sr_gi
<p>I've readed numbers of thread here but non answer to my question. What I want to know if there is a way somehow to validate transactionID ( txID ). </p>

<p>I have a site which accepts bitcoins. In order to validate payments I ask customer to submit txID which I use to look up the transaction. The problem is that customers sometime submit wrong txID, not full txID .. etc.</p>

<p>Is there a way to validate transaction ID <strong>WHEN USER SUBMIT IT TO THE FORM</strong> and if is correct then save it and check it?</p>

<transactions><transaction-id>
Possibility of validation of transaction TX id
S.I.
# Possibility of validation of transaction TX id

(Asked by: username_0 on 2017-02-14)

I've readed numbers of thread here but non answer to my question. What I want to know if there is a way somehow to validate transactionID ( txID ).

I have a site which accepts bitcoins. In order to validate payments I ask customer to submit txID which I use to look up the transaction. The problem is that customers sometime submit wrong txID, not full txID .. etc.

Is there a way to validate transaction ID **WHEN USER SUBMIT IT TO THE FORM** and if is correct then save it and check it?

**Tags:** transactions, transaction-id


---

## 1 answers

### Answer by username_1 on 2017-02-14. Score: 1

A `txid` is little-endian representation of the double `sha256` of the serialized tx. Hence, if they send you a wrong or incomplete `txid` there is no way of validating it without the serialized tx.

Moreover, you should be careful when identifying txs just by its `txid`, if not careful enough (you accept 0-confirmation txs, or txs that has not gone deep enough in the blockchain), they could double spend the same utxo thas has been used to pay you.

> **Comments:**
> **username_0**: Thanks for the answer but I'm asking for somehow validate just user input on frontend. Something like `if($txid_length < 50) elseif ($tx .... )...` for my validation of the payment I have check the blockchain.  
> **username_1**: You can check that the ´txid´ length is 64 characters long, since sha256 output is always 256-bit long (32 bytes, 64 hex characters).  However, this will not ensure that the id is correct.  

---

