Skip to main content
Share Your Experience: Take the 2024 Developer Survey

Questions tagged [gas-estimate]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0 votes
0 answers
29 views

Returned error: gas required exceeds allowance (448144)

Here is my code, would you please verify what causes the problem for deployment on Remix (only on the eth mainnet)? Returned error: gas required exceeds allowance (448144) // SPDX-License-Identifier: ...
Morty's user avatar
  • 3
0 votes
1 answer
24 views

Trying to deposit ETH to my contract with Chainlink Functions. Getting gas estimation errors

We were not able to estimate gas. There might be an error in the contract and this transaction may fail Keep getting this error when I am trying to deposit to my contract that is using Chainlink ...
eik's user avatar
  • 3
0 votes
2 answers
52 views

how to verify the minimum gas fee for deploying a contract on the mainnet?

how to verify the minimum gas fee for deploying a contract on the mainnet? my contract creation failed in Remix IDE, I choosed estimated gas fee and the process were not successfully finished, is it ...
Morty's user avatar
  • 3
0 votes
1 answer
21 views

Best Practices for Gas Optimization in Ethereum Smart Contracts

Ethereum community! I'm currently working on developing a smart contract for a decentralized application (dApp) on the Ethereum blockchain. I'm concerned about optimizing gas usage to enhance ...
Ian Park's user avatar
1 vote
1 answer
70 views

Do all EVM chains use the same minimum transaction gas of 21000?

Do all EVM chain use 21,000 gas as a minimum transaction gas for simple ETH payments? Optimism seems to do so. How about the other EVM chains?
Paul Razvan Berg's user avatar
0 votes
1 answer
15 views

Gas Estimation Error - Simple Token + ICO Project

I am a beginner in Solidity and created a simple token + ico file and am testing the code on Base Sepolia Testnet and am running into a peculiar error. I keep getting Gas Esimation Error on the ...
QuantPhdResearch's user avatar
0 votes
0 answers
27 views

Why does transaction value have impact on transaction fee in Ethereum?

