Skip to content

How to calculate txHash before sent transaction #251

Answered by msbrogli
Wangmmx asked this question in Q&A
Discussion options

You must be logged in to vote

Hi @Wangmmx . Sure you can calculate it before sending. Here is an example in python-hathorlib where I calculate the hash using two different methods:

tx = Transaction(...)
tx.update_hash()
# Here tx.hash is updated and contains the tx's hash.

h1 = tx.calculate_hash()
assert h1 == tx.hash

Link: https://github.com/HathorNetwork/python-hathorlib/blob/main/hathorlib/base_transaction.py#L375-L389

I just noticed that we don't have such method in our nodejs lib. I'll add it as an issue and discuss about it in our daily meeting tomorrow morning.

Replies: 6 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by jansegre
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #244 on July 01, 2021 05:34.