Is there any way I can tell whether a transaction hash is valid or not?
For eg,
0x2592cf699903e83bfd664aa4e339388fd044fe31643a85037be803a5d162729f is valid transaction Hash whereas 0x62720366ef403c9891e2bfbd5358ee3c8a57b113 is not.
How to test programmatically whether a transaction hash is valid or not using web3?
I wish to have a function like:
isValidTransactionHash(String txHash){
// if transaction hash is valid return true else false
}
getTransactionteceiptis not meant for that. It returns null for any string starting with '0x' followed by any string of length 64. Like0x1111111111111111111111111111111111111111111111111111111111111111and0xaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaall are valid transaction hashes according ti this but actually they are not. – Prashant Prabhakar Singh May 04 '17 at 10:59blockNumber. I added that to the example code. – SCBuergel May 04 '17 at 11:09getTransactionReceiptreturns null for both an incorrect transaction Hash as well as the transaction that is not mined yet. So checking this way will declare all transaction Hashes which are valid but not yet mined as invalid.Hope you understand. – Prashant Prabhakar Singh May 04 '17 at 11:31.getTransactionand same as above check for some child property. – SCBuergel May 05 '17 at 08:210xand followed by 62 characters would be enough. – Prashant Prabhakar Singh May 09 '17 at 19:50