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?

1 Answer 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.

  • 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.
    Commented Feb 14, 2017 at 10:29
  • 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.
    – sr_gi
    Commented Feb 14, 2017 at 10:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.