Questions tagged [out-of-gas]

exception generated when computations consume all the gas available to a transaction

Filter by
Sorted by
Tagged with
25
votes
4answers
4k views

Why does a Solidity throw consume all gas?

When you throw an exception, all gas is consumed. What is the rationale for this design decision?
38
votes
2answers
12k views

How do I detect a failed transaction after the Byzantium fork as the REVERT opcode does not consume all gas?

Pre Byzantium fork, I could use gas == gasUsed to detect when a transaction has failed (further details in How can the transaction status from a thrown error be detected when gas can be exactly the ...
18
votes
1answer
6k views

How to clear large arrays without blowing the gas limit?

As posted by redditor ethererik in the post GovernMental's 1100 ETH jackpot payout is stuck because it uses too much gas, 1,100 ethers are stuck in limbo because the payout of this GovernMental ...
7
votes
2answers
2k views

Who gets the fee from contract call?

Basically you don't need to pay fee for contract call, but if a contract method does lots of work, you need to add gas in contract call to prevent DoS attack like this: contract.method.call({gas: ...
15
votes
5answers
4k views

How do I know when I've run out of gas programmatically?

This keeps coming up on the gitter forums so I thought I'd ask and answer this question: How do you know when you've run out of gas?
12
votes
2answers
5k views

What does a “bad JUMPDEST” error mean?

When I send a transaction to call my contract, it's causing a bad JUMPDEST error. The Ethereum wiki says this error is caused when a JUMP instruction jumps to a location that wasn't marked as a jump ...
19
votes
1answer
699 views

Out of Gas invoking precompiled contracts on private blockchains

Why do precompiled contracts lead to Out of Gas on private blockchains? Some tidbits are provided in the Solidity docs but can it be explained more? It might be that you run into Out-of-Gas for ...
14
votes
1answer
4k views

What happens if transaction runs out of gas before transaction completes?

As gas cost can only be estimated until the transaction is executed against the actual contract state at the time of execution on the blockchain, what happens if transaction runs out of gas before the ...
21
votes
5answers
38k views

How to know if a transaction went through or not? (out of gas)

Apparently when sending transactions from an Account instead of a Wallet, the gas spent is small (21K), and not enough to send ether to a Contract Wallet (out of gas, so to speak). When this happens, ...
3
votes
2answers
343 views

If Metamask Gas calculations are nearly perfect why do we still get out of Gas error?

Pardon me if this question seems a bit naive. I have written a smart contract (for proof of existence) and simulating it in Ganache. Inside it I have logic to store data in a mapping created between ...
16
votes
3answers
2k views

Does an entire transaction revert when throw occurs?

I have a contract that calls another contract that calls another. If there is a throw (or out-of-gas error) that occurs somewhere in the second contract, does the entire transaction get reverted or is ...
4
votes
1answer
380 views

Buy function not working with solidity 0.4.2

I don't know if there is any such change in latest Solidity version that is preventing execution of this function: function buy() returns (uint amount){ amount = msg.value / buyPrice; ...
3
votes
1answer
8k views

Transaction failed due to “out of gas”, how can I get refund?

https://etherscan.io/tx/0xf0d9a39afef87aab8072876dbdeb1a4c8818dee20e13e6c57a13d8fa2a640985 My transaction from okcoin to another exchange failed because out of gas. When I contact okcoin, they said ...
1
vote
2answers
871 views

How to estimate gas for a function without any input parameter?

How to estimate gas for a contract function that doesn't take any input parameter bu changes state? For eg, function buy() returns (uint amount){ amount = msg.value / buyPrice; ...
12
votes
1answer
1k views

Out of gas during contract creation

A few days ago, several attempts at creating a contract failed with out of gas errors (confirmed by etherscan/ethercamp and getBalance API), however it is not clear to me what failed exactly, and how ...
9
votes
2answers
482 views

Why doesn't the Ethereum protocol have an indicator for a transaction that failed?

Why doesn't the Ethereum protocol have a clear indicator for a transaction that is reverted? There's a heuristic here as well as a workaround using Geth. But there are probably ways that the ...
2
votes
1answer
1k views

“Error: base fee exceeds gas limit” when using the withdrawal pattern

When I am testing the withdraw() method from "WithdrawalContract" from http://solidity.readthedocs.io/en/develop/common-patterns.html using Remix and testrpc, it reported the following error. Testrpc ...
1
vote
1answer
2k views

Truffle contract deployment either exceeds block gas limit or out of gas

I've been having the same issue when I was trying to deploy a contract using truffle develop console. The contract is not extremely big but does initiate two other contracts when called a certain ...
1
vote
1answer
88 views

TX fails in private blockchain when trying to access an ERC20 contract from another contract

I have an ERC20 contract and I am trying to access it from another contract, which is a Faucet. In the Faucet I have a function to query an account's balance, and another one to transfer some tokens ...
25
votes
6answers
15k views

Truffle deployment on test network says: Error: exceeds block gas limit

I'm trying to deploy a sample contract (following this guide) but I'm receiving an error of not enough gas. I changed the numbers a little but could not fix it. I saw this question in stack exchange ...
7
votes
2answers
2k views

All cases when Solidity compiles to invalid jump destination

Solidity generates EVM bytecode that leads to an invalid jump destination when: throw is used ... ? ... ? Can the above list be completed, with examples? To explain the first item, throw in ...
4
votes
1answer
328 views

Out of gas error deploying library

The following code is compiled with solc 0.3 with correct --libraries linking and deployed to morden. Math library is deployed just fine and can be accessed. However A doesn't get deployed on morden ...
9
votes
1answer
738 views

How to avoid/detect multiple internal transaction out-of-gas side effects?

Following an issue I opened in github, this bothers me. The operation described in the issue, which happened during following avsa's tutorial on creating a DAO, generated two internals transactions as ...
5
votes
1answer
309 views

Do nodes by default relay transactions that fail and spend all gas (e.g. Solidity throw)?

How do nodes (not necessarily miners) treat transactions that result in Solidity throw (i.e. Out Of Gas error, transaction reverted)? Such transactions' only effect is gas (ether) transfer from the ...
5
votes
1answer
360 views

Out of gas and atomicity

I am reading the Solidity by example voting example. I am interested in the vote contract function: function vote(uint proposal) { Voter sender = voters[msg.sender]; require(!sender.voted); ...
1
vote
1answer
205 views

What is the general cause for out-of-gas with MetaMask?

This seems like a trivial question, but I can't find an answer. When you try to send a transaction with MetaMask, it calculates the amount of gas needed. Most of the time if there's an error in your ...
14
votes
3answers
815 views

How come I need to specify a higher gasLimit than estimateGas?

If a contract call predictably requires 41043 of gas to be processed as estimated by estimateGas, how come I need to specify gasLimit of ~70000 to be processed?
8
votes
2answers
1k views

Why is an account not accepting the Ether sent to it?

If you check out the account 0xe358b3b9f29c67cb810c5184e6fde27d66ce036c you will see several incoming transactions with 100 Finney each. Yet the overall balance is 31 Finney. How is that possible? If ...
4
votes
1answer
1k views

How to minimize gas consumption during contract creation

I have trouble deploying a contract to the main network and I believe this is due to high gas consumption. An earlier version of the contract worked on the main network. The current version works in ...
3
votes
2answers
409 views

Garbage collection

For a project I model a tree with each node having some data assosiated. A property of that tree is that under some circumstances a node can get deleted, which automatically makes the whole subtree it ...