I am calling method with params:

  "params": [
      "to": "0x8f0921f30555624143d427b340b1156914882c10",

But I always get an error:

  "jsonrpc": "2.0",
  "id": 1,
  "error": {
    "code": -32000,
    "message": "gas required exceeds allowance or always failing transaction"

0x8f0921f30555624143d427b340b1156914882c10 this is address of some ERC-20 Token. When i put instead this Contract address someone other everything works great. What can be a problem?

1 Answer 1


An eth_estimateGas JSON-RPC call eventually results in a 'trial execution' of the contract function defined in the data field. For an ERC20 transfer, this function may (typically does) look like this:

function transfer(address _to, uint256 _value) public returns (bool) {
    require(_to != address(0));
    require(_value <= balances[msg.sender]);

    // SafeMath.sub will throw if there is not enough balance.
    balances[msg.sender] = balances[msg.sender].sub(_value);
    balances[_to] = balances[_to].add(_value);
    Transfer(msg.sender, _to, _value);
    return true;

Notice that there is a non-local reference to msg.sender and a require() on the sender's balance.

Try adding a from field to your JSON-RPC params data; that should provide a value in msg.sender and allow the require() to succeed, hopefully.

Note: it surely isn't intuitive that estimating gas would demand a balance check.

  • Most probably addint from parameter to your eth_estamiteGas call will solve the problem. Commented Mar 25, 2019 at 10:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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