1

I have used the following request to estimate gas in an ETH transaction in Ropsten.

## JSON-RPC over HTTPS POST
curl https://ropsten.infura.io/v3/YOUR-PROJECT-ID \
    -X POST \
    -H "Content-Type: application/json" \
    -d '{"jsonrpc":"2.0","method":"eth_estimateGas","params": [{"from": "fromAddress","to": "toAddress","gas": null,"gasPrice": null,"value": "0x9184e72a","data": null}],"id":1}'

But when the balance of the account(toAddress) is less than the amount to be sent in a transaction(value), the response contains the following error message.

{
    "jsonrpc": "2.0",
    "id": 1,
    "error": {
        "code": -32000,
        "message": "err: insufficient funds for transfer: address 0x...DFCsbds807 (supplied gas 4010499)"
    }
}

The same request and condition in Kovan return the estimated gas.

{
    "jsonrpc": "2.0",
    "id": 1,
    "result": "0x5208"
}

Is it necessary to maintain this condition (balance of an account > the amount to send) to execute eth_estimateGas? Though this was not the case previously. Mainnet also behaves the same as Ropsten.

Is there a way to work this when the balance of an account < the amount to send?

Your Answer

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

Browse other questions tagged or ask your own question.