Skip to main content

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
12 views

Why reduce security checks or use `unchecked` to save only a small amount of gas? How significant is the benefit?

I found several different token contracts, some of which add security checks to all operations, while others omit checks for operations that are unlikely to overflow. I would like to know if the gas ...
qy H's user avatar
  • 1
0 votes
1 answer
18 views

sometimes tx.gasprice fails in sepolia, why?

I have this simple test contract to try to understand why sometiemes when I call getGasPrice() transacion fails: // SPDX-License-Identifier: MIT pragma solidity 0.8.26; contract TesterGas { ...
Agustin Gonzalez Ribas's user avatar
0 votes
0 answers
20 views

w3.eth.estimate_gas with onlyAdmin modifier

I have a smart contract function with an onlyAdmin modifier- modifier onlyAdmin() { require(admins[msg.sender], "You must be an admin to perform this action."); _; } ...
Anonymous bt's user avatar
0 votes
0 answers
25 views

Swap without gas fee on bnbchain

Does anyone know how this guy can swap with gas price = 0 gwei?
Quy Trong's user avatar
1 vote
1 answer
116 views

Ridiculous high gas fee in production (ERC20)

I was trying to create a new smart contract with Remix. It should be something like a lottery. I made a simple function to enter the lottery: > function enter() public payable { > require(msg....
W. Yatego's user avatar
0 votes
2 answers
20 views

what exactly are the limitations of the require() function concerning my custom logic

I wrote some logic for a fundraising contract function fund() public payable { // myValue = myValue + 1; require(msg.value.getConversionRate(s_priceFeed) >= MINIMUM_USD, "...
Owanemi Osaye-William's user avatar
0 votes
1 answer
18 views

External call recipient can consume all transaction gas

External call recipients consume all transaction gas, leading to transaction reversion. How to Prevent this?
Uttam Singh's user avatar
0 votes
0 answers
8 views

How to efficiently distribute governance rewards?

I want to give a token reward for every governance member who voted to a Snapshot proposal. I know that Snapshot offers a feature called Boost, which will become a paid feature after its beta phase. ...
MehmedB's user avatar
  • 240
0 votes
1 answer
27 views

Is it more gas efficient to store a string literal or its bytes representation?

I am aware that it is generally discouraged to store strings on-chain. However, in case there is no way around this, I have a few questions regarding the gas and memory efficiency of storing strings ...
rajohs's user avatar
  • 195
1 vote
1 answer
35 views

In Solidity, is division automatically unchecked?

I recently saw a Smart Contract with an unchecked division. However, I thought division was automatically unchecked, as: Biggest possible quotient = type(uint).max / 1 = type(uint).max (no overflow) ...
António Gonçalves's user avatar
0 votes
1 answer
15 views

Is it more gas efficient to delete a mappping if it maps to a bool instead of setting it to false?

Consider a mapping of some wallet addresses to a bool to check if they are whitelisted: mapping(address => bool) wallets; Is it more gas efficient to delete the mapping when a wallet is not ...
rajohs's user avatar
  • 195
0 votes
1 answer
29 views

Is there any EVM blockchain (not testnet) with 0 gas fees?

I know about SKALE, but is there any other alternatives?
Haelmic's user avatar
0 votes
0 answers
27 views

UNPREDICTABLE_GAS_LIMIT error

I am getting an error when running a script that is supposed to generate a number of wallets and fund then with a certain amount of ETH once they are created. Error: ERROR: reason: 'processing ...
user138131's user avatar
1 vote
1 answer
25 views

Trying to send as much of my balance as possible through geth console: "gas required exceeds allowance"

I'm trying to send all of my ETH balance to another address. I try to do this the following way, but always receive an error: [~] $ geth attach ipc:~/.ethereum/geth.ipc WARN [06-21|15:26:14.974] ...
bepaald's user avatar
  • 11
0 votes
0 answers
11 views

Finding cost of CHI gas token over a series of time

so I wanted to use a database I have to find the cost of the CHI gas token over a series of time. I got all the pools that have a CHI gas token, and I get data1 / data0 from all the sync events in ...
hana's user avatar
  • 1
0 votes
0 answers
25 views

EVM Transaction Issue: Inconsistent Out of Gas Errors

I'm facing issue with Inconsistent Out of Gas Errors on BSC Testnet This is fail transaction: https://testnet.bscscan.com/tx/0x669f2e8150825e9be9e0ec7da13b112691082ee43c0227afbb6b4dcbf08bec6c Although ...
CT95's user avatar
  • 518
2 votes
2 answers
149 views

Why transaction with higher gas priority fee executes later than with lower priority fee?

I have found 2 transactions, the first one is has position 1 in block and another one has position 53 in the same block, although the second transaction has more fee to pay for gas and more priority ...
sirjay's user avatar
  • 103
2 votes
1 answer
51 views

Does having identical public keys and messages for bn254 verification decrease gas cost?

I want to verify an aggregate bn254 signature. Now lets say that I am aggregating 3 identical signatures which results in a new signature. So now if I give 3 identical public keys and 3 identical ...
Surya M D G's user avatar
0 votes
1 answer
109 views

TransactionRevertInstructionError: Transaction has been reverted by the EVM

I am now trying to use addLiquidity with Uniswap V2 on sepolia testnet. I am using web3.js in truffle, but there are some areas where errors keep occurring. I have posted only the necessary code here. ...
songyujin's user avatar
0 votes
1 answer
55 views

Help ERC-20 contract, ERROR Txn: Contract creation code storage out of gas

I have created an ERC-20 token contract, and I have a problem with the gas. I must not have calculated the gas expenditure correctly, and on Etherscan, I get a warning. This is the link to the ...
UNDERDOG's user avatar
0 votes
0 answers
99 views

How to multihop swap with Uniswap V2/V3 without transfering back and forth intermediary tokens to caller?

In the case of multihop swap on Uniswap, it is convenient that pools send the output token prior to calling the swap callback. It allows to pay the first pool with the output of the last pool without ...
m0x1gir's user avatar
1 vote
1 answer
22 views

Reentrancy Vulnerability

I've noticed that the offer function uses the .call{value: amount}("") method to send Ether to the recipient's address. Could anyone provide insight into whether this function is indeed ...
serpent0x's user avatar
0 votes
1 answer
34 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
49 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
58 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
201 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
151 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
17 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
25 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
33 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
  • 938
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
102 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
22 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
46 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
17 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
94 views

Zero gas fee for transactions [duplicate]

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
29 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
25 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
67 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
134 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
12 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
22 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
96 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
15 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
15 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
33 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
  • 3
1 vote
1 answer
73 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
152 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
570 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
37 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
  • 571

1
2 3 4 5
35