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

Tx serialization in offline mode raise error #505

Open
3 of 6 tasks
golnarmordadi opened this issue Sep 18, 2022 · 0 comments
Open
3 of 6 tasks

Tx serialization in offline mode raise error #505

golnarmordadi opened this issue Sep 18, 2022 · 0 comments
Labels

Comments

@golnarmordadi
Copy link

Summary

I created transaction with @emurgo/cardano-serialization-lib-nodejs
Singed tx with this library
Send signed tx to the my local node (cardano-rossetta)

BUT

With that (signed tx which transfred to the node ) , can not create offline txId before sending transaction.

So, why signed-tx-hex (txHex) can transfer to the node but can not deseriaize and create txId?

If my code for creating txId is not correct , please guid me to create txId offline before sending tx to the network.

Steps to reproduce the bug

txHex == signed transaction hash

1- Send well formatted transaction with:
const hashResponse = await constructionSubmit(txHex);
return hashResponse.transaction_identifier.hash;
2- Try to create offline txId from txHex (which is input of constructionSubmit function) with below code:

      const txHas =  'signed-tx-hash';
      const signedTransactionBytes = Buffer.from(txHas, 'hex');
      const parsed = TransactionHash.from_bytes(signedTransactionBytes);  ----> This line created above error, instead of deserialization of signed-tx-hash
     const hashBuffer = parsed && parsed.body() && Buffer.from(hash_transaction(parsed.body()).to_bytes());

Actual Result

Getting Error:
Deserialization failed in TransactionHash because: Invalid cbor: expected tuple 'hash length' of length 32 but got length Len(485).

From The Code :

      const txHas =  'signed-tx-hash';
      const signedTransactionBytes = Buffer.from(txHas, 'hex');
      const parsed = TransactionHash.from_bytes(signedTransactionBytes);  ----> This line created above error, instead of deserialization of signed-tx-hash
     const hashBuffer = parsed && parsed.body() && Buffer.from(hash_transaction(parsed.body()).to_bytes());

Expected Result

I expect that, create offline txId. Actually I need to create txId offline.

Environment

Mainnet - local node using cardano-rosetta

Platform

  • Linux (Ubuntu)
  • Linux (Other)
  • macOS
  • Windows

Platform version

Ubuntu 18.04.6

Runtime

  • Node.js
  • Docker

Runtime version

v12.18.3

@rhyslbw rhyslbw transferred this issue from cardano-foundation/cardano-graphql Sep 19, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant