Linked Questions

22
votes
2answers
20k views

How do I know how much gas to use when calling a contract?

When I am calling (sending a transaction to) a contract how do I determine how much gas to use? Is there a way to calculate this upfront & what happens if I send too much / too few gas?
12
votes
2answers
600 views

Can I send gas to another user?

Gas is purchased using Ether, does that mean I can send gas as a separate coin?
8
votes
2answers
4k views

How to estimate the cost to call a Smart Contract method?

After succesfully deployed this Smart Contract on Ethereum testnet https://testnet.etherscan.io/address/0x27c042342C9ba937214117e11A4970A6145034cB is it possible to calculate how much gas is going ...
5
votes
2answers
1k views

Including transactions fees when sending out ETH from a smart contract

Let's say I have a simple Solidity wallet contract as shown below. When I want to withdraw from the contract using send the transaction fees (gas cost) are reduced from the amount the receiving party ...
2
votes
2answers
1k views

How to optimize the gasPrice and gas options in a contract send() function? [duplicate]

There are many questions and answers about estimating the amount of gas consumed. This question is about what to do with this estimate. What values should we actually provide to gas and gasPrice in ...
1
vote
2answers
374 views

Insufficient funds when transferring ERC-20 token using web3

I am trying to send an ERC-20 token on Mainnet using web3 v1.x and Infura. I get the error in the title while executing this code. I have a balance of about 0.14 ETH var provider = new ...
1
vote
2answers
175 views

Contract transaction: Gas estimated doesn't fit gas used

After finding out how to estimate contract tx fees thx to How to estimate the cost to call a Smart Contract method? and Syntax for calling contract state changing methods I tried to use all that ...
0
votes
2answers
672 views

Maximum gas consumption of calling a contract method

I want to evaluate the maximum gas consumption (minimum safe gas limit that will not fail) that calling a specific contract method would consume given that I have the contract source code / byte code. ...
16
votes
1answer
7k views

How much does it cost to use a contract?

Still new to ethereum and would like to know the price for a contract.
5
votes
1answer
535 views

Is it possible to deplete all funds in an Ethereum account?

I have an Ethereum account loaded with Ethers and I need to spend all of them, leaving account final balance at exactly zero Weis. Is that possible? I know using method eth_estimateGas() and ...
5
votes
1answer
1k views

Is it possible to calculate the gas costs of a transaction exactly upfront?

In the Ethereum wallet there are the estimated gas costs. Why is it only an estimate? Is is possible to calculate the gas costs precisely upfront?
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()....
2
votes
1answer
163 views

Is it possible for contract to use different amount of gas for the same function?

I have contract Collector with function sendCoins to external wallet, but some times this function works, sometime not. I have no loops in contract, just one send and that's all - so I thought it ...
2
votes
1answer
1k views

Can a transaction's gas cost change?

I encountered a strange issue on Ropsten Testnet. I deployed a payable contract successfully and tried to send ethers to it. I didn't know how much gas it required, so I gradually increased gasLimit. ...
1
vote
0answers
132 views

Gas estimation using web3 [duplicate]

How Accurate is the gas estimation with web3js and web3py? Can these values be trusted? if not, what circumstances will make the gas estimation deviate from the value observed after the transaction is ...

15 30 50 per page