Questions tagged [gas-estimate]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
1
vote
1answer
43 views

Does the EVM calculate the gas used for a transaction in real time?

Does the EVM calculate the gas used to execute a transaction on the fly as opcodes are being executed? So if there's a branch in code whose conditional is satisfied then additional gas is used to ...
0
votes
1answer
24 views

How can I get the current ETH gas fees in python

I am trying to make a python program that gets the ETH gas prices. I am trying to avoid selenium scraping because I am using this for a discord bot. Does anyone know any good python APIs I can use?
0
votes
0answers
9 views

gas vs gasLimit in web3.js [duplicate]

I've seen a bunch of stackoverflow posts on this and want to make sure I've got it right. I'm running into an issue where on test networks I can do this: contract.methods.mint(1).send({ from: ...
0
votes
0answers
12 views

Truffle test: How to Calculate transfer Gas cost to be 2300 wei?

I am using gasleft() function. I am storing the gasleft() before transfer and gasLeft() after transfer, and then finding the difference. But I am getting wrong result maybe 7554. Somebody please guide ...
0
votes
0answers
21 views

How can I check how much gas I'll need to deploy a contract with eth-brownie?

I kind of accidentally deployed an ERC20 token contract on the mainnet and brownie didn't even ask me to confirm so I ended up spending $700+ worth of ETH to practice. I didn't think it would cost ...
0
votes
1answer
15 views

Do any one had a template API to display/show estimated gas price for a transaction?

Description of the issue: I do not have sufficient funds in my wallet to transfer a token from my wallet to an external wallet. So the transaction will fail and shows us an error message. Instead of ...
0
votes
1answer
42 views

estimate gas usage for a contract

I'm trying to estimate the gas usage for a smart contract for an NFT token - is it possible to do before the actual sale? contract is already published and all functions as well. so I want to know how ...
1
vote
1answer
12 views

why did this transfer transaction fail on eth?

https://etherscan.io/tx/0x8ad822a326243e69c4d5bcd3fe07466a82c2c00edbc53cbc0a211c6efbdd7dd2 checked ethgasstation and doubled the gas but it still failed, any ideas why it would?
1
vote
0answers
22 views

Error when trying to estimateGas()

I'm getting the following error: { code: 13, message: 'execution simulation failed: status = 106' } When executing this code: const gasEstimate = await WJEWELContract.methods.mint(amount).estimateGas(...
0
votes
0answers
43 views

Estimated Gas in JS Doesn't Match Metamask Gas Fee

I need help with figuring out the estimated gas for an approval. I'm able to get a number but it doesn't match what's in metamask. I'm a noob to web3 and so I'm not even sure I'm passing the correct ...
0
votes
1answer
26 views

Computing gas fees to store a plaintext blob

I'm doing some math to figure out how much it would cost to store a multiple KB text blob in a single transaction, but the number I'm getting is too low to make sense. Let's say I want to store 20KB ...
0
votes
0answers
16 views

How to provide enough Gas while calling a function from another function

Here are my two functions. One of them loops over the other. However, when I execute the scheduleMultipleTransactions(), it seems it runs out of gas for calling scheduleTrasnactions() several times. ...
0
votes
0answers
205 views

Hardhat estimatedGas error on smart contract deployment

I'm getting the following error when trying to deploy to BSC testnet: Hardhat Error: cannot estimate gas; transaction may fail or may require manual gas limit (error={"name":"...
0
votes
1answer
58 views

Help to find missing tokens

Actually, it's become a little complex. I am missing around 2 million-plus tokens now. Here are the actions I have done. Purchased GenshinShibInu tokens for $129 using Binance Smart Chain Wallet in ...
0
votes
1answer
31 views

Method works on local but fails on Ropsten [closed]

