1

With Ubuntu, I've tried Wallet/Mist and MetaMask on Ropsten testnet: they both notify me with bad transactions before inputting my password. I've tried to do the same thing with a JSON-RPC server, in a normal way. The server proceeds to send bad transactions without any notice.

Regarding bad transactions, is there any way to have the same effect of Wallet/Mist/MetaMask with a JSON-RPC server?

2

No. A JSON RPC endpoint implements functionality per a specification.

Mist/Metamask implement transaction validation within the client prior to sending the transaction to the backing node.

In your example you are sending the transaction directly to the node and thus you need to do the appropriate validation in advance.

In reality you can attach any data to a transaction, so whilst incorrectly signed transaction data wont do what you expect it to do, it is not necessarily invalid.

EDIT - More information

If you want to discern if a transaction will throw, you need to run it in an environment which mimics the state of the chain and see what happens.

Geth and Parity implement the [eth_estimateGas](https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_estimategas) endpoint which when called with a function call that throws will return an error.

  • Then, assuming that the server can validate transactions before broadcasting, how can I make it to do so? Moreover, how can I self-validate transactions? FYI, in this case, by "bad transactions" I mean function calls that are thrown / reverted by modifiers. – Vincent J. Ruan Aug 1 '17 at 12:22
  • 1
    You can call eth_estimateGas. Answer edited. – Thomas Clowes Aug 1 '17 at 13:46
  • I've just tried eth_estimateGas and got normal results (no error when making throwing function calls). On the other hand, eth_call seems to work, provided that non-throwing function calls return some value. – Vincent J. Ruan Aug 2 '17 at 4:31
  • I've just realized "normal results" are not that normal: those are the gas limits I allow for the transactions. – Vincent J. Ruan Aug 2 '17 at 4:38

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.