Skip to content
This repository has been archived by the owner on Aug 2, 2022. It is now read-only.

Transaction ID offline calculation #5935

Closed
phil-dolgolev opened this issue Oct 9, 2018 · 7 comments
Closed

Transaction ID offline calculation #5935

phil-dolgolev opened this issue Oct 9, 2018 · 7 comments

Comments

@phil-dolgolev
Copy link

Hi!

I need transaction ID before pushing transaction to network. I found some Java implemetation of signing transactions offline, but as I can see, transaction ID is not equal signed hash. How I can calculate it? Which fields of transaction and in wich order I should pack before calculation?

@taokayan
Copy link
Contributor

taokayan commented Oct 9, 2018

transaction id is the hash of the transaction content itself, and it will not be affected by the signature. However, the signature will use the combined information from chain_id, transaction content and content free data as digest, then be signed by the private key. Therefore, transaction ID will never equal to signature. All of these can be found in transaction.cpp.

@taokayan taokayan closed this as completed Oct 9, 2018
@phil-dolgolev
Copy link
Author

I understand that signature never equal transaction ID, I want completely understand how exactly transaction ID generated

For example, tx: https://tools.cryptokylin.io/#/tx/88aa28ba94c529aa075fa41f1ff7822703b7271b754be0f3c0253cfd973f4d48

Chain ID: 5fff1dae8dc8e2fc4d5b23b2c7665c97f9e9d8edf2b6485a86ba311c25639191
Transactiond content (aka packed_trx): f736bf5b7213e0d1fae1000000000100a6823403ea3055000000572d3ccdcd0190a7a608998c554e00000000a8ed32322590a7a608998c554e90a7a6089996e934102700000000000004454f5300000000047465737400

Neiter SHA256 of ChainID + packed_trx, neither SHA256 of packed_trx not equals Transaction ID
(for example I use this online hash generator: https://passwordsgenerator.net/sha256-hash-generator/)

@jgiszczak
Copy link
Contributor

The transaction ID is the sha256 of the transaction structure in memory. See the code here.

@APshenkin
Copy link

@hchaor
Copy link

hchaor commented Jun 30, 2021

How can I get packed_trx by offline signature?

@MohammadBaniasad
Copy link

so anyone managed to create the txId offline?

@heifner
Copy link
Contributor

heifner commented Jan 20, 2022

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants