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
1 vote
1 answer
4 views

Are storage variables tightly packed like struct fields?

Tight variable packing is a known coding pattern in Solidity for saving gas by placing struct fields that are lower than 256 bits closer to one another. Does this logic apply to storage variables? ...
Paul Razvan Berg's user avatar
0 votes
0 answers
11 views

How does Gelato's Relay service work? How is it possible for another wallet to send my signed transaction (matching sender address) and pay gas?

How does Gelato's Relay service (used by gnosis safe relayer) work? How is it possible for another wallet to send my signed transaction (matching sender address) and pay gas? Does it require Gnosis to ...
Nic Szerman's user avatar
1 vote
1 answer
19 views

Why don't ETH transfers cost more when the recipient's balance is zero?

The SSTORE opcode has differential pricing depending on what the original, current, and new storage values are (see EIP-2200 for the full details). In short, the idea is that setting a zero value to a ...
Paul Razvan Berg's user avatar
1 vote
2 answers
154 views

Remove the element from array where order matters?

I am presenting my use case here. Let's think of a dating app where each candidate enters their preferences and we store their data and add them to an array. when someone enters that matches with any ...
Rashid Ul Haq's user avatar
1 vote
2 answers
32 views

Why is Transaction Value showing 0 ETH on Etherscan?

I'm not sure why the transaction value on Etherscan is showing as 0 ETH when the transaction was confirmed. According to the recipient, they haven't received anything in their wallet either and I'm ...
Dan's user avatar
  • 11
0 votes
1 answer
23 views

Read from a state variable without sending a transaction

https://solidity-by-example.org/state-variables/ the site says "you can read state variables, for free, without any transaction fee". But when I do a get - call in Remix, a transaction is ...
Forgotten Semicolon's user avatar
0 votes
0 answers
17 views

Eth::Client::ContractExecutionError - transaction underpriced

I am using the eth gem ruby library https://q9f.github.io/eth.rb/ to execute a function called from the ABI but it keeps getting the error transaction underpriced. I assume that it has something to do ...
javanoob2pro's user avatar
0 votes
1 answer
17 views

how pay network fee for many accounts

