Linked Questions

0 votes
2 answers
906 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 ...
Josep Bové's user avatar
1 vote
1 answer
80 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? ...
porton's user avatar
  • 1,804
1 vote
0 answers
12 views

Self destruction [duplicate]

I am also newer to solidity. It appears there is a self destruction option for solidity. If I use that, it seems I also would be eligible to receive some gas as a refund for freeing up space in the ...
user2459331's user avatar
40 votes
3 answers
15k 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!
Hcharlanes's user avatar
  • 1,135
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 ...
DirtStats's user avatar
  • 656
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
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
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 ...
Broseph's user avatar
  • 695
6 votes
2 answers
6k 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 ...
Teleporting Goat's user avatar
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, ...
Oleksii Matiiasevych's user avatar
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?
Ben Schoeler's user avatar
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 ...
Atlas Chiew's user avatar
4 votes
1 answer
290 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 ...
Vega4's user avatar
  • 323
4 votes
2 answers
377 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 ...
Paul Razvan Berg's user avatar
0 votes
1 answer
392 views

Why does changing a storage slot's value from zero to non-zero cost more than non-zero to non-zero in the sstore opcode?

Why does changing a storage slot's value from zero to non-zero cost more than changing from non-zero to non-zero, zero to zero, or non-zero to zero?
Paul DeLucia's user avatar

15 30 50 per page