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

Unable to broadcast TX via tendermint or REST API #10535

Closed
4 tasks
rami-dabain opened this issue Nov 13, 2021 · 6 comments
Closed
4 tasks

Unable to broadcast TX via tendermint or REST API #10535

rami-dabain opened this issue Nov 13, 2021 · 6 comments

Comments

@rami-dabain
Copy link

Summary of Bug

Tendermint response:
curl -X POST https://lcd-sentinel.cosmostation.io/txs -d testtx.json {"error":"this transaction cannot be broadcasted via legacy REST endpoints, because it does not support Amino serialization. Please either use CLI, gRPC, gRPC-gateway, or directly query the Tendermint RPC endpoint to broadcast this transaction. The new REST endpoint (via gRPC-gateway) is POST /cosmos/tx/v1beta1/txs. Please also see the REST endpoints migration guide at

REST response:
curl -X POST https://lcd-sentinel.cosmostation.io/cosmos/tx/v1beta1/txs -d testtx.json { "code": 3, "message": "invalid character 'e' in literal true (expecting 'r')", "details": [ ] }

this is the same response no matter what's inside that file (even if it's empty)

Version

sentinel-hub fa7cd3c7d5f427308d8a837a18b951482ce5c9e2 0.8.3

Steps to Reproduce

check summary


For Admin Use

  • Not duplicate issue
  • Appropriate labels applied
  • Appropriate contributors tagged
  • Contributor assigned/self-assigned
@alexanderbez
Copy link
Contributor

Can you please post the signed tx file that you're broadcasting?

@rami-dabain
Copy link
Author

sure:

{"body":{"messages":[],"memo":"","timeout_height":"0","extension_options":[],"non_critical_extension_options":[]},"auth_info":{"signer_infos":[{"public_key":{"@type":"/cosmos.crypto.secp256k1.PubKey","key":"A/pYmsKYXcdQD7mDH39lhy54IlOgfYgf97AdJJsmbaUN"},"mode_info":{"single":{"mode":"SIGN_MODE_DIRECT"}},"sequence":"0"}],"fee":{"amount":[],"gas_limit":"0","payer":"","granter":""}},"signatures":["ojkzNrNynSwUsJWlDaq18oM/sYpPQVAfQvvkGwOrLoZTI+buZMLkulTXpA/6UNffSffyb/pDq4PeaIV2dPe/5w=="]}

this was generated using the cosmos SDK (with golang) as per the doc @ https://docs.cosmos.network/master/run-node/txs.html#programmatically-with-go

this message is invalid in the first place (for example it's using messages where the server is expecting message.

I even tried to build a transaction manually, same results.
in fact you get the same error no matter what you post to the endpoint, which suggests the error is from somewhere within. i wasn't able to pinpoint it

@alexanderbez
Copy link
Contributor

The file contents are incorrect -- it doesn't contain any messages.

@rami-dabain
Copy link
Author

rami-dabain commented Nov 16, 2021

Yes, this is what i stated in the previous message.

However:
1 - Returning code-related error instead of a user-friendly message is a security red-flag even in open source projects
2 - When I tested a valid signed-tx packet it went though GRPC but not through REST (original issue)
3- You will get the same error message no matter the payload, you could give it a try yourself with any file, even an empty one:
curl -X POST https://lcd-sentinel.cosmostation.io/cosmos/tx/v1beta1/txs -d testtx.json

the fact that the error message remains the same even for empty files indicated that the error is not related to the contents of the file. I have tried to debug the issue myself but the code doesn't have enough comments and is difficult to debug without having an up-to-date documentation

@alexanderbez
Copy link
Contributor

alexanderbez commented Nov 17, 2021

(1) It returns an error code in addition to a messsage.
(2) The REST API endpoint is deprecated and will not work, unless you mean the gRPC HTTP Gateway route?
(3) I doubt that as we have tests and clients using the gRPC Gateway API endpoint to submits txs (e.g. the Keplr wallet). There must be something wrong with your payload?

@rami-dabain
Copy link
Author

rami-dabain commented Nov 17, 2021

Hi Alexander,
as for 1st point the error code is not clear (and it's the same even for valid TXes that went though using the cli)
As for 2nd point I have provided a URL multiple times which would have answered your question.

Thanks for taking some time looking into this, the lack of up-to-date documentation is frustrating and it seems that you are not reading the whole issue anyway, so I'll close this issue and "again" try examples from your official documentation @ https://docs.cosmos.network/master/run-node/txs.html#programmatically-with-go

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

No branches or pull requests

2 participants