Questions tagged [gas-estimate]

The tag has no usage guidance.

40 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
4
votes
1answer
168 views

Testrpc transactions are failing. How do I perform a transaction when Mist cannot estimate gas?

I am attempting to perform transactions and create contracts using EthereumJS Testrpc. I set it up by running the following: Terminal 1: testrpc Terminal 2: mist --rpc localhost:8545 Running both ...
3
votes
0answers
141 views

Can't debug transactions that fail during the Web3.js estimateGas() call? No Tx Hash

NOTE: I am doing my work with the Ganache v1.2.2 GUI client on a Linux Ubuntu 18.04 station. There are many revert errors that happen during the estimateGas() call that precedes the actual Web3.js ...
2
votes
0answers
28 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-...
2
votes
0answers
26 views

What Web3JS method do I call to know what value to use for the gas price with sendSignedTransaction?

I am using Web3JS 1.0+ to send transactions to my smart contract. I've been using the following constant for the gas price in my code that I got a long time ago from a tutorial. What is the "...
2
votes
1answer
26 views

Why use different gas?

I have this contract with this functions, why each use different gas amount? pragma solidity 0.4.24; contract Foo { //transaction cost: 21471 gas //execution cost: 199 gas //total cost: 21670 ...
2
votes
1answer
59 views

Is there a Gas Cost profiler

I am trying to figure out what part of a complicated smart contract transaction is responsible for the cost. I was wondering if there is already a tool for that. Ideally it would spit out you are ...
2
votes
2answers
682 views

Constantly getting “Gas estimation failed” error when attempting to deploy ERC20 Token contract on Rinkeby testnet

I have included the code for the contract below. The error I get when attempting to deploy in remix via metamask is: Gas estimation errored with the following message (see below). The transaction ...
2
votes
1answer
735 views

Remix error “gas required exceeds allowance or always failing transaction” on private blockchain

I'm trying to test contract interaction using Remix with two basic contract: contract Callee contract Caller Callee function/variable: uint[] public values; function storeValue(uint value) { ...
2
votes
0answers
176 views

Alternative solution for loops in subscription smart contract design

I am a new developer, working on a smart contract mostly for my own learning. I am developing a Smart Contract to handle subscriptions. The contract has the below features. Subscribers can subscribe ...
2
votes
0answers
172 views

Can the behaviour of the Ropsten Test net be compared to that of the main net?

can be assumed, that a contract behaves in the same way on the Ropsten Test test as well as on the main net, in terms of gas consumption for example? (I think, that the gas price might be different?) ...
2
votes
0answers
158 views

Calculating Gas Remaining at Specific Point in Execution of Contract

This is a doozy :~) I'm trying to figure out the amount of gas remaining in some contract at some specific step. For example: function hash(uint num) returns (bytes32) { return sha3(num, msg....
2
votes
1answer
318 views

Contract is sent and gets an address, but eth.getCode returns 0x

I'm trying to deploy a contract on a private blockchain network. My solidity code has a lot of variables used in it. The deployment does give me a contract address, however, when trying to retrieve ...
2
votes
0answers
525 views

Why is there a difference between eth.estimateGas and the real cost in testRPC?

When I want to deploy a smart contract, I use the eth.estimateGas before deploying my smart contract. This gave me 688180 Gas. let bytecode = compiledContract.contracts['Document'].bytecode; let ...
2
votes
0answers
134 views

Populus cannot deploy contract related to estimated gas is not enough error

I am using populus. Platform darwin -- Python 2.7.12, pytest-3.0.2, py-1.4.31, pluggy-0.3.1 Plugins: populus-1.1.0 OS: Mac OS X I do face with following error: for the following line on my test.py ...
1
vote
0answers
80 views

Is there a way to calculate gas usage of external function call?

I have an external view function which has an iteration loop. If the contract's totalSupply gets bigger, then the iteration time will grow as well. I'm testing on rinkeby right now, but when I launch ...
1
vote
0answers
23 views

function gas calculator and function gas padding

not sure if this is possible, but I was wondering if one function can calculate the gas cost of another function? Also can a function run a series of computations to match the gas cost of the ...
1
vote
0answers
35 views

Gas cost of adding an item to a class-level (storage) array

I would like to make sure that the gas cost of adding an item to a (storage) array is constant, i.e., not dependent on the length of the array. To my understanding, the relevant EVM operation is ...
1
vote
0answers
29 views

Vyper OPCODES gas estimate at compile time

I am trying to dissect Vyper at lower levels to understand how the gas estimates are generated. I tried following the yellow paper and I searched every single line of the compiler but I can't get it ...
1
vote
1answer
24 views

Loop with upper bound of iterations / loop variant

