Questions tagged [gas-refund]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0
votes
0answers
17 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. ...
0
votes
0answers
11 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 ...
0
votes
1answer
18 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 = ...
0
votes
1answer
414 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 $...
0
votes
0answers
208 views

I lost 2 ETH! I successfully cancelled my transaction, but the 2 ETH was never returned

public address: 0x6ac5EF890224e2699a89810F0bd2DED90d74Ab37 first Hash tx: 0xfeb6c486a8f17a8b4216bbd2069429a285a1c5da8d15e98d3d66e6bf5488a866 I tried to swap for a coin on uniswap, but it took 7 hours ...
0
votes
1answer
41 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 ...
0
votes
0answers
34 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 ...
0
votes
1answer
108 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....
1
vote
1answer
24 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 ...
3
votes
1answer
202 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. ...
0
votes
1answer
107 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 ...
3
votes
2answers
462 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?
0
votes
1answer
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 ...
1
vote
1answer
38 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? ...
0
votes
1answer
352 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....
0
votes
1answer
239 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 ...
1
vote
1answer
338 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'; ...
0
votes
0answers
47 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 ...
1
vote
1answer
35 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?
1
vote
1answer
1k 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 ...
0
votes
1answer
111 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 ...
2
votes
0answers
43 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 ...
0
votes
1answer
109 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 ...
4
votes
2answers
295 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 ...
1
vote
1answer
424 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?
1
vote
1answer
246 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 ...
2
votes
4answers
195 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??...
1
vote
1answer
168 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 ...
1
vote
0answers
321 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 ...
0
votes
1answer
61 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 ...
2
votes
2answers
177 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 ...
1
vote
2answers
361 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
3
votes
2answers
495 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(...
0
votes
2answers
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 ...
0
votes
2answers
765 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 ...
1
vote
1answer
100 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 ...
0
votes
0answers
296 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 ...
4
votes
0answers
121 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 ...
8
votes
2answers
1k 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 ...
3
votes
0answers
219 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 ...
6
votes
1answer
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 ...
6
votes
2answers
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, ...
18
votes
1answer
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 ...
14
votes
3answers
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?
5
votes
1answer
859 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 ...
22
votes
3answers
6k views

How do gas refunds work?

Gas refunds are provided when clearing storage or calling SELFDESTRUCT on contracts. The Yellow Paper mentions that refunds are "being capped up to a maximum of half...". What exactly is ...
22
votes
2answers
2k 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 ...