i have crypto pay getaway in my application And we only receive Tether on the (Ethereum and BSC and Tron) networks The application creates a wallet address for each user 0x123...User1 (Only USDT ERC-...
ioxoi's user avatar
  • 3
1 vote
1 answer
32 views

Optimizing Gas Costs in Solidity Smart Contracts: Best Practices?

I'm working on a Solidity smart contract and I'm concerned about the gas costs associated with its execution. I want to optimize my contract for gas efficiency to save on transaction fees and improve ...
Mehran Ra's user avatar
  • 375
1 vote
1 answer
56 views

How can I avoid out of gas on multiple eth transfers when looping addresses?

Hello everyone good day, I'm working on an automated eth distribution function that sends eth to all the nft holders of a determined collection (using ERC721A as standard for the nfts), it works well ...
baeza.eth's user avatar
1 vote
1 answer
270 views

Significant gas cost difference between store data in initial variable and change data

// SPDX-License-Identifier: GPL-3.0-only pragma solidity ^0.8.10; // when SAVE == address(0) call setSave execution cost 22622 gas // when SAVE != address(0) call setSave execution cost 5522 gas ...
imelon2's user avatar
  • 425
2 votes
3 answers
77 views

What is the purpose of (success); after a call?

I'm looking through the EIP-4337 account abstract sample repository and am not sure what the purpose of (success); is in the following function. function _payPrefund(uint256 missingAccountFunds) ...
Milk's user avatar
  • 381
0 votes
1 answer
27 views

Gas cost on mapping

I'm reading docs on Venom and they said that the problem on using mapping in ERC20 contract is "Now let's imagine that we have an erc-20 like mem-token contract with one large hashmap of token ...
dang.pm.IT's user avatar
1 vote
2 answers
51 views

Transaction fails due to: Insufficient funds for gas * price + value

I am trying to make transactions on Polygon Mainnet, but unfortunately when I automatically try to calculate the transaction fees, the transaction gets reverted because I assume that the fees are to ...
Dakata's user avatar
  • 195
1 vote
0 answers
77 views

Can I make a contract call to refund the unused gas fee to a specific address instead of the msg.sender?

Can I make a contract call to refund the unused gas fee to a specific address instead of the msg.sender? I want to use this as a means of charging fees for my project.
Benjamin's user avatar
2 votes
0 answers
24 views

Understanding the Inner Workings of eth_estimateGas in Smart Contracts

I'm seeking clarification on how the eth_estimateGas function operates under the hood. Does it run the smart contract in a manner similar to a dry run? When I make a call to eth_estimateGas, and I've ...
undefined's user avatar
  • 121
0 votes
0 answers
26 views

Is there anyway to reduce gas fee for uniswap v3 ExactOutputSingleParams?

Question is simple. Is there anyway to reduce gas fee for ExactOutputSingleParams ? function swapExactOutputSingle(uint256 amountOut, uint256 amountInMaximum) external returns (uint256 amountIn) { ...
xlogic land's user avatar
0 votes
0 answers
13 views

How to estimate gas cost to update uint256?

I have a need to update a uint256 state variable in a solidity contract that was deployed with a proxy. When calling the function to update the variable programmatically with Ethers, the total cost is ...
Vektor's user avatar
  • 101
0 votes
0 answers
31 views

How to catch the {'code': -32000, 'message': 'gas required exceeds allowance (0)'} exception in we3.py?

I'm using the estimate_gas method to get the gas estimate for the tx that I'm sending and in case balance < gas estimate I wanna trow an exception. try: gas_estimate = self.w3.eth.e(...
user124283's user avatar
0 votes
1 answer
41 views

Where do arbitrum gas fees go?

Similar question to here except, based on the arbitrum docs: ⚠️ Note: There is no protocol level incentive to run an Arbitum full node. I know the sequencer gets paid some amount of the fee, but I ...
Patrick Collins's user avatar
1 vote
0 answers
19 views

Reduce gas price?

I'm working on a sniping bot on uniswap, and i have a little problem : the first ones to buy are those who pay the most. Pretty logical, but I don't really want to pay 300$ in priority gas to be the ...
Newly Sama's user avatar
0 votes
0 answers
22 views

Simple function causing very high gas fees solidity

Hello everyone i just recently dpeloyed my first main net contract. Now on solidity and locally all the fees looked good and it was quite minimal. I have this function which creates a bet and just ...
Wesley van S's user avatar
0 votes
0 answers
12 views

Web3.py: 'intrinsic gas too low', how to select gasPrice and gas?

In previous question on the forum this issue was already discussed, but it does not address another one: how to select gas and gasPrice so that you wouldn't bet all wallet's money and transaction ...
EndOfTheGlory's user avatar
0 votes
0 answers
51 views

Execution Error - ERC20: Transfer Amount Exceeds Balance in Ethereum Smart Contract

I'm encountering a perplexing issue while working on an Ethereum smart contract. It seems to be a parameter related error, but I haven't been able to rectify it. The following error message is ...
Joe B's user avatar
  • 3
0 votes
1 answer
94 views

unpredictable gas limit error doesn't go away after setting gasLimit manually

I have this contract which is written in solidity and one of the functions (getMyActivity()) returns an array of structs and im trying to call it from my frontend which is written in ReactJS but i get ...
Shadq's user avatar
  • 83
0 votes
0 answers
17 views

`gas` vs. `gasLimit` fields

I am trying to submit a transaction with a gas limit set. In the documentation, I find a field referred to as gasLimit with the following description gasLimit – the maximum amount of gas units that ...
davidsawyer's user avatar
1 vote
2 answers
21 views

How to populate large integer arrays in Solidity?

I'm currently building an NFT fantasy league game on ethereum where I want to add the functionality of on demand minting of random tokens. For that I need to keep track of the tokens that are ...
Inshal Aamir's user avatar
0 votes
1 answer
90 views

How to correctly specify maxPriorityFeePerGas?

I am trying to send a transaction quickly by adding a priority fee that is half the base fee with the following logic: const { baseFeePerGas } = await client.getBlock(); const priorityFee = ...
Sam Scolari's user avatar
0 votes
0 answers
16 views

Why does my transaction not start with full gas?

Im trying to optimize the gas costs of my smart contract, and noticed a large chunk called "Initial gas" in the tenderly debugger. Upon digging further, I confirmed that the function call ...
Tilman Kieselbach's user avatar
0 votes
1 answer
69 views

How much does it cost to clog the Ethereum Network exactly?

Currently the largest gas guzzler to clog the Ethereum network is the Mint contract below. Supposedly there are users purposely causing high gas prices using this function. Why would anyone do this ...
Patoshi パトシ's user avatar
0 votes
0 answers
17 views

Set the correct spender when calling gasless transferFrom from another contract with GSN

Actually I'm trying to figure out the best way to implement gasless call to transferFrom of a ERC-20 token. I'm not very familiar with GSN so maybe it could be a best way to achieve this. I wrote a ...
viac92's user avatar
  • 33
0 votes
1 answer
10 views

What is the recommended gas limit when minting NFTs on Ethereum?

I was trying to mint 70 NFTs at once and I set a limit of 8,700,000 but ran out of gas (wasted $300). What is the max limit we should set?
ratib90486's user avatar
0 votes
0 answers
32 views

BSC Testnet and ETH Testnet, I want to copy/fork a contract in eth which is evermoon, but I always get an error with the gas and it always fails

This is the error it gives me, can you help me fix this problem, I adjust the gas limit, it started from 3000000, to 30000000, but still the transaction failed. I tried in bsc testnet using ...
Penny Coin Hunter's user avatar
0 votes
2 answers
27 views

Smart Contract runs 1-2 times then runs out of gas afterwards

I am creating a smart contract that will mint new trading card NFTs, for some reason the minting contract can only run 1-2 times before encountering (what I presume is) a runtime error and using up ...
airza's user avatar
  • 1
0 votes
1 answer
22 views

Efficient techniques for updating common fields in multiple smart contracts with minimized gas fees

I have multiple smart contracts that share a common structure, each containing two fields: destination and owner, which hold the same values. I would like to update the destination or owner values for ...
softweng's user avatar
1 vote
2 answers
139 views

Which of <= and < comparison operators use less gas in Solidity?

if(num <= 10) revert(); And if(num < 11) revert(); Which of these statements consume less gas? If we could save gas, we need not use less than/greater than equal to. We can just use less than ...
Pankaj Jagtap's user avatar
0 votes
0 answers
37 views

Why is remix giving me gas estimation errors when I am sending more gas than the transaction needs?

I am running a contract in remix and only my getBalance() function is working. Specifically my requestFlashLoan, approveUSDC, and approveDAI are all failing due to gas. I sent the transaction even ...
JaySnel's user avatar
  • 55
0 votes
1 answer
42 views

How to fix gas issue

Contract address: 0x2138fF6dB5125F68E69152679D340c09d09eDEF0 USDC token address goerli: 0x9FD21bE27A2B059a288229361E2fA632D8D2d074 I sent USDC to the contract which I can see it when I invoke the &...
JaySnel's user avatar
  • 55
2 votes
0 answers
48 views

EIP-1559 transaction classification on etherscan

I am wondering how I can detect the type of transaction submitted on Ethereum based on EIP-1559 adopted or not. Thank you
Motiv's user avatar
  • 21
0 votes
1 answer
15 views

Buying ethereum on Metamask or Coinbase

What is the cheapest way to buy ethereum? Straight through metamask or through coinbase and then transfer it to metamask?
user122032's user avatar
0 votes
0 answers
26 views

revert statement causes infinite gas estimation in Remix

I wrote an Ownable contract snippet that uses revert instead of require on the OnlyOwner modifier. This causes remix to estimate infinite gas fees. Does anyone know why? // SPDX-License-Identifier: ...
Shoesoft's user avatar
0 votes
0 answers
30 views

Does ERC-4337 require an update to the network?

My understanding was that we needed to update the network so that contracts can sign transactions and messages, and so that contracts can be called with just a secret key or other auth methods, rather ...
Eric's user avatar
  • 43
0 votes
0 answers
20 views

Fantom cannot approve spending USDC token

I am doing simple approve operation on USDC token in Fantom network. Here is my payload: functionParams { from: '0xd775b00b5cf6e954aed8408202367a1bae6ac55f', to: '...
Oleksandr Tserkovnyi's user avatar
1 vote
0 answers
30 views

Who pays for the L1 gas costs of ZK-rollups?

I have deployed the same smart contract on both the Goerli Testnet and the Polygon zkEVM Testnet. When I execute the same interaction, it costs the same amount of gas on both networks (as expected), ...
Abel's user avatar
  • 53
0 votes
0 answers
20 views

ERC 20 Remix Gas Allowance ERROR

I have this basic contract made on Openzeppelin Wizard, but everytime I try to deploy it on Mainnet i get the same error " exceeds gas allowance". I succesfully deployed it on Goerli. I've ...
Paul Suciu's user avatar
1 vote
0 answers
22 views

How to empty a wallet after the London Upgrade?

Is it possible to empty an account after the London upgrade and if yes, how? If I understand it correctly, I have to pay BaseFee + FeeTip and I know that a simple TX would consume exactly 21000 Gas. ...
James's user avatar
  • 11
0 votes
0 answers
41 views

Can EOA accounts interact with ERC-4337 paymasters?

My question is rather simple. Can an EOA account pay some coins using ERC-4337 paymasters without having to pay gas fee itself? Is there any way, having access to an EOA private keys, to withdraw ...
eddie cooro's user avatar
0 votes
1 answer
92 views

Editing genesis file in geth Clique

I'm working on project using the geth clique. I have 4 nodes running on the network. I created the 5th node with: geth --datadir node5 account new I have edited the genesis.json to add the account ...
Amxdz's user avatar
  • 1
1 vote
1 answer
114 views

Prioritize Ethereum Transaction

What would be a good strategy to prioritize a transaction given the EIP-1559 definitions: Base Fee: minimum fee a transaction must pay to be a valid transaction. The Base Fee changes per block, ...
Kob3Bryant's user avatar
1 vote
2 answers
363 views

Why ETH gas fee is still expensive >$5 - $10 after sharding + POS?

I just notice that ETH charges $40 for a tx at the time POW + high demand $5-$10 at the time POW + avg low demand And $5-$10 at the time POS + low demand (current 2023) So can you explain more why the ...
Neo.Mxn0's user avatar
  • 113

1
2 3 4 5
34