How to solve this problem when i call a contract use js "failed with 400: Invalid tx"?


#1

I deploy a contract on sdk-testnet.aepp.com, and i use javascript api call it, it happend an error,
Error: While calling postTransaction (body), POST to https://sdk-testnet.aepps.com/v2/transactions failed with 400: Invalid tx
at createError (createError.js?2d83:16)
at settle (settle.js?467f:18)
at XMLHttpRequest.handleLoad (xhr.js?b50d:77)

And my code is:


#3

Maybe the js-sdk hasn’t been updated yet, but the tx is now base64 encoded instead of base58.


#4

Hey @chenn,

There are 2 possible reasons for this:

  1. bad signature (caused by bad network_id, wrong pubkey, wrong privkey)
  2. fee too low

The most likely being network_id.

Let us know how it goes.

Best,
Albena


#5

Thank you , i solved this, the fee i set was too low


#6

Great! Keep playing with the contracts.