Skip to main content

Questions tagged [out-of-gas]

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

Filter by
Sorted by
Tagged with
27 votes
4 answers
6k 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?
Peter Hall's user avatar
40 votes
2 answers
18k 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 ...
BokkyPooBah's user avatar
  • 40.3k
19 votes
1 answer
8k 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 ...
BokkyPooBah's user avatar
  • 40.3k
9 votes
2 answers
3k 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: ...
Satoshi Nakanishi's user avatar
21 votes
1 answer
846 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 ...
eth's user avatar
  • 86k
18 votes
1 answer
8k 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 ...
zanzu's user avatar
  • 5,360
15 votes
5 answers
5k 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?
Paul S's user avatar
  • 4,281
13 votes
2 answers
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 ...
Niran Babalola's user avatar
21 votes
3 answers
5k 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 ...
ZMitton's user avatar
  • 2,770
4 votes
2 answers
4k 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 ...
tanmay's user avatar
  • 428
22 votes
5 answers
42k 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, ...
knocte's user avatar
  • 1,949
1 vote
1 answer
192 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 ...
Patricio's user avatar
  • 349
4 votes
1 answer
528 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; ...
Prashant Prabhakar Singh's user avatar
3 votes
1 answer
9k 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 ...
user9687's user avatar
2 votes
1 answer
627 views

Transferring ETH from contract to Safe

I made a small oversight and didn't account for the Berlin hard fork which increased gas costs for transferring ETH between contracts. I reused a previously tested withdrawETH function that works with ...
Ape Toshi's user avatar
  • 311
1 vote
2 answers
2k 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; ...
Prashant Prabhakar Singh's user avatar
13 votes
1 answer
3k 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 ...
fair glu's user avatar
  • 365
11 votes
4 answers
10k views

simulate transaction without sending to blockchain

Is there any way to simulate a transaction without sending it to the blockchain and find the exact error (or line of code), in case it fails if its mined?
Sowmay Jain's user avatar
9 votes
2 answers
591 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 ...
eth's user avatar
  • 86k
6 votes
2 answers
4k views

How does a Smart Contract know the gas/fees needed to execute a transaction?

I installed recently Solidity for Visual Studio and they have this Smart Contract sample there: contract Payout { address Victor; address Jim; address Kieren; mapping (address => uint) ...
Resten's user avatar
  • 533
2 votes
1 answer
2k 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 ...
KaHei Chan's user avatar
1 vote
2 answers
5k 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 ...
Billie's user avatar
  • 133
27 votes
7 answers
21k 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 ...
Bush's user avatar
  • 445
15 votes
3 answers
2k 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?
Ales's user avatar
  • 915
15 votes
2 answers
19k views

Error: VM Exception while processing transaction: out of gas

I am running into out of gas exception while calling this function : contractInstance.createProposal("ADHD", "Foo", 2, {from: web3.eth.accounts[1]}) . I'm super new to ethereum and I would really ...
itachi's user avatar
  • 153
11 votes
1 answer
1k 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 ...
kobigurk's user avatar
  • 413
8 votes
2 answers
3k 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 ...
eth's user avatar
  • 86k
8 votes
2 answers
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 ...
q9f's user avatar
  • 32.9k
5 votes
1 answer
419 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); ...
Randomblue's user avatar
  • 2,620
5 votes
1 answer
491 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 ...
mazi's user avatar
  • 443
5 votes
1 answer
2k 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 ...
Max Binnewies's user avatar
5 votes
3 answers
4k views

ERC20 :: Transferring tokens without sender gas

Let's assume we have 50 ERC20 tokens that we would like to support (deposits) on our website. People are depositing tokens to the ETH adresses we've generated for them. In the end of the day, we want ...
susanoo's user avatar
  • 51
4 votes
1 answer
360 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 ...
Denis's user avatar
  • 911
3 votes
2 answers
607 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 ...
Markus Knecht's user avatar
3 votes
0 answers
508 views

Catch Internal Out of Gas Exception in Solidity Code

I ran this transaction which executed correctly, but one of the internal calls gave me back an out of gas error. I had a try/catch mechanism to let my code terminate silently (to set some really ...
Jason Trump's user avatar
2 votes
0 answers
496 views

Is gasleft() the best way to manage big loops in solidity?

I'm developing an Smart Contract that has to iterate through an undetermined size list of ERC20 tokens, and make a swap for each token. I'm aware that you cannot loop an undetermined size list, ...
Alexander Herranz's user avatar
1 vote
1 answer
2k views

Ganache: out-of-gas during deployment

I have a bunch of contracts which deploy just fine. Deployment of one of the contracts, XBRNetwork takes exactly 5418911 gas - no problems with that. However, once I add another trivial (public) ...
oberstet's user avatar
  • 175
1 vote
2 answers
582 views

transaction fails due to out of gas in mainnet

Transaction fails due to out of gas though gas used by transaction is 22.32 % . What might be the reason ? I have give enough gas : 203000 wei. Here is the link of the transaction
ToniyaSundaram's user avatar
1 vote
1 answer
627 views

Remix IDE - transact to ___ errored: VM Exception while processing transaction: out of gas

pragma solidity ^0.4.18; contract Testing { address public owner; function Testing() public { owner = msg.sender; } function() public payable { } function withdrawAll() public { ...
Mars Robertson's user avatar
1 vote
1 answer
424 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 ...
Teleporting Goat's user avatar
1 vote
1 answer
475 views

Status is Successful but got internal transaction out of gas?

I call a function with the transaction like this https://ropsten.etherscan.io/tx/0x7d4dec3c0db2b700efae63ef3ffb5a33fc2335bd992fd37c48aa10560eb8156e this fuction is a call from other contract,I wrote ...
Timmy Chien's user avatar
0 votes
1 answer
544 views

How to estimate gas usage?

Please stop me if I am wrong. When we call any "state-changing" function of smart contract, this function will be run by all the miners of the mainnet. As a caller, I need to pay this using ...
Emrah's user avatar
  • 1,664