Trying to debug this transaction (it's a large one that deploys a contract) that works on local but fails on ropsten. First, it said Error: cannot estimate gas; transaction may fail or may require ...
0
votes
1answer
59 views

How to estimate gas cost (not gas price) per transaction?

Sorry for the newbie question. So i had 2 different transactions with the same gas price and same function called But it used different amount of gas unit (not gas price) https://bscscan.com/tx/...
1
vote
0answers
653 views

Automated gas cost calculation in Hardhat?

Context I've learned from this question that it is not (always) possible to compute the gas-costs of an arbitrary solidity contract a.sol because the amount of computation that it takes may depend on ...
0
votes
0answers
11 views

What mainnet activities contribute to gas fees being and staying so high on Ethereum?

Gas above 100 gwei has been the norm for the past several weeks. This is a very expensive transaction cost when translated to dollars. What contributes to such a high gas fee, and how come it's been ...
1
vote
1answer
1k views

If Ethereum 2.0 won't reduce gas fees on mainnet, what will? [closed]

For much of 2021, people who buy and sell ERC-721s believed that Ethereum 2.0 would reduce gas costs, while knowing that the London Hard Fork that was released in summer would only help reduce gas ...
1
vote
0answers
151 views

Discrepancy in gas prices in ENS

I'm a bit confused, I'm trying to buy a domain name in https://ens.domains/ and the price is extremely high for a domain name, it's about $150. Most of that price comes from gas fees. The confusing ...
0
votes
1answer
83 views

Gas price too high - Am I looking at the wrong data?

So, I wrote a smart contract to create my own token. I deployed on Ropsten and it's all good. The next step was to deploy to mainnet, I know if it's just for testing it's not worth it but wanted to do ...
0
votes
1answer
50 views

Is Gas used on Ropsten Indicative of Gas used on Mainnet

I have developed a simple Smart Contract, which uses several Upgradeable Contracts from OpenZeppelin. I have deployed it to the Ropsten Network. It cost me a total of 11476134 in gas. Is the amount ...
1
vote
1answer
269 views

How to estimate gas without balance?

So, I'm making a private network and deploying some contracts. The contract has a payable method which means I have to put value when calling the method. I want to get the estimated cost to call the ...
0
votes
1answer
93 views

Cost of event vs Storage

I have 2 approaches to store result of an election in the contract. I can store the result corresponding to different candidates. I do some computation and keep on updating the storage in the ...
0
votes
0answers
3k views

how to calculate the gas fee of my nft mint transaction

I have the following function to mint a nft on my smart contract (I am using the open zeppelin ERC721 contract) but I would like to stimate the gas feet from my web3 dapp. I know the formula is ...
1
vote
0answers
25 views

Is there a Java equivalent of estimateGas?

I read from many questions (example: How to estimate the cost to call a Smart Contract method?) that web3.eth has a method estimateGas that can provide an estimate of the gas usage of a transaction/...
0
votes
0answers
54 views

How to estimate gas price of contract call from a web3j-generated wrapper class?

Let's say I have some code as follows: Web3j web3 = Web3j.build(new HttpService(endpoint)); Credentials creds = Credentials.create(pk); DefaultGasProvider gasProvider = new DefaultGasProvider(); MyNFT ...
0
votes
0answers
30 views

How can I measure gas in solidity to increment a user's balance according to the amount of gas spent to call the function? [duplicate]

I have a function that I am calling and based on the logic of that function and how much gas it spends to execute the function, I want to increment a user's balance to reimburse the user for the gas ...
0
votes
0answers
490 views

Minting multiple ERC721 tokens estimating gas cost error

I have a function to mint multiple NFTs in my smart contract (max 10). I have another function to transfer the tokens to the msg.sender. Using hardhat locally, this all works nicely. However on the ...
1
vote
1answer
218 views

How does metamask come up its suggested gas fees?

How does metamask come up its suggested gas fees? How does it come up with a certain amount? What is it optimised for? Should you just use it or should you set your own?
0
votes
0answers
16 views

Redeploying the same contract using more gas on token.transfer()?

I redeployed a contract on Github with the same compiler and optimization parameters. However on token.transfer(), the redeployed contract uses about ~5k more gas than the original contract. Is there ...
0
votes
0answers
19 views

Best practices for functions with highly variable gas cost

I'm developing a Dapp with a function (let's just call functionA) that has potentially significantly different gas cost between invocations. This is due to the need for costly extra computation when ...
1
vote
1answer
35 views

Efficiently Accessing Mappings

I'm working on keeping track of data via a struct stored in a mapping. mapping(uint256 => Session); Here is the Session struct: struct Session { // UID uint256 id; // Timestamp ...
0
votes
1answer
56 views

ERC20 Mint Function returns "Uncaught (in promise) Error: Transaction has been reverted by the EVM"

I want to allow an external app to mint tokens when a user performs an action. I have a separate contract that calls the "mintTo" function for an ERC20 token. Here's the token contract. ...
2
votes
1answer
68 views

How estimateGas works internally?

I am building a sniper bot which continually estimating the gas for buying one token. Once the gas is successfully estimated, a transaction to buy the token is sent. But for many times it estimated ...
2
votes
2answers
279 views

I set a 3 gwei for gas price. Now my transaction has been pending for 48+ hours now. But blocks aren't even full!

I tried to set a gas price of 3 gwei for interacting with a smart contract. Now the transaction is pending for 48+ hours. If the blocks aren't full, why dont the miners pick it up? I can bump the fee ...
0
votes
0answers
80 views

Uniswap/Pancakeswap error -3200 when trying to exchange

I am developing my own contract and I am having the following issue: module.exports = { networks: { development: { provider: () => new HDWalletProvider(mnemonic, `http://127.0.0.1:8545`)...
2
votes
1answer
694 views

gas fee on OpenSea

First, I'm brand new to the Ethereum platform, so I do apologise if any of the following is considered stupid questions. Now, I will ask my question anyway I am setting up the first sale of one of my ...
1
vote
1answer
32 views

Are named returns more expensive?

Say I have the following Smart Contract: // SPDX-License-Identifier: UNLICENSED pragma solidity 0.8.7; contract Test { function f1(uint256 a, uint256 b) external pure returns(uint256) { ...
0
votes
0answers
76 views

contract SwapAtUniswap on Remix Failing with gas costs

Hello Super Shadowy Devs Hi, I am trying to push a Transaction for my newly created contract SwapAtUniswap (deployed on Kovan) but its failing due to the following reasons : Gas estimation errored ...
2
votes
1answer
45 views

How does estimation gas work when using an unpredictable condition on a loop?

I'm new to solidity but a question comes to my mind. Say I have this example dummy contract. contract TestLoop { uint8 public blockNumber; uint8 public counter= 0; event LoopCalled(...
0
votes
1answer
2k views

Gas Estimation Execution Reverted (ERC20: transfer amount exceeds allowance)

I want to estimate gas cost for a smart contract function. It's a kind of deposit function which takes USDT tokens from user wallet to the pool. So I should call the approve() function first to ...
0
votes
0answers
18 views

Infinte Gas Estimation by Remix

New to Solidity here but heres my issue. Here are the mappings I'm calling: mapping1 (address => uint32[7]) mapping1; mapping1 (address => uint32[7]) mapping2; function myFunction() external ...
0
votes
1answer
231 views

Gas estimation failed:"transfer amount exceeds spender allowance"

I want to execute function Tip and transfer IERC20 Token. However, this message is shown. Uni::transferFrom: transfer amount exceeds spender allowance { "originalError": { "code": ...
0
votes
1answer
322 views

Gas estimation errored with the following message (see below). i am trying to deploy in bsc testnet

i am trying to deploying a contract to bsc testnet but it getting this error : Gas estimation errored with the following message. The transaction execution will likely fail. Do you want to force ...
1
vote
1answer
501 views

Estimating transfer gas for ERC20 tokens using ethers js without needing the token

I am trying to be able to accurately estimate the gas it will take to send an ERC20 token using Ethers js without first needing that token. Currently, I am able to get an estimate though it does not ...
2
votes
0answers
53 views

how to estimate the gas cost of a contract function that will fail

I am trying to estimate the gas cost of a contract function that will fail. when i do that using standard web3.py's contract.function(args).estimateGas(txArgs) it ends up failing and raising an ...
0
votes
0answers
119 views

"Gas estimation failed" error when sending eth to Chainlink VRF function?

I have a simple request and fulfill randomness using chainlink VRF, and it works fine when calling with 0 ether, but if I send a non-zero amount I get a 'gas estimation failed' error. To be clear, I ...
0
votes
0answers
41 views

What is the gas cost when manipulating on-chain variable multiple times within one transaction?

Changing variables that are stored on the blockchain is expensive. How are gas costs calculated if I change one variable multiple times within the same transaction? For the sake of having a simple ...
0
votes
0answers
18 views

Gas estimation fail only when sending eth to contract?

I have a payable function that works fine when calling without any eth, but if I try to call it with eth it gives me a gas estimation fail. I have another function that is payable and works fine when ...

1
2 3 4 5 6