Skip to main content
Share Your Experience: Take the 2024 Developer Survey

Questions tagged [gas]

Gas is a 'sub-currency' which enables the EVM and Ethereum's decentralised computer to run -- with each operation, an amount of gas (proportional to the computational effort required to perform the operation) is consumed.

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

Trying to deposit ETH to my contract with Chainlink Functions. Getting gas estimation errors

We were not able to estimate gas. There might be an error in the contract and this transaction may fail Keep getting this error when I am trying to deposit to my contract that is using Chainlink ...
eik's user avatar
  • 3
2 votes
0 answers
16 views

Gas cost of simple ETH transfers on Arbitrum

Historically, Arbitrum enforced a minimum of 400k gas for transactions. Here's an example of a simple ETH transfer I performed in July 2023, which cost ~411k gas: https://arbiscan.io/tx/...
Paul Razvan Berg's user avatar
3 votes
1 answer
20 views

How are the base fee and the blob base fee trustlessly relayed from Ethereum to Optimism?

I was reading Optimism's docs on Transaction Fees, and I noticed these statements: The L1 Data Fee is most heavily influenced by the Ethereum base fee that is continuously and trustlessly relayed ...
Paul Razvan Berg's user avatar
1 vote
1 answer
176 views

Is there a way to make the user pay "aggressive" gas fees automatically instead of them choosing that in MetaMask?

I am having issues with MetaMask in my DApp because users are using wrong or invalid RPCs. Is there a way of making users add a network automatically to MetaMask with the right RPC and override the ...
Falcon Stakepool's user avatar
2 votes
1 answer
75 views

Do all EVM chains use the same minimum transaction gas of 21000?

Do all EVM chain use 21,000 gas as a minimum transaction gas for simple ETH payments? Optimism seems to do so. How about the other EVM chains?
Paul Razvan Berg's user avatar
1 vote
0 answers
16 views

Ethereum RETURN opocde memory expansion cost

I am currently implementing a version of the ethereum EVM and am running into a problem when implementing memory expansion costs for the RETURN opcode. When returning data from addresses outside the ...
max-wickham's user avatar
0 votes
1 answer
19 views

Why can't I buy ETH on Rice Wallet?

I don't have much experience with crypto and I quickly came across a problem. I have a USDT balance on my wallet on the Rice Wallet app. I need ETH, but I can't exchange the USDT for ETH. A message ...
Christian's user avatar
1 vote
1 answer
27 views

Storage ops / gas spent

Is it possible to know the amount of storage operations (or gas spent) that are between, let's say 4 functions, or a full contract? Is foundry capable of this? Thanks!
dNyrM's user avatar
  • 918
0 votes
0 answers
12 views

Start Native address took my Ethereum instead of my Remix bot [duplicate]

After watching a youtube video on a certain ethereum bot I followed the instructions and somehow found that the money was sent to some start native address and wasn't being used by my bot. I was ...
Graham Losken's user avatar
1 vote
2 answers
96 views

No Gas Consumption for Computations not changing the State of the Blockchain

From my understanding, a Solidity function running on a compatible EVM that doesn't change the state of the blockchain will not cost any gas. And this indeed appears to be the case, as I have ...
JF0001's user avatar
  • 291
0 votes
1 answer
20 views

Convert the following address sum function to optimized assembly via both memory and storage. Slots are dynamic

I'm looking to convert the entire function getCurrentSupply() to assembly code as the potential gas savings in this use case are significant. Note that everything should be within a single assembly{} ...
Ashraile's user avatar
  • 125
0 votes
2 answers
36 views

How to further improve Safemoon's reflection token transfer? (ERC20/BEP20)

We all know Safemoon's iconic reflection token code, giving every holder a percentage of every fee on buy / sell. I've already simplified and improved the gas efficiency and the token logic quite a ...
Ashraile's user avatar
  • 125
0 votes
1 answer
16 views

Would small integers saving gas in a struct?

I have a mapping to structs which contain multiple timestamp struct Entry { uint256 createdAt; uint256 solvedAt; uint256 canceledAt; ... } mapping(address => Entry) _entries; ...
seven7e's user avatar
  • 101
0 votes
0 answers
45 views

Zero gas fee for transactions

I saw some people on ethereum and bsc chain that execute transactions paying 0 gwei per gas. How is it possible and how to do the same thing?
John's user avatar
  • 11
0 votes
0 answers
27 views

Why does transaction value have impact on transaction fee in Ethereum?

I am sending a transaction to Sepolia test network from browsers. The code I have is something like: provider.request({ method: 'eth_sendTransaction', params: [ { ...
Joey Yi Zhao's user avatar
0 votes
0 answers
18 views

Evaluating Cost Saving Potential Layer1 to Layer2

I am trying to evaluate cost savings when using a Layer 2 Blockchain network compared to Ethereum/Layer1. Currently i do not necessarily make use of L1/2 inter-communication, so just deploying and ...
AirUp's user avatar
  • 363
0 votes
1 answer
36 views

Is it possible to create a transaction as an admin and send it but with someone else paying for the gas fees?

I have a mintToken method in my smart contract that is onlyAdmin. The problem I have is that I don't want to pay for the transactions for my users every time I execute this function (and it also can't ...
Falcon Stakepool's user avatar
0 votes
0 answers
44 views

Web3 validator found 1 error[s]: must NOT have fewer than 1 items

I am using wagmi web3 modal in my project. Recently, I have been getting error in my code. Code: const gasLimit: any = await contract.methods[method] .apply(null, Array.prototype....
Shubham Sharma's user avatar
0 votes
0 answers
7 views

what would happen to a transaction only has base fee without tip

When sending a transaction to Ethereum network, the total gas you pay is divided into two components: the base fee and the priority fee (tip). A transaction that only pays the base fee is technically ...
Joey Yi Zhao's user avatar
0 votes
0 answers
18 views

How to send entire account balance to another address on Base

The below code is what I used to transfer entire account balance to other address on the ERC20 network and it works fine on it, but not on Base. Maybe it's because Base has different transaction fee ...
Zero's user avatar
  • 103
0 votes
0 answers
35 views

Replacement fee too low, Base Sepolia

This is the code I have for sending a transaction on Base Sepolia. I am using this to split the balance in my account into two halves and sending each half to an address one by one. export async ...
Zero's user avatar
  • 103
0 votes
0 answers
14 views

Counting gas for a contract function execution - growing storage mapping structs

I want to count (not estimate for that I would use web3 API) gas per contract function execution - suppose there is a contract with two mapping structs where one is nested in the other. Something like:...
Santorini's user avatar
1 vote
0 answers
14 views

Feasibility of Manipulating (Increasing) Ethereum's Basefee (Gas Price)

Has anyone explored how feasible it is to manipulate the block.basefee (i.e., the gas price) on Ethereum? After running some numbers, it seems more achievable than initially thought. Consider this: ...
DaveTheAl's user avatar
  • 111
0 votes
2 answers
29 views

Why out of gas if it doesn't consume that much in the end?

I tried modify gas limit to a number I checked it should be enough to run transfer on USDT (62,800) but failed with "out of gas" error. When I send another transaction without modifying ...
zklim's user avatar
  • 1
1 vote
1 answer
53 views

Is it possible to check the gas fees for a contract before executing the contract itself?

Is it possible to check the overall gas price of a transaction before executing the contract? I'm trying to implement some arbitrage trade through a smart contract that would find me price ...
Esko918's user avatar
  • 113
0 votes
1 answer
64 views

What's the value of "gasLimit = 21000" of Ethereum in Polygon?

In Ethereum the gasLimit is 21000. The constant. I haven't found anywhere the value of it for Polygon, though. How much is it? For a token as well as for MATIC itself. I've found the number 57000 on ...
kriss100's user avatar
1 vote
1 answer
122 views

What is the maximum of transaction gas limit?

I have some bulk calculations in a contract, so I used a function that compare the gas left with a constant value and save the current state. At the next time it continues the calculations until it ...
Alireza Zojaji's user avatar
0 votes
1 answer
24 views

maxFeePerGas, is this per gas unit? or per the gas the tx needs?

Let's say I have a tx that requires 10,000 gas units. Let's say I want to pay upto 50gwei per gas unit. When I send maxFeePerGas, do I set it to: 50 * 10^-9 ? // i.e. 50gwei, as in "this is the ...
shaharsol's user avatar
  • 561
0 votes
1 answer
35 views

How to transfer entire address balance to another address

After going through the questions here and here I came up with the code below to transfer the entire balance from one address to another using web3.js. export async function sendTransaction( ...
Zero's user avatar
  • 103
0 votes
0 answers
16 views

Forge test estimates less gas than the real transaction

I noticed that using forge test, the estimated gas used tends to be much less than the real gas used. Taking for example this transaction in Ethereum mainnet: https://etherscan.io/tx/...
quantoor's user avatar
0 votes
0 answers
10 views

Why remaining gas increase after some opcodes

I use debug api of go ethereum to get traces of transactions. The api document shows that field gas represents the amount of gas remaining in the transaction at the current step of execution and field ...
Zoey's user avatar
  • 1
0 votes
1 answer
22 views

Paying fees in custom ERC20 tokens in MATIC blockchain

I came across a statement that I find quite undoable. How can you pay the fees using your custom token in MATIC? Is this doable or am I missing something?
Allennick's user avatar
  • 253
0 votes
1 answer
139 views

Overwrite sweeper bot transaction with higher gas price

Is it possible to beat sweeper bot transactions by creating a tx with the same nonce but higher gas price? From what i understand, block builders are incentivized to pick tx with higher gas fees. ...
kevin janada's user avatar
0 votes
1 answer
23 views

Transaction fees too high for swapExactETHForTokens

I've written a script to buy tokens in javascript. The issue is I keep getting an error showing abnormally high transaction fees. This is my script const buyFunction = this.pancakeContract.methods....
ahabsy's user avatar
  • 1
2 votes
1 answer
31 views

What is the most efficient way of whitelisting at this moment in solidity?

Normal whitelisting setter functions are the most basic ones, I came across two more ways, Merkle Tree and signature-based whitelisting. The question I had is: Are the gas usage differences among ...
Zartaj Afser's user avatar
  • 4,271
1 vote
1 answer
19 views

Transaction within block gas limits: Will it possibly run out of gas?

Is there any risk in running a transaction that needs quite some gas, even if always within the borders of block gas limits? Let's say 20M, with block limit being 30M. The transaction runs complex ...
user130657's user avatar
0 votes
1 answer
19 views

Can I use a faucet for my application

I am implementing the blockchain into the web app to track user's work with one another and plan to have tokens within the smart contract to exchange with one another. The user who deploys the ...
Zhi's user avatar
  • 11
1 vote
0 answers
23 views

How do users avoid paying gas fees?

I have this web app implemented in React typescript where users can create posts and in return for fulfilling these posts, they gain credits from the other users. These credits are stored on the ...
Zhi's user avatar
  • 11
2 votes
1 answer
28 views

What is the gas cost of this function?

I have this contract contract Contract { function a() external { assembly { return(0, 1000000) } } } I am calculating the gas cost for a call to a. Following https:...
alain's user avatar
  • 41
0 votes
0 answers
172 views

MetaMask Gas Estimation Error in Staking dApp: "We were not able to estimate gas" without Sufficient Native Tokens. Big gas fee

I'm developing a staking dApp and have encountered a peculiar issue with MetaMask when attempting to execute transactions without sufficient native tokens in the wallet. MetaMask displays the error ...
Nikola Skadric's user avatar
2 votes
1 answer
89 views

How to reduce gas consumption in ZKP function

I use this ZKP library inside one of my functions joinChallenge and it consumes alot of gas. I'm curious to know what options I have for reducing gas consumption of this verifier library or ...
Ibra's user avatar
  • 71
1 vote
1 answer
71 views

Using Solidity Library

contract SomeCon { using SomeLib for uint256; uint256 a = 2; uint256 b = 3; function addNum() public view returns (uint256) { return a.add(b); //add() is a function in ...
Asif5566's user avatar
2 votes
2 answers
78 views

Is it possible to charge unused gas as fee?

guys! I am creating my own web 3 project and now I am stuck with charging fee from users. I have 2 options to do it: take percent of user's tokenIn (or tokenA), but in this case user is getting less ...
Kind_Man's user avatar
0 votes
1 answer
20 views

Can not deploy a contract in a private clique " Not enough gas left for transaction"

I have installed geth version 1.13.8. Genesis block: { "config": { "chainId": 212121, "homesteadBlock": 0, "eip150Block": 0, ...
Sole's user avatar
  • 1
0 votes
1 answer
21 views

Why does adding a new external function increase gas for calls to all other functions?

I have added a new external function to my Solidity smart contract. When checking the gas usage for calls to other already existing external functions, I see the gas usage has increased slightly. Does ...
UpsideDown's user avatar
0 votes
0 answers
13 views

Reducing Ethereum gas costs for crypto exchanges using layer 2 platforms

As I researched on reducing Ethereum gas costs for crypto exchanges using layer 2 platforms, the use of these platforms is beneficial for an crypto exchange when the users of that exchange, after ...
Alireza's user avatar
  • 547
0 votes
1 answer
51 views

Wrong network at the transaction

I transfered 1000 usdt to ethereum network mistakenly from bnb network and i lost them. Can you help me with the solution to recover them please? i transfered them from binance to revolut
konstantinos's user avatar
0 votes
1 answer
23 views

SSTORE to stockpile gas for times of high prices?

lets assume Gas drops to 5 GWei. I could have a contract, which performs a bunch of SSTORE operations. 20k Gas each Now, assume Gas increases to 50 GWei. Now I will empty the storage slots SSTORE[x] = ...
Derawi's user avatar
  • 101
0 votes
1 answer
69 views

Why this code report a Gas estimation failed error in remix?

Both two functions(callReplAuction and testswapToPFIL) report Gas estimation failed error in the remix! You could deploy this code in any blockchain network and could use any address in the function ...
user3034768's user avatar
0 votes
0 answers
11 views

Friction costs of storing data in a second smart contract

Whats the difference in terms of Gas of the two Scenarios described below? How much are the friction costs of storing data in a second contract compared to storing the number in the contract in which ...
PupSt4r's user avatar
  • 59

1
2 3 4 5
35