I am sending a transaction to Sepolia test network from browsers. The code I have is something like: provider.request({ method: 'eth_sendTransaction', params: [ { ...
Joey Yi Zhao's user avatar
0 votes
1 answer
55 views

Estimating Gas Cost for Smart Contract Deployment Using Foundry

I'm trying to estimate the gas cost for deploying a smart contract using Foundry. Can someone provide guidance on how to do this accurately?
adam mr's user avatar
  • 121
0 votes
0 answers
12 views

Gas estimation failed in solidity leaseProperty function

i am creating smart contract for my property leasing problem all function are work good in hedera network but the leaseProperty function is getting below error and transaction is failed if we ...
Ronak Bharadiya's user avatar
0 votes
0 answers
15 views

Forge test estimates less gas than the real transaction

I noticed that using forge test, the estimated gas used tends to be much less than the real gas used. Taking for example this transaction in Ethereum mainnet: https://etherscan.io/tx/...
quantoor's user avatar
1 vote
1 answer
19 views

Transaction within block gas limits: Will it possibly run out of gas?

Is there any risk in running a transaction that needs quite some gas, even if always within the borders of block gas limits? Let's say 20M, with block limit being 30M. The transaction runs complex ...
user130657's user avatar
0 votes
0 answers
20 views

Remix Gas Limit, Transaction Cost, Execution Cost calculation

As can be seen in the screenshot, I am trying to deploy an entirely empty smart contract locally. The gas limit is set to 3, so logically, this should revert the transaction, right? However, it ...
Mark's user avatar
  • 13
2 votes
1 answer
28 views

What is the gas cost of this function?

I have this contract contract Contract { function a() external { assembly { return(0, 1000000) } } } I am calculating the gas cost for a call to a. Following https:...
alain's user avatar
  • 41
0 votes
0 answers
165 views

MetaMask Gas Estimation Error in Staking dApp: "We were not able to estimate gas" without Sufficient Native Tokens. Big gas fee

I'm developing a staking dApp and have encountered a peculiar issue with MetaMask when attempting to execute transactions without sufficient native tokens in the wallet. MetaMask displays the error ...
Nikola Skadric's user avatar
0 votes
1 answer
39 views

How can I calculate gasPrice on Multi EVM chains?

While calling the function in the contract in different EVM chains, I get gas error in other chains. How can I fix this? // File: Vault.sol contract Vault { function doSometing(string memory message, ...
user's user avatar
  • 1
0 votes
0 answers
16 views

cannot estimate gas error when deploying with solidity-create2-deployer

I continuously get the cannot estimate gas error when attempting to deploy a contract using the solidity-create2-deployer contract and I'm clueless as to where the error arises. find my code below ...
web3lisa's user avatar
0 votes
0 answers
11 views

Friction costs of storing data in a second smart contract

Whats the difference in terms of Gas of the two Scenarios described below? How much are the friction costs of storing data in a second contract compared to storing the number in the contract in which ...
PupSt4r's user avatar
  • 59
0 votes
0 answers
79 views

Estimating transaction gas JS

I am using ethers js version 6.9.1 with a node js I I am trying to estimate the gas for calling a function called createView in my smart contract, so I used this code: const amount = ethers.parseEther(...
modgasman's user avatar
0 votes
1 answer
25 views

How to accommodate gas costs in a multi-user refund type transaction?

I want to build a donation kind of application using blockchain. It would also have the feature of automatic refund in case let say the patient dies before the donation could be used. My doubt is, in ...
Aniket Kumar Paul's user avatar
0 votes
0 answers
17 views

Why can't the gas be estimated?

I'm trying to use another contract to give my leasingContracts unique IDs, but I can't call the function as the code crashes, and I don't understand why. This is the contract for IDs: // SPDX-License-...
Stefan Han's user avatar
0 votes
2 answers
39 views

gas estimation error because of reverted

here is a situation I have: a user came to my platform to buy mytoken and he paid 44 matic for it and 266,087 | 263,663 (99.09%) which reverted because of the gas out. is there any solution to add gas ...
Helia Marami's user avatar
0 votes
1 answer
58 views

ELI5: Converting an arbitrary gas cost in Remix IDE to USD

Let's say the gas (transaction) cost of a function in Remix is 139508. How would I easily convert this to USD? I know this is a totally noob question and I know better, but I can't for the life of me ...
Ashraile's user avatar
  • 125
0 votes
1 answer
27 views

Solidity variable for contract scope (not state variables)?

I use state variables for the interaction of calls (fallback) between contracts. But copying and clearing state variables uses a lot of gas. Perhaps there is a better practice, how to have temporary ...
Andriy's user avatar
  • 1
0 votes
0 answers
89 views

Can eth_estimateGas estimate gas for past blocks?

In my understanding, the eth_estimateGas json rpc method can currently only be used to estimate how much gas would be needed for a transaction based on the current/latest state of the blockchain. ...
MShakeG's user avatar
  • 1,703
0 votes
1 answer
31 views

How to Determine the Optimal Gas Limit for Maximum Gas Refund without Excess?

I'm optimizing the gasLimit for transactions to ensure the maximum possible gas refund without leaving any unused gas. Given most web3 network's have a maximum gas refund policy where a portion of the ...
MShakeG's user avatar
  • 1,703
0 votes
1 answer
128 views

How to change the gas price and gas limit in private blockchain

I wan to change the gas price and gas limit in the private blockchain as you know the currrent contract limit is 21000 so I want to change the default and also the gas limit I wan to cut more than 1 ...
Mustakbil Pakistan's user avatar
0 votes
0 answers
16 views

Why or where should one use Twos Compliment in Solidity?

I was reading through Solidity Docs and came across Bit Operations section https://docs.soliditylang.org/en/v0.8.21/types.html#bit-operations Couldn't figure out why one would use this. However, I do ...
Ishan's user avatar
  • 51
0 votes
0 answers
38 views

Calculating gas a payable function call of smart contract in ethersjs

I am doing something with this logic. But how do I calculate how this will cover different gas amount on different EVM chains let gasLimit = 210000; const { gasPrice } = await provider.getFeeData(); ...
user121748's user avatar
1 vote
2 answers
726 views

Transaction fails due to: Insufficient funds for gas * price + value

I am trying to make transactions on Polygon Mainnet, but unfortunately when I automatically try to calculate the transaction fees, the transaction gets reverted because I assume that the fees are to ...
Dakata's user avatar
  • 225
3 votes
0 answers
37 views

Understanding the Inner Workings of eth_estimateGas in Smart Contracts

I'm seeking clarification on how the eth_estimateGas function operates under the hood. Does it run the smart contract in a manner similar to a dry run? When I make a call to eth_estimateGas, and I've ...
undefined's user avatar
  • 131
1 vote
1 answer
83 views

Simple operation causes Remix gas estimate to become infinite [duplicate]

Completely new to using Remix (first few hours of using it) but confused by this behaviour. In the simple code example below using Remix, why does an operation as simple as incrementing a uint256 (...
cryptophile's user avatar
0 votes
0 answers
95 views

How to catch the {'code': -32000, 'message': 'gas required exceeds allowance (0)'} exception in we3.py?

I'm using the estimate_gas method to get the gas estimate for the tx that I'm sending and in case balance < gas estimate I wanna trow an exception. try: gas_estimate = self.w3.eth.e(...
user124283's user avatar
3 votes
3 answers
537 views

MetaMask incorrectly estimates 100,000 gas for ERC20 transfer. Why?

MetaMask is incorrectly limiting the gas limit estimate to 100,000. This is actually a rather complex "transfer" that will need about 145,000. Why does MetaMask limit ERC20 .transfer() to ...
Rob Hitchens's user avatar
  • 55.3k
0 votes
0 answers
177 views

ProviderError: transaction would cause overdraft when using Uniswap V3 router on Goerli testnet

I tried to call a smart contract (UniswapV3Swap.sol) from another smart contract (UniswapV3Connector.sol). I want to call the swapExactInputSingleHop from UniswapV3Connector.sol, however, the ...
rasyidred's user avatar
0 votes
0 answers
239 views

Execution Error - ERC20: Transfer Amount Exceeds Balance in Ethereum Smart Contract

I'm encountering a perplexing issue while working on an Ethereum smart contract. It seems to be a parameter related error, but I haven't been able to rectify it. The following error message is ...
Joe B's user avatar
  • 3
0 votes
0 answers
1k views

Getting "err: max fee per gas less than block base fee" when estimating gas cost of a transaction

For the last few days, I have some trouble using the eth_estimateGas function from the Quick Node provider. Indeed, after fetching a transaction from the mempool, I want to estimate the gas cost of ...
VeeN's user avatar
  • 101
0 votes
0 answers
17 views

Someone can help me with thist issued: Gas estimation errored with the following message (see below)

Some one can help me to solve this issue, I'm student and I try to deploy a Smart Contract for a practic, I must Deploy 3 contract, When I Try to deploy the last one it show me an error "Gas ...
Willy Gonzalez's user avatar
0 votes
0 answers
22 views

How to estimate gas for subsequent contract interaction in the same call

I have the same issue as here: Can I estimate the total gas limit of several dependent transactions? But i need to know the result on the fly in my react application. Anyone has an idea?
Oliver's user avatar
  • 1
0 votes
0 answers
227 views

BEP20 Token : Gas estimate failed, trying eth_call to extract error

I'm new to Solidity and I've successfully built a BEP20 smart contract using Solidity version 8.19. The contract includes several features such as pausable, ownable, blacklist, fee division among ...
Mohammed's user avatar
0 votes
1 answer
332 views

Error while deploying smart contract on mainnet of ethereum

when I deploy a smart contract on Goerli testnet then it will easily be deployed but when I try to deploy the same contract on mainnet then it gives me this particular error even I have ethers in my ...
Afaq Ahsan's user avatar
0 votes
0 answers
31 views

revert statement causes infinite gas estimation in Remix

I wrote an Ownable contract snippet that uses revert instead of require on the OnlyOwner modifier. This causes remix to estimate infinite gas fees. Does anyone know why? // SPDX-License-Identifier: ...
Shoesoft's user avatar
0 votes
1 answer
22 views

Gas estimation failed for marketplace contract

i receive an error upon trying to interact with buy function in my contract below // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "@openzeppelin/contracts/access/Ownable.sol&...
kaay's user avatar
  • 7
1 vote
1 answer
312 views

EtherJS calculates gas fee too low

newbie here so please bear with me. I am using EthersJS latest v5 in order to interact with our contracts, which works great so far. However, I spotted that for a certain period of time (around 1st ...
supersize's user avatar
0 votes
2 answers
222 views

0xapi swap Asking for a quote for code: 111, reason: 'Gas estimation failed'

const response= await fetch(https://api.0x.org/swap/v1/quote?sellToken=0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2&buyToken=0x6b175474e89094c44da98b954eedeac495271d0f&sellAmount=100&...
Chinh's user avatar
  • 1
1 vote
1 answer
30 views

Would always keeping a non-zero amount of every relevant ERC-20 token lower transaction costs over time?

There is a Smart Contract call called SSTORE (See ETH Yellow Paper page 27: https://ethereum.github.io/yellowpaper/paper.pdf). It costs 20000 gas if a zero byte is set to a non-zero byte. It costs ...
CoderApprentice's user avatar
0 votes
1 answer
71 views

EVM OPCODES gas cost source file

Where can I find the source code file where the EVM extracts the gas cost of all OPCODES? What I need is the file where the EVM calculates the gas cost of SLOAD, ADD, etc. For example, hardhat-gas-...
Antoni's user avatar
  • 15
0 votes
1 answer
183 views

Gas estimation failed only in mumbai testnet not in VM environment

When I am calling a specific function I get this error. In Remix IDE, when I deploy and test the contract in a development environment like VM London, It is working without an error. I have tested ...
Bengican Altunsu's user avatar
0 votes
1 answer
146 views

Error: cannot estimate gas

when calling the following code from a js script a get "Error: cannot estimate gas; transaction may fail or may require manual gas limit " , how to fix this error ? : function ...
adam mr's user avatar
  • 121
0 votes
1 answer
43 views

Why is MyCrypto is disabling the Sign Transaction button?

I'm using MyCrypto to execute a function of a smart contract but the sign Transaction button is disabled. I'm using the setting to auto calculate the Gas Limit and its suggesting a limit of 68908 with ...
TheLogicMan's user avatar
0 votes
1 answer
32 views

Smart contract which uses more gas than estimated

I need to create a smart contract for which it would be hard to estimate gas usage. Specifically, if I estimate execution gas usage at 90 000 gas, I want to consume e.g. 110 000 gas, so that the ...
aleksander_si's user avatar

1
2 3 4 5
8