0

Judging from https://github.com/ethereum/wiki/wiki/JSON-RPC the api client can synchronize on events such as:

  1. Transaction is received/pending: eth_gettransactionbyhash returns non-null with block number null
  2. Transaction is included in a block - eth_gettransactionbyhash returns non-null with block number non-null
  3. Transaction has been executed as a part of accepted block: eth_gettransactionreceipt returns non-null

But if I sent a transaction that turned out to be invalid - how do I know it's failed, is there anything to wait for/react on?

UPD: There are kinds of errors that prevent transactions from even being included e.g. Insufficient balance for transfer (for the first transfer, not the nested ones issued by contracts), nonce too low/high. By "invalid" I mean transactions that produce this kind of error.

  • What do you mean exactly with "invalid"? – Majd TL Oct 6 at 15:01
  • There are kinds of errors that prevent transactions from even being included e.g. Insufficient balance for transfer (for the first transfer, not the nested ones issued by contracts), nonce too low/high. – oleg.lukyrych Oct 6 at 15:03
0

If you are using a Javascript JSON RPC client library, like web3.js or ethjs, you will not get a transaction hash when you try to send a transaction that's invalid in the ways you describe (insufficient balance for gas, nonce out of order, address for which you don't have the private key or is not a test account, etc.)

Instead, you'll get a error that your code can either catch, or let propagate until it ends your program.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.