This repository was archived by the owner on Feb 22, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 16
How to compute transaction id? #10
Copy link
Copy link
Open
Description
Hi, I wanna know how to compute the transaction hash from a Transaction instance.
I have tried
const hash = byteArray2hexStr(SHA256(tx.getRawData().serializeBinary()));Because of this implementation in java-tron
System.out.println(
"txid = " + ByteArray.toHexString(Hash.sha256(transaction.getRawData().toByteArray())));But my output is different what is in the blockchain.
For example
Transaction hex from byteArray2hexStr(tx.serializeBinary())
0A8A010A024FAB22089DFE403B668BE88E4088AAA3A8BB2C5A69080112650A2D747970652E676F6F676C65617069732E636F6D2F70726F746F636F6C2E5472616E73666572436F6E747261637412340A15A099357684BC659F5166046B56C95A0E99F1265CBD1215A0F8B3D67B96E807B2525E81A6C443C1C6BE00BF1F1880C8AFA0257080F6D6EB879BEA991512410BA65ABC419ED352FD5377A2D02FCE64556ABC6BF10F713A7652C9B2E42DE4F0BC560CA4BFF285BCBCF23A3DA7EAC95CA3B26CBB7BE642060717D7BCAEAA26DC00
My output is
22F1D5CA7C3A6CBC119C294454238340810DCF8651747CB0D53C381E6A6B3E79
The correct one is
5ab4e286e2f8eda49beef85dd662ca76eb68fd4ec26b85d13b4cfb422e5a55eb
Metadata
Metadata
Assignees
Labels
No labels