Ethereum Wallet will show error message if transaction has error before send. How to do like that using rpc api.


You can call eth_estimateGas, or with web3, estimateGas(), to simulate what will happen when you run the transaction. This should return an error message if the transaction results in an error.

Be aware that the situation may change between calling eth_estimateGas and your actual transaction being mined, so in some cases a transaction that ran without error may still error out when actually sent, or vice versa.

| improve this answer | |
  • I try to use eth_estimateGas to send ether to a contract without payable fallback function, but it still return a number without error. How to see whether error happens – XLeo Mar 1 '18 at 5:50

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.