Questions tagged [gas-refund]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0 votes
1 answer
10 views

Can you create and destroy a contract in a single transaction?

Is it possible to create and destroy a contract in a single transaction? Specifically could I: deploy to a known address using CREATE2 call a function on that contract destroy the contract and ...
user avatar
0 votes
1 answer
18 views

Does it cost gas to cancel a transaction? Can I replace / speed up the transaction to just 1 gwei then cancel to reduce fees?

My transaction is stuck, but can I speed it up by replacing the fee with 1 gwei then cancel it to reduce the fees to cancel? I tried to cancel and speed up but its still stuck. I check etherscan and ...
user avatar
0 votes
0 answers
17 views

Is there still gas refund for SSTORE to 0 instructions?

I'm trying to optimize a contract and wondering if I can still rely on gas refunds to optimize for gas? https://twitter.com/n2ckchong/status/1365843261567365121 I've read from this tweet that there ...
user avatar
0 votes
1 answer
17 views

What happens when creating contract but out of gas? [duplicate]

I am new to ethereum. I have learned that all states will be rolled back if out of gas. Assuming that there is a transaction with value field, but it runs out of gas. Will the value be back? (i know ...
user avatar
0 votes
0 answers
41 views

Eth to SafeMoon Swap [duplicate]

I am new to crypto and recently tried to swap Ethereum to SafeMoon on the SafeMoon App. I was swapping about $185 to SafeMoon and after noticed there was a $109 gas fee! Is there a way to swap it back ...
user avatar
1 vote
0 answers
130 views

What would be the safest way to prevent paying unnecessary high gas fees for transferring USDT?

Bitfinex paid a seismic $23.7 million dollars in a gas fee for a comparatively nominal $100K transaction, link. At 11:10 UTC on the 27th September a deposit transaction was made using a hardware ...
user avatar
  • 7,599
0 votes
0 answers
18 views

Something Weird Happening w/ Blockchain, Gas fee is hold and historical ETH balance is changed [duplicate]

I am trying to send ETH from Ledger to CoinMetro account. I tried 4 times, with slow, medium and fast options. Each time it failed due to "out of gas" error. The 4th one failed immediately. ...
user avatar
0 votes
0 answers
27 views

ETH Transaction Fails but My Funds are Not Delivered Back

I am trying to send ETH from Ledger to CoinMetro account. I tried three times so far, with slow, medium and fast options. Each time it failed due to "out of gas" error. I did some research ...
user avatar
0 votes
1 answer
28 views

Is the gas usage O(1) for this code?

Is the gas usage constant for this function regardless of mapping/array size (assuming non-zero array entries)? items is an array, and presence is a mapping function clear() public { for (uint i = ...
user avatar
0 votes
1 answer
1k views

Do NFT bids, and refunds from being outbid, have the same transaction/gas fees?

If I bid on crypto art to the tun of $50 in transaction/gas fees, can I expect the same amount of fees to incur if I am outbid on that item, and the NFT platform refunds me my bid? $50 fee there, and $...
user avatar
0 votes
1 answer
129 views

How are gas refunds "payed"?

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 ...
user avatar
0 votes
0 answers
46 views

Make transactions free of charge for the user

I involved in a project that aims to create a token for public use (non blockchain familiar users). User will have an ERC20 token, but I don't want they to have ETH to pay the gas. One obvious ...
user avatar
  • 574
0 votes
1 answer
228 views

refund function in smart contract [closed]

I am looking to add a Refund function in my smart contract. Like If User A deposited 1 ETH in the contract, and uses refund function, he gets 1 ETH - Gas Fee back. I can do the transfer(address....
user avatar
  • 115
1 vote
1 answer
45 views

Do gas refunds apply in a fallback function? What is the limit for non matching function identifiers?

I know that a fallback function called with a .transfer only has gas limit of 2300. What happens if the fallback function deletes some storage variables in the fallback function? Would the fallback ...
user avatar
3 votes
1 answer
346 views

Understanding gas tokens and create2

I am going through a sample gas token code on Ethereum. The token mints some dummy smart contracts using CREATE2 and then calculates the address. Later on it destroys them to get the gas refund. ...
user avatar
0 votes
1 answer
213 views

Does self-destruct() delete contracts data from the storage as well?

Destroying two contracts: (1) contract A with 1 integer variable stored in it and (2) contract B with 100 integer variables stored in it, would result in the same amount of refund: 24000 gas. So does ...
user avatar
  • 1
3 votes
2 answers
735 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?
user avatar
0 votes
1 answer
2k views

is it possible to get gas refunded if a smart contract call fails to complete?

I am using trust wallet, and whilst using a number of exchanges (for example - uniswap, balancer liquidity pool) I have paid gas prices without the exchange actually taking place. Is it possible to ...
user avatar
1 vote
1 answer
56 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? ...
user avatar
  • 1,274
0 votes
1 answer
821 views

How to refund gas to the smart contract caller? (What is the number?)

I have this function: function setAccount(BaseUBI _ubi, address _user, uint256 _startTime, uint _esiaID, bool _setToZero) external { uint256 _refund = (gasleft() + 0/*FIXME*/) * tx....
user avatar
  • 1,274
0 votes
1 answer
338 views

Refund mechanism - How is it possible to have transactions with M$ fee?

As stated here, my current understanding is that an unused gas is refund when the transaction succeeds (otherwise it is fully consumed) Lately I found an article about some fee mistakes that led to ...
user avatar
1 vote
1 answer
908 views

How can I measure the gas used in a block of code?

This answer explains well how to measure the gas used in a block of code. I had actually been using this method before I found that answer: pragma solidity 0.4.26; import './IERC20Token.sol'; ...
user avatar
0 votes
0 answers
58 views

Which are the operations providing gas refund available immediatly for the current running transaction?

Most of gas refund operation aren’t available immediately, but instead increase the refund counter (which if I understand correctly is refunded not after the end of contract creation or call by ...
user avatar
1 vote
1 answer
53 views

Does the 10,000 refund apply to booleans too?

I understand from this thread that you're refunded up to 10,000 gas when setting a value to 0. Does this also apply to boolean values? That is, going from true to false?
user avatar
2 votes
1 answer
2k views

Is there a drawback of setting a too high gas limit for a transaction?

Say, I want to send a transaction that consumes around ~40,000 gas. Could I just set the gas limit of the transaction to 1 million or is there some disadvantage and I should set a more realistic gas ...
user avatar
  • 117
0 votes
1 answer
166 views

Which `EVM` bytecode is actually used to "deposit" the transferred Ether?

A quick question. Which EVM opcode is actually used to "deposit" the transferred Ether into the contract? From the EVM opcode list, there are only two opcodes related to the fund transfer: balance and ...
user avatar
2 votes
0 answers
45 views

Is the refund gas paid up-front?

Excerpt from chapter 9 of the yellow paper, "Execution Model", describing the behaviour of the EMV when clearing storage: This refund is effectively paid up-front since the initial usage of a ...
user avatar
0 votes
1 answer
157 views

Gas usage higher when using the delete keyword

I'm currently working on a marketplace demo for the consensys bootcamp, you can find my entire code here. Stores inside the marketplace (which are structs) are stored inside a mapping and the keys ...
user avatar
4 votes
2 answers
342 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 ...
user avatar
1 vote
1 answer
548 views

How to use ETH GAS refund in contracts?

How can we use refunded GAS from a transaction in subsequent ETH transfers? In general, how is refunded GAS used? How can we check the status of the amount of refunded GAS?
user avatar
  • 51
1 vote
1 answer
334 views

How to use / see refunded gas in ETH blockchain?

I buy a GAStoken contract which requires say 21000 GAS at 1 Gwei and later when we delete/destroy the contract when the Gwei is around 50. I understand that we will get around 50% refund of GAS at the ...
user avatar
  • 51
2 votes
4 answers
422 views

Is our smart contract required gas,every time it executes.

form my understandings, after the first execution of a smart contract, the network will return the remaining gas to the contract sender. if so, how will the contract obtain gas for future execution??...
user avatar
1 vote
1 answer
207 views

is there any way to have a permanent refund contract for ERC20 tokens?

Im a newbie when it comes to Ethereum but from what I gather, there is a type of crowdsale where if the goal is not met, the investors can send back their tokens and get a refund. However, this is ...
user avatar
1 vote
0 answers
346 views

Paying for gas on behalf of users?

I'm exploring ways to enable contracts/dApp owners to pay for gas on behalf of users. I know contact abstraction should enable this eventually, and the first step has been done with EIP208 which ...
user avatar
0 votes
1 answer
72 views

storage gas refund, is gas only refunded when storage is completely deleted? What if a key / value in a mapping is deleted?

I have a which tracks ids for some structs for different users. mapping (address => uint[]) usersStuff This mapping for each user can grow or shrink. If it happens to shrink to 0 for a single ...
user avatar
2 votes
2 answers
195 views

Refunding gas fomula in Ethereum yellow paper

After execution of the transaction by miner, the transactor is refunded a remaining gas. it is explained in section 6 of Ethereum's yellow paper. When calculating the amount to be refunded gas, the ...
user avatar
  • 41
1 vote
2 answers
365 views

How can I claim a refund from a failed ICO (Watertech)

My questions is about claiming a refund from a failed ICO. The ICO in question is WaterTech and the token is WATR
user avatar
3 votes
2 answers
591 views

Resetting storage slot increases gas usage although should decrease it

I have a simple contract that deletes the last element of the array: pragma solidity^0.4.11; contract GasRefundTest { uint[] myArray = [1, 2]; function deleteLastElem() public returns(...
user avatar
  • 10.2k
0 votes
2 answers
5k views

ICO refund: "Insufficient funds...account you tried to send transaction from does not have enough funds" [duplicate]

EDIT: Please note that this concern revolves around the "Contracts" portion of MyEtherWallet. I'm not trying to send funds from my account, I'm trying to recover funds for a failed ICO using the ...
user avatar
0 votes
2 answers
776 views

Can't claim EOS tokens. Problem with GAS amount when claim EOS tokens

To make story short,I participated in 167 EOS distribution period, so i've sent ETH amount to their account 0xd0a6E6C54DbC68Db5db3A091B171A77407Ff7ccf. Then i've registered my public EOS key and right ...
user avatar
1 vote
1 answer
105 views

ClaimRefund Process

One of the PreICO is cancelled so they are providing me refund of my ETH. They are asking me to enter their ABI/JSON and ClaimRefund through myether wallet under my login. Can using the Claimrefund ...
user avatar
  • 11
0 votes
0 answers
317 views

Obtaining Gas and Gas Price Solidity

I added the following two lines of code to my function: uint gas_remaining = msg.gas; //irrelevant code.... refund = refund + ((gas_remaining - msg.gas) * tx.gasprice); For some reason this is ...
user avatar
  • 243
4 votes
0 answers
126 views

Autorefill isn't working on Improved Coin code

I've been trying to write a token contract with the autorefill function, but perhaps the code for the token example on the ethereum website is somewhat outdated, because it isn't working. Did anybody ...
user avatar
10 votes
2 answers
2k views

Why does delete increase overall gas cost?

My understanding is there is a gas refund for delete and the idea is to encourage developers to remove garbage from contract states. Consider this contract with a delete-enabled index of keys to ...
user avatar
  • 50.6k
3 votes
0 answers
222 views

How to send custom tokens without ether? [duplicate]

I would like my customers to send a custom token without thinking of a certain amount of ether for gas. So I've tried the standard-token at ethereum.org. There's a way described to auto refill the ...
user avatar
  • 664
6 votes
1 answer
3k views

Is it possible to refund or cancel a contract based wallet transaction?

Is it possible to refund/cancel transactions? I have sent Ether to a merchant and the funds are away from my wallet, but the merchant said I used a wrong wallet... (I sent from my contract wallet ...
user avatar
  • 61
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, ...
user avatar
18 votes
1 answer
7k 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 ...
user avatar
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?
user avatar
  • 845
6 votes
1 answer
912 views

How can contracts be designed to use gas refunds?

A transaction may have some gas refunds, but such refunds can only be used within the transaction: the gas refund is not converted to ether and refunded to the sender's account. How can contracts be ...
user avatar
  • 77.9k