Questions tagged [gas-estimate]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
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:...
2
votes
1answer
63 views

Gas cost tests: Sending a transaction to a new address is more expensive?

A friend and I were thinking about transaction costs, is there any attached cost to send a transfer to a new address that has not been stored on chain before? So we started digging. First off we ...
1
vote
1answer
121 views

How to calculate the costs of storing data in a contract? [duplicate]

Lets say, I want to create a smart contract that can receive a record of data per hours, e.g. hourly rates of ETH/EUR. These data would be stored in an array. What would each transaction cost me and ...
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 ...
1
vote
1answer
137 views

How can the cost of changing 2 state variables and emitting 1 event reach 50K gas units?

I have this contract: pragma solidity ^0.4.23; contract Test { event Event(address indexed wallet); mapping (address => bool) public authorizedWallets; uint256 public ...
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://...
2
votes
1answer
54 views

How does ether transfer processed [duplicate]

I want to understand deeply how ether transfer processed and how 21000 of gas determined. Is this a simple constant fee of the transfer transaction or ether transfer transaction is the some predefined ...
0
votes
1answer
420 views

How do you estimate the gas cost of any arbitrary function in Remix IDE?

I've found plenty of information on how to do this using Truffle and Web3, but nothing regarding how to achieve this in the Remix IDE. Examples would be very much appreciated.
0
votes
1answer
117 views

How to keep up with the gas price in a backend service

I have a small nodesjs app that is writing to a contract every now and then. It works, but i had to manually check the current gas price and deploy afterwards. What can I do to automate that? I dont ...
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 ...
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 ...
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 ...
1
vote
2answers
453 views

Price of gas from https://ethgasstation.info/

The website https://ethgasstation.info/ contains a lot of information regarding the price of gas and this is confusing. My question is: what piece of information from the website should I use to ...
1
vote
2answers
2k views

how to estimate gas limit when using web3.eth.sendSignedTransaction

I am using web3 to transfer tokens by using web3.eth.sendSignedTransaction. When I am setting the parameter rawTx like var rawTx = { "from" : walletbase, "nonce" : ...
0
votes
1answer
287 views

JSON-RPC estimate gas error

I am calling method with params: { "jsonrpc":"2.0", "method":"eth_estimateGas", "params": [ { "to": "0x8f0921f30555624143d427b340b1156914882c10", "data":"...
1
vote
1answer
400 views

How to properly estimate gas costs of function calls with go-ethereum and golang?

I'm attempting to build out a program in golang to model ethereum gas costs of function calls for the smart contracts I write. I've successfully been able to estimate them using ethclient.EstimateGas ...
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) { ...
0
votes
2answers
132 views

Will same contract consume different gas in different network?

I have a contract deployed both in test and main network and if i execute same method with same parameters, will gas used differ?
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
272 views

Simple function triggering infinite gas warning?

When I compile this in Remix (0.4.21+commit.dfe3193c.Emscripten.clang): uint256 public rewardAmount = 40; function adjustReward (uint256 reward) onlyOwner public { rewardAmount = reward; }...
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....
0
votes
1answer
247 views

How to store 25 char string on erc20 token and cost?

I’m wanting to be able to create an ERC20 token that stores a 25 character long string with it. Just wondering if this is actually possible? Also if it is possible I’m gathering from the posts I’ve ...
3
votes
1answer
247 views

Oraclize __callback function with unbounded gas usage

I am making a lottery contract and using Oraclize to select a winning number. Here is what I have now: The owner calls a finalize() function, which disallows new entries, and makes a call to ...
0
votes
1answer
503 views

Is there a “gas price oracle” method in Web3j?

I read about the Gas Price Oracle in Geth, but I need to use it outside the Geth client. Is there something similar in Web3j? If not can I call the oracle programatically somehow (in Java)?
2
votes
1answer
2k views

How to estimate gas for my function using web3 js only?

Hi this is my solidity function function closeBid(string _product) public{ } I want to estimate gas for this function so in web3 js I called this like var gas = MyContract.closeBid()....
0
votes
1answer
43 views

Gas cost when calling multiple contracts

If contract a was to call one or more contracts when running it, would the gas cost be the sum of both contract's gas cost?
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
1answer
237 views

Gas consumed by function invoking event?

I have a function to emit event. When I check Ganache, I find that gas used is 23078. Doesn't the event consume less gas than function with contract state change operations? function log() { ...
0
votes
1answer
140 views

Invalid opcode on estimateGas

This is my contract pragma solidity ^0.4.20; contract Test { struct TestStruct { bytes32 name; mapping(uint => address) tesMapping; } TestStruct[] public testStructs; ...
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....
0
votes
1answer
674 views

Understanding “eth_estimateGas” results estimating gas

I have been playing around with parity's "eth_estimateGas" call to determine different tokens gas requirements. Generally using this code: let transfer_data = contract.transfer.getData("<...
4
votes
2answers
3k views

How can I estimate price of data storage? [duplicate]

I'd like to make estimations of the cost of an application, and one of the things I need is the price to store n kB of data on a contract. In ether and in USD. Where could I find rates or prices of ...
9
votes
1answer
511 views

In web3.js, how do I accurately find total gas cost to deploy a new contract (including constructor)?

I am using a public node as my web3 privider, so I must sign all transactions manually. This includes transactions that create contracts. Currently, I use the following method to deploy contracts. ...
0
votes
1answer
578 views

MetaMask Gas Limit Problem on Ropsten

When I try to create my contract on remix using metamask (injected web3/Ropsten) I set gas limit to 4700000 in remix and press Create. When MetaMask opens it asks me to lower my gas fee under a ...
0
votes
2answers
116 views

Can I send ALL my Ether to a Payable function? or should a little be saved to pay for Gas?

I have this big doubt about how the EVM works, Let's say I have an Ether balance of 1000000000000000000 in Wei (1 Ether) and I want to pass ALL of it to a payable function, let's call the function ...
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 ...
1
vote
2answers
1k views

Estimate Gas Cost before SendTransaction [duplicate]

How meta estimating gas cost before broadcasting. How can I calculate gas cost for myfunc() in web3js? function myfunc(){ require(msg.sender == owner) ... } await contractInstance.myfunc....
1
vote
1answer
381 views

Infinite gas estimate caused by Internal function type

When I flag a simple function with the type internal, remix throws an infinite gas estimate warning. Without this type, everything is fine. Please, do you know why? function half(uint a) { ...
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 ...
3
votes
2answers
1k views

Unaffordable gas limit for my Ethereum based crypto-coin

The gas limit for single send transaction is about 21000 gas. Now I am creating my own Ethereum based crypto-coin, and I want to keep its conversion rate as 1 coin = 1 US$ and about 0.02 US$ as ...
2
votes
1answer
160 views

How to make this function more gas efficient?

I have this function: function foo(uint256 _a, uint256 _b, uint256 _c) { require(map[msg.sender].a == 1); require(map[msg.sender].b < 1); require(map[msg.sender].c > 1); ...
1
vote
1answer
149 views

How does actual gas unit use differ for the similar transaction?

I transferred ETH 3 times to a smart contract which needs 48734 actual gas units to execute. It took 68932 units for 1st tx and 48734 for remaining 2. Why it took more gas for the first tx than ...
0
votes
1answer
2k views

Showing “We couldn't estimate the gas” error in estimated fee consumption field while executing a contract in ethereum wallet

I have tried creating contracts in ethereum wallet but sometimes it shows an error while executing those contracts. The error says It seems this transaction will fail. If you submit it, it may consume ...
1
vote
1answer
200 views

Infinite gas estimate for an empty function

I have an empty function like below: function myFunction(int[24] param1, int param2) public returns (int s) { } When I calculate the estimated gas value of this empty function, Remix is telling that ...
0
votes
1answer
466 views

web3 v1 beta. estimateGas throwing Transaction execution error

I am using web3 verion 1 (beta) connected to a remote Parity node via websocket. There is a deployed contract TestContract with a test function that emits a Tested event that simply echoes back msg....
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?) ...
0
votes
1answer
515 views

How can I estimate gas on a transaction with custom data?

How can I estimate the gas I need for a string which may be quite long? I've found an example here, but in this estimate, it doesn't include any custom data. In my app I would like to save a string ...
0
votes
1answer
1k views

Why are ether delta gas prices so high as of recently?

My question is about why the gas price and gas limit are so high as of lately on ether delta?
5
votes
2answers
3k views

Getting infinite gas estimates for simple functions

I am testing out solidity in remix ide using simple contracts. This is the contract that I wrote: contract mortal { address owner; function mortal() { owner = msg.sender; } function kill(){ ...
2
votes
2answers
74 views

Why miners do not simulate their list of transactions to detect a gas exceed and discard those Txs that exceed gas?

Base on this answer related to How Ethereum estimate the gas for running a contract?: Which brings the second point. geth gets its estimate by simulating the transaction itself, based on the ...