Q)Why am I getting this error ? "Gas estimation errored with the following message (see below). The transaction > execution will likely fail" -> withdraw function is showing infinite gas in remix ide


Gas estimation errored with the following message (see below). 
The transaction execution will likely fail. Do you want to force sending?
Returned error: {"jsonrpc":"2.0","error":"execution reverted: You need to spend more ETH!","errorData":"0x08c379a00000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000001b596f75206e65656420746f207370656e64206d6f726520455448210000000000","id":1456657711424373}


// SPDX-License-Identifier: MIT
pragma solidity ^0.8.8;

import "@chainlink/contracts/src/v0.8/interfaces/AggregatorV3Interface.sol";
import "./PriceConverter.sol";

error NotOwner();

contract FundMe {
using PriceConverter for uint256;

mapping(address => uint256) public addressToAmountFunded;
address[] public funders;

// Could we make this constant?  /* hint: no! We should make it immutable! */
address public /* immutable */ i_owner;
uint256 public constant MINIMUM_USD = 50 * 10 ** 18;

constructor() {
    i_owner = msg.sender;

function fund() public payable {
    require(msg.value.getConversionRate() >= MINIMUM_USD, "You need to spend more ETH!");
    // require(PriceConverter.getConversionRate(msg.value) >= MINIMUM_USD, "You need to spend more ETH!");
    addressToAmountFunded[msg.sender] += msg.value;

function getVersion() public view returns (uint256){
    // ETH/USD price feed address of Sepolia Network.
    AggregatorV3Interface priceFeed = AggregatorV3Interface(0x694AA1769357215DE4FAC081bf1f309aDC325306);
    return priceFeed.version();

modifier onlyOwner {
    // require(msg.sender == owner);
    if (msg.sender != i_owner) revert NotOwner();

function withdraw() public onlyOwner {
    for (uint256 funderIndex=0; funderIndex < funders.length; funderIndex++){
        address funder = funders[funderIndex];
        addressToAmountFunded[funder] = 0;
    funders = new address[](0);
    (bool callSuccess, ) = payable(msg.sender).call{value: address(this).balance}("");
    require(callSuccess, "Call failed");

1 Answer 1


The error says You need to spend more ETH which is coming directly from the fund function. The fund function requires you to send 50 ethers, make sure to send it while calling the function.

You need to input 50 ethers here in the value field while calling the function.

enter image description here

  • error solved, thank you @Zartaj Afser Oct 10, 2023 at 14:57
  • Awesome, mark it as an answer :) Oct 10, 2023 at 15:44

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.