Is it possible somehow to create a loop that solidity will recognize as having an upper bound of iterations for gas estimations? Something like a loop variant in Eiffel (https://www.eiffel.org/doc/...
1
vote
0answers
50 views

Why does address.transfer(amount) cost the same when sent to a new or used address?

In the Ethereum yellow-paper, it's specified that creating a new account costs 25000 gas (Appendix G, entry for Gnewaccount). We can see this if, for example, we call a function that makes a transfer:...
1
vote
0answers
26 views

Gas estimation failed when trying to input a list of bytes32[5]

I am trying to create a struct as shown in the code below. The function setData is intended to create an object of the struct, take the inputs (a string and a list of type bytes32[5]) and set their ...
1
vote
0answers
530 views

Error: gas required exceeds allowance or always failing transaction

I am calling contract's method from javascript. It throws error as: <pre>Error: gas required exceeds allowance or always failing transaction <br> &nbsp; &nbsp;at Object....
1
vote
1answer
204 views

Gas estimation: inconcistency between Python Web3 and NodeJS Web3

Python Web3 and NodeJS Web3 are giving me completely different gas estimations (with NodeJS Web3 estimation being approximately 3 times larger than Python Web3 estimation). My Python Web3 version is ...
1
vote
0answers
193 views

Contract deploy estimateGas undefined

When ti try to estimate gas for my contract to deploy, I always get undefined result. This is my code: const toDeploy = contract.deploy({ data: '0x' + bytecode, arguments: [[web3.utils....
1
vote
0answers
329 views

my_contract,estimateGas() crashes and “eth_estimateGas” returns incorrect value

I'm trying to estimate Gas for a contract method (both using parity and geth - tried web3py and web3js). Contract is deployed and proven to be working. When I use: estimateGas and geth (providing: ...
0
votes
0answers
11 views

Can web3js accurately estimate a transaction that includes an external call?

Can web3js accurately estimate a transaction that includes an external call? For example, will it be accurate in estimating: (bool _success, bytes memory _response) = _to.call.value(_value)(_data); ...
0
votes
0answers
29 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({...},...
0
votes
1answer
153 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
29 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
30 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
32 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
0answers
105 views

Transactions always fails on POA sokol testnet blockchain

POA Sokol is a ethereum like testnet blockchain. I am using ether.js to make a contract call . The eth_estimateGas method in testnet gives this response but works in mainet: { "jsonrpc": "2.0", ...
0
votes
1answer
535 views

Error in Ethereum Wallet:“Couldn't estimate gas, resorting to default parameters. Transaction is likely cheaper than the estimate”

I am using ethereum wallet for deploying contracts in my private blockchain. But whenever I try to send a transaction in my ethereum wallet it shows an error that says, "Couldn't estimate gas, ...
0
votes
1answer
105 views

Question about Gas and Gas Price

In my transaction: gasPrice: 210000 blockHash: "0x69bd71736f2a5d2c83919a0de81a7de0b6b690bb6bdda3acff254d5c68f634bc", blockNumber: 3178, from: "0xc8caa71c16299b40b8579742a27ee53162886040", gas: ...
0
votes
1answer
68 views

estimateGas doesnt match with actual one

I have deployed erc20 contact in Robsten network : https://ropsten.etherscan.io/token/0xa93d83709a1b35f67b30e7400b200690aa51859a?a=0x2c5253b9055cfd3ac7a2d352934fb5c45f667367 Code can be found here (...
0
votes
1answer
66 views

Calculating a minimum entry fee for a game based on typical minimum gas requirements?

I am creating a dApp that is a game where players compete for the prize pool and that pool is built from the sum of all the entry fees payed by the player at the start of the game. The player that ...
0
votes
1answer
348 views

Error: `Invalid JSON RPC response` when running estimateGas on Infura

Why am I getting an error when doing a gas estimation on infura. I am using web3 v1.0 and here is my code: let Web3 = require('web3'); var web3 = new Web3(new Web3.providers.HttpProvider('http://...
0
votes
0answers
123 views

Trouble estimating gas cost of function in Remix console

I'm trying to follow a tutorial for estimating the gas cost of a function. https://cristian.io/post/estimate-gas/ Thus after deploying my contract I type in this code in the Remix console to get the ...
0
votes
1answer
37 views

Calling a function to zero out struct data in a mapping costing more gas than other calls, causing out of gas error

I am working with the following function and state vars: struct TimeRestriction { uint256 fromTime; uint256 toTime; } mapping (address => TimeRestriction) public whitelist; function ...
0
votes
1answer
146 views

Infinite gas estimate for almost all the functions. Is it normal?

When I deploy contract test net, it shows an error that gas limit exceeds: 3000000 What's the solution? Github Link to the smart contract. And is it normal to have the infinite gas estimate of ...