Linked Questions
22 questions linked to/from How do gas refunds work?
0
votes
2
answers
702
views
How are gas refunds "payed"? [duplicate]
I have a doubt about the gas refund concept.
Imagine that I created a smart contract 1 month ago and now I want to call the SELFDESTRUCT
because I want to send the current balance to an address and ...
1
vote
1
answer
71
views
If gas is refunded, is it required to call? [duplicate]
Suppose a smart contract external function uses very much gas, but refunds (with .transfer()) the used gas to the caller.
Question: Can it be called with a small amount of gas despite it uses much?
...
39
votes
3
answers
14k
views
Difference between Memory and Storage?
What is the difference between Memory and Storage ?
From both the EVM point of view and the contract design one.
Thanks!
23
votes
2
answers
3k
views
What type of operations have negative gas costs?
I understand that some operations cost negative gas because they free up space on the blockchain, such as selfdestructs. What are all the operations that can have negative gas? Does this only occur ...
18
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 ...
15
votes
3
answers
1k
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?
11
votes
1
answer
2k
views
Is the cost of updating storage different than the cost of adding to storage?
Do these have a separate cost?
sstore(1, 10) # first time adding a value to storage with this key
sstore(1, 20) # changing the value in storage.
I looked for a list of gas costs / opcodes, and the ...
6
votes
2
answers
5k
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 ...
6
votes
2
answers
2k
views
How to know, inside the contract function, the amount of gas that will be refunded in the end
Consider the following situation: my function can be divided into 2 parts
Always consumes constant gas;
Always results in a refund of 0 < R < 1500000 gas.
After the second part had happened, ...
3
votes
2
answers
1k
views
Gas refunds via “Self-destruct” prior to a revert()
In a transaction that eventually calls revert(), if prior to the revert we have SELFDESTRUCT some contracts and thus received a gas refund, does the gas refund also get reverted?
1
vote
1
answer
2k
views
Gas limit issue when transfer USDT
i have been asking by my client to save ETH when transfer out his USDT, he hope there is no or very little ETH left in his new USDT address. Please assume that USDT address has no initial ETH and next ...
4
votes
1
answer
287
views
Rationale Behind Ethereum's Data Storage Scheme
1) Why does Ethereum store data in 32byte chunks? I don't suppose this to be some backward-compatibility left-over; is it? We could store data in variable length fields as well.
2)I don't think ...
4
votes
2
answers
362
views
Understanding the formal description of a transaction and its associated refunds
Excerpt from page 8 of the yellow paper:
I fully understand that contracts can self-destruct and, when that happens, according to this thread, all the balance is refunded to the address specified as ...
5
votes
1
answer
137
views
Is it possible to use negative gas to execute a Reentrant attack using .send()?
Haven't tested it out but I think in theory this could work. It might work somehing like this:
An attacker first writes a lot of data to storage so there is data to be deleted.
Using .send() in the ...
0
votes
3
answers
327
views
Is there any alternative for for loop?
I have used in burn() function of NFT Contract.
function burn(address to, uint256 tokenId) external {
require(_exists(tokenId), "Contract: operator query for nonexistent token");
...