Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature request: deserialize raw_data_hex into transaction #439

Open
drunkirishcoder opened this issue Oct 25, 2023 · 4 comments
Open

feature request: deserialize raw_data_hex into transaction #439

drunkirishcoder opened this issue Oct 25, 2023 · 4 comments
Labels
enhancement New feature or request

Comments

@drunkirishcoder
Copy link

Would be nice if TronWeb supports deserializing the raw_data_hex back into a transaction object. Currently, the lib supports going from transactionBuilder to a binary hex, but there's no way to go in reverse. Though all the necessary protobuf definition and transaction definitions are there. Would be nice to be able to do the reverse.

@svein1010
Copy link

raw_data_hex is the hex format of transaction.raw_data and it does't include information of txID and signature.
As raw_data and raw_data_hex appear together, you can get what you want through raw_data property.

@drunkirishcoder
Copy link
Author

Isn't txID just sha256 of the raw data bytes? also raw_data_hex can contain signatures as well if I'm not mistaken, because this endpoint exists.

anyway, without going into details, I have an use case where I have the raw_data_hex but not raw_data, and would be nice if TronWeb can deserialize it.

@svein1010
Copy link

Yes, txID is just sha256 of the raw data bytes. And raw_data_hex only contains the infomation of raw_data. When you get a transaction after deserializing the raw_data_hex, you must sign the transaction again to get signature.
The raw_data interface is as following:

  message raw {
    bytes ref_block_bytes = 1;
    int64 ref_block_num = 3;
    bytes ref_block_hash = 4;
    int64 expiration = 8;
    repeated authority auths = 9;
    bytes data = 10;
    repeated Contract contract = 11;
    bytes scripts = 12;
    int64 timestamp = 14;
    int64 fee_limit = 18;
  }

We will consider to support this feature in a later version. Thanks for your suggestion.

@svein1010 svein1010 added the enhancement New feature or request label Feb 23, 2024
@oh-Blade
Copy link

#464

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants