Questions tagged [gas-estimate]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
5
votes
0answers
27 views

Deploy gas issue for require reason string

I found a strange case and didn't find out why. ... modifier onlyMaster() { require(msg.sender == master || msg.sender == developer, "caller is not the master"); _; } ... ...
0
votes
0answers
12 views

amount of gas used in receive and fallback functions in truffle tests

I have a contract that is written in solidity ^0.6.4 and has a simple implementation of reverting funds when someone directly transfers some eth or calls an unhandled function. Now it appears to be ...
1
vote
0answers
29 views

Understanding eth_estimateGas with regards to gas price, and current mempool

Does anyone have a detailed understanding of how eth_estimateGas works with regards to gasPrice and the current mempool state? I have historically seen some really odd behavior when using ...
0
votes
1answer
26 views

About calculating gas' cost

I was reading an old post: How to get the actual Gas price? If the gas price currently is, for instance, 14 gwei and I have a transaction cost of 80000, does it mean the price of my transaction is 14*...
0
votes
1answer
38 views

Default gas limit set by web3 is unreasonably high?

I am trying to learn and understand solidity/defi by creating some copies of current popular protocols; I've created a small copy of the Curve Dai strategy from harvest finance, but I'm getting really ...
0
votes
1answer
22 views

Is it possible to get the gas fee before sending an ETH?

Is there a way or api endpoint to calculate the gas fee before sending the ETH? My client requirements is to calculate the gas fee before sending an ETH to other user. I can only get the gas price ...
0
votes
0answers
14 views

What determines how much gas is required when transferring an ECR-721 non-fungible token? [duplicate]

When transferring an ECR-721 token, what determines how much gas is required? Is it written into the contract of the ECR-721 token? Does it depend upon how it was transferred (e.g. cryptokitties.com ...
1
vote
0answers
18 views

I don't know why my contract have a problem. Gas estimation and Gas exceeds Problem [closed]

pragma solidity >=0.4.24 <=0.5.6; contract Indian { mapping (address => uint16) myGame; address public owner; constructor() public { owner = msg.sender; } ...
0
votes
0answers
7 views

For Ganache and BuidlerEVM I have different estimated gas

For Ganache and BuidlerEVM I have different (several times) estimated (by Ethers.js) gas for the same computation. Is it a bug? Isn't the Ethereum standard specifying particular gas amount for every ...
1
vote
1answer
33 views

how to use eth_estimateGas for erc20 tokens?

i wanna calculate estimate gas for BNB, PAX, LINK i have used geth 1.8 and web3.php my contract data that used (i found them from etherscan): <?php /** * @var array */ public ...
1
vote
1answer
33 views

Can miner himself add a transaction with a zero gas price?

In general it doesn't make any sense to send a transaction with zero gas price. Probably it will be pending forever. But what about miner - can he: Send some transaction with zero gas price (so the ...
0
votes
1answer
82 views

How to refund gas to the smart contract caller? (What is the number?)

I have this function: function setAccount(BaseUBI _ubi, address _user, uint256 _startTime, uint _esiaID, bool _setToZero) external { uint256 _refund = (gasleft() + 0/*FIXME*/) * tx....
1
vote
0answers
44 views

Execution erorr: Invalid opcode on estimateGas | Possible unhandled promise rejection

pragma solidity ^0.5.0; I get invalid opcode error when trying to estimate gas needed for my transaction from react-native using the following line of code: const gasAmount = await contract.methods ...
0
votes
1answer
21 views

mining transaction in private blockchain

I am new to the blockchain issue, and I have read about it, but I had these questions. When I actually implement a private Blockchain on every transaction it costs a certain gas. Who pays for this ...
0
votes
0answers
47 views

Insufficient funds for gas * price + value in Ropsten

I write API for smart contract but its shown error "Insufficient funds for gas * price + value"? My try I have increased my address balance but it's showing the same error. I have changed my ...
0
votes
0answers
129 views

How to estimate gasLimit of ERC20 contracts in web3.php project?

I am using web3.php project in my Ethereum based project. A part of this project is sending ERC20 tokens, and in this regard, I need to estimate gas limit of transaction. For this purpose, I found the ...
0
votes
1answer
396 views

How to fix “gas required exceeds allowance (9998602) or always failing transaction” web3js error on mainnet?

I'm getting gas required exceeds allowance (9998602) or always failing transaction error on transaction.estimateGas() on mainnet, but it's working ok on kovan. What is the reason of this error? Is ...
0
votes
0answers
62 views

How to correctly account for transaction costs when swapping from one ERC-20 token to another using for example the Kyber network?

If I for example have 5 KNC (an ERC-20 token) and would like to swap them for x amount of DAI (another ERC-20), this would on the Kyber network, as far as I understand, be achieved via two conversions:...
0
votes
0answers
48 views

intrinsic gas too low in Ropsten

I am trying the sendSignedTransaction in Ropsten and I assigned the value of gas limit and gas price: gasLimit: web3.utils.toHex(21000), gasPrice: web3.utils.toHex(web3.utils.toWei('10', 'gwei')) ...
1
vote
1answer
55 views

gas estimate in loop

I have two contract. I call function placeBid in other contract and i have warning gas estimation. help me. thanks. Can i call function which use gas in loop through other contract? How i can get ...
0
votes
1answer
38 views

Smart contract transaction takes different amounts of gas on different platforms

I have an ERC-20 token contract on which I want to perform some testing on a local chain. I got my chain setup, contract deployment and testing scripts ready on my Windows machine. However, since I ...
0
votes
1answer
99 views

How to estimate gas in an address with no ETH at all

Say I have received an ERC20 token in my address. Such address has no ETH and no other tokens except the one I just received. If I try to estimate the gas cost of sending the token from that address, ...
0
votes
2answers
163 views

Solidity 0.6.1 Receive Fallback Forwarder reverts due to insufficient gas

I am playing around with Solidity 0.6.1 and trying to build a simple funds forwarder. So ETH is sent to the contract and it sends the funds to another address. I deployed it to Ropsten. But every ...
0
votes
0answers
40 views

gas estimation fails when trying to run a recursive function? Is there an alternative?

I have been trying to traverse a graph kind of data structure and the only way to do this is by using a recursive function is what I feel. So, now when I try to execute my contract code in remix it ...
1
vote
1answer
395 views

Error: Returned error: The execution failed due to an exception. @ web3.eth.estimateGas

I am having problem using bignumber.js with web3: const sender = '0xss'; const recipient = '0xxx'; const amount = 1000; // have to use Bignumber for more than 1000 const decimals = 18; const ...
1
vote
0answers
145 views

Gas estimation errored with the following message (see below). The transaction execution will likely fail

When I try to excute the deposit function it shows Gas estimation errored with the following message (see below). The transaction execution will likely fail. Do you want to force sending? execution ...
2
votes
1answer
47 views

Can I estimate the total gas limit of several dependent transactions?

Assume two dependent transactions A and B. Transaction B depends on transaction A and will fail if transaction A has failed. I would like to estimate the gas limit required for the success of both ...
1
vote
1answer
23 views

Explanation for small variation in gasUsed while recursively deploying same contract

https://github.com/christianlundkvist/simple-multisig/blob/master/contracts/SimpleMultiSig.sol I'm deploying the above contract recursively and I find that the gasUsed varies by specifically 12 gas. ...
0
votes
1answer
819 views

ethers.js - estimating gas limit

Using the ethers.js library, how can I determine the gas limit when sending a transaction to a contract or deploying a new contract?
0
votes
4answers
2k views

Gas estimation failed - remix

I am trying to figure out what is wrong with the following code as it does deploy successfully on remix. pragma solidity ^0.5.11; contract MyContract { // Storage address contractOwner; ...
0
votes
1answer
40 views

gas usage for a large loop

How expensive are loops in solidity? (in terms of gas usage). I need to loop through ~1000 wallet address, and send each of them some tokens. my code: struct User { uint32 frozenAt ; uint ...
0
votes
1answer
19 views

Why are all “safe low” transactions mined eventually?

On the website ethgasstation.info you see the current fees for fast, standard and safe low transactions, assuming that there are always more safe low transactions waiting to be mined than standard or ...
2
votes
1answer
179 views

Does using a very high gas limit somehow get your transactions executed slower?

I'm executing transactions on mainnet with a NodeJS script: async function send(web3, transaction, destAddr, gasPrice, privateKey) { const options = { data : transaction.encodeABI(), ...
1
vote
1answer
57 views

How can I reduce the gas price for the fallback function?

Below is my fallback function for ethereum. It currently require 91000 gaslimit which is way more than 21000. Metamask always starts the transaction with 21000 gas stipend due to which transaction ...
0
votes
1answer
58 views

Get gas limit beforehand with Web3

I know that web3 exposes a function to estimate gas limit, but is it accurate when sending to a contract? AFAIK the amount of gas I'm gonna need if sending to a contract depends on the contract code, ...
3
votes
0answers
83 views

Does 'estimateGas' behave the same on Ganache and on mainnet?

I noticed that estimateGas behavior in Ganache has changed: In version 6.4.1, it throws an exception if exceeding the gas-limit. In version 6.5.1, it returns the estimation even if exceeding the gas-...
0
votes
1answer
32 views

Different between gas and gasLimit keys when executing transactions

Below is the code that I'm running. When I entered "gas" and "gasLimit" as the keys, both worked. Why is that? What does "gas" represent? And what is the optimum amount of gasLimit should I use (...
1
vote
1answer
38 views

Block Gas Limit Doubt

Suppose i have a loop. Here user is a struct of which player is an address. address[] memory addrs = new address[](n); for(uint i=0;i<n;i++){ addrs[i] = user.player; } return addrs; This is a ...
0
votes
1answer
34 views

How expensive is it to manipulate the gas price?

Imagine that an evil billionaire decided to make Ethereum hard to use by making the gas very high. I'm wondering how expensive this would be to do for various timescales. For example, manipulating ...
0
votes
0answers
45 views

How to handle estimate gas cost error?

I am programming a button for a transaction which shall only appear if the transaction is possible. Therefore, I am using the following code contract.methods.function(parameters) .estimateGas({...},...
5
votes
1answer
128 views

Why does gas cost explode with more than 7 variables in a struct

I'm assuming this has to do with Ethereum's 7 variable stack limit but in the following code test struct TestStruct5 { uint8 m_nOther1; uint8 m_nOther2; uint8 m_nOther3; uint8 ...
1
vote
1answer
92 views

How to calculate “gas” and “gasPrice” when referring to ethgasstation.info when sending transaction via web3js?

I'm using web3js to issue token which has a name and description. I'm using ropsten testnet. Here's my tx. const tx = { from: walletAddress, to: contractAddress, gas: 4700000, ...
0
votes
1answer
117 views

Calculated Gas Costs of Contract execution

I have a smart contract that maps a string to a string value and stores it on the Blockchain. I want to analyse the Gas Used by Transaction. One time the execution consumes 92,843 Gas (https://rinkeby....
0
votes
1answer
1k views

Gas estimation failed: gas required exceeds allowance or always failing transaction

I have two contracts one for defining token and other for crowdsale. I am using remix ide. pragma solidity >=0.4.22 <0.6.0; contract owned { address public owner; constructor () public { ...
0
votes
0answers
58 views

Find exact gas limit requirements for executing fallback function logic

I have a certain function logic coded for fallback function. This logic also contains some delete operations of storage variables (delete storeVarX;) due to which there might be some gas being ...
0
votes
0answers
66 views

Why does my private network transaction use a different amount of gas than my mainnet transaction performed immediately after?

I am forking the mainnet from my own geth node with ganache-cli --fork option. Immediately after the fork, I simulate a transaction to a contract on the forked, private network. I then immediately ...
0
votes
0answers
89 views

JSON RPC get this error “Request have return error: gas required exceeds allowance or always failing transaction”

i'm trying to do a simple transaction for a token but i keep getting following error for estimate gas limit : "Request have return error: gas required exceeds allowance or always failing transaction" ...
0
votes
1answer
84 views

Multi token transfer issue [closed]

In exchange contract,With multi token when I call approve function from exchange contract, nor my address and spender get approved. Instead only the exchange address and spender gets approved. Its ...
1
vote
1answer
171 views

ERC721 - How is gas worked out with TokenID?

ERC721 - I have minted a tokenid (tokenid=444) and my account owns it. When I try and transfer it, I get this message stating the gas cost is the normally calculated one and the total cost has the ...
1
vote
2answers
457 views

How to estimate ERC721 mint transaction?

My contract; contract My721 is ERC721Full, ERC721Mintable, Ownable { constructor() ERC721Full("My721", "MY721") public {} function mintUniqueTokenTo (address _to, uint256 _tokenId, string ...