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
0 answers
4 views

Does Bitcoin fee depend on amount? [migrated]

Does Bitcoin fees depend on amount of bitcoin sent ? On what factors does bitcoin fees depends on?
user avatar
0 votes
0 answers
7 views

Maximum gas estimate

eth_estimateGas provides estimated final gas consumed by transaction and accounts for gas refund in the end of transaction. However, is there a way to estimate maximum gas the transaction may consume ...
user avatar
0 votes
0 answers
5 views

How to calculate amount of gas? [duplicate]

How I can calculate gas used for transfer token for example Shiba Inu. I need to calculate it before transaction.
user avatar
0 votes
1 answer
18 views

Who pays for the gas used when reading from storage or calling pure / view functions?

I a little confused about this, i've read that pure / view functions don't cost gas / require a transaction when called, other people say that it does cost, but you're not the one pating for it. So ...
user avatar
0 votes
0 answers
7 views

What is the composition of a transaction ? (size, purpose...) [duplicate]

I want to know more about transaction : What are the components of a transaction? (theirs size and purpose) What is the size (bytes) of an Ethereum transaction? (min and max) I know there is a "...
user avatar
0 votes
1 answer
18 views

Max addresses that can be cleared from an array before breaking gas

I've been trying to properly test this for about two days with issues here and there. I got to 240, and it errored out bc of Gas when i attempted to clear.. Good thats what i wanted to see..but I have ...
user avatar
0 votes
1 answer
28 views

Different gas amount for erc20 Transfer functions

I have used Transfer function for an erc20 in different contracts with the same codes. The point is here, in different times there was different gas while the function was the same. The input of the ...
user avatar
0 votes
1 answer
13 views

Is it advisable to "wrapped" my tokens in order to use inside my Dapp to lessen gas cost?

I created a token ABC and have another smart contract for my dapp. My Dapp requires a lot of ABC token burning for every tx, my question is, is it advisable to convert my ABC token from on-chain to my ...
user avatar
0 votes
1 answer
20 views

Gas optimization of calldata input variables

I have some external functions what receives address lists as calldata to save gas. I know that creating a copy from global variables inside functions can be useful to read less from blockchain ...
user avatar
  • 186
0 votes
1 answer
20 views

I am misunderstanding the gas data i'm seeing. Where is my disconnect?

I must be missing something. Maybe someone can help me see where i'm misunderstanding. Forgive me if this question has been asked already. I'm seeing some adjacent questions but haven't been able to ...
user avatar
0 votes
0 answers
14 views

How to estimate the transaction size of a Blockchain (Ethereum) from the given data?

The following is the data given for different blocks; The 'size' column here refers to the block size. The aim is to estimate the transaction size for each block and compare that with the block size. ...
user avatar
1 vote
0 answers
25 views

Cannot estimate gas when trying to use smart contract

Whenever I try to approve or do anything with my smart contract I keep getting this error. This is my smart contract. pragma solidity 0.6.12; import "@openzeppelin/contracts/token/ERC20/IERC20....
user avatar
0 votes
2 answers
45 views

sendSignedTransaction web3js

I see that with sendTransaction you can specify maxFeePerGas. see here However, if you use signTransaction and then sendSignedTransaction you can only send gas. and here. How to send a signed ...
user avatar
  • 53
0 votes
0 answers
31 views

Gas estimation reverts

I am quite new to blockchain programming and am trying to estimate the gas cost of calling a function from a smart contract. I am using Web3 js and the Kovan network through an Infura node. What am I ...
user avatar
0 votes
1 answer
18 views

How long before transaction is removed from the Mempool

So I have a transaction T1 that has been stuck in pending because I put the gas really low. I forgot about this and then tried to process two transactions after with $126 gas fee and $111 gas fee. I ...
user avatar
0 votes
1 answer
31 views

NFT mint call reverted while testing

So I have gotten to the point in my NFT project where I am testing the minting from the website that I setup to mint from. I deployed to Rinkeby, and when I go to mint NFTs on my website, I get the ...
user avatar
5 votes
1 answer
84 views

Why chi token save 50% and not more?

I have a smart contract on bsc network and I want to reduce my gas used. I use chi gas token based on this code: modifier discountCHI { uint256 gasStart = gasleft(); _; uint256 gasSpent = ...
user avatar
0 votes
0 answers
44 views

Hardhat Polygon gas price error

I'm developing a NFT minting API with Hardhat, Ethers and alchemyapi. In Rinkeby network it's working!! But when I deployed my contract to Polygon it's returning some erros when Mint function is ...
user avatar
0 votes
0 answers
17 views

How to save gas in solidity structs with packaging

I am trying to figure out how to package my structures to optimize them. This first structure takes full 3x256 bits. struct FirstStruct { uint128 numberOne; // takes one 256bit slot uint256 ...
user avatar
  • 636
0 votes
0 answers
9 views

Permissioned networks vs Access Control in public networks

I've been working with both public and permissioned EVM networks the last years. Everybody is aware about the benefits of public networks in terms of security, community, solutions ecosystem, ...
user avatar
  • 636
0 votes
1 answer
31 views

Gas optimisation: maximum of two numbers

Any ideas if I can optimize the gas of the following function from Math library of OZ: function max(uint256 a, uint256 b) public pure returns (uint256) { return a >= b ? a : b; } *I checked ...
user avatar
0 votes
0 answers
10 views

why creating new wallet doesn't cost any gas, though its using network storage to store account details?

Creating new wallet doesn't cost us any gas, but the account state and account information is stored in Ethereum blockchain, which is using networks storage and as we can see the details of account in ...
user avatar
0 votes
0 answers
6 views

Optimizing NFT structure for minting

I had read that using Bytes32 instead of string can save you a lot of gas. So I decided to test it out in two made-up NFT structures by using REMIX_IDE.(Contract below) However, I didn't seem to save ...
user avatar
  • 636
1 vote
3 answers
52 views

Why using storage keyword instead of memory cost less gas?

struct User { bool isActive; uint256 userAge; } mapping(userId => User) public users; method 1; function example(uint256 userId) public { User memory user = users[userId]; bool ...
user avatar
1 vote
1 answer
27 views

Can gas limit get increased while transaction is executing?

Suppose that we have a transaction that calls a contract method with an i.e. 200,000 gas limit. While the transaction is mining, the called contract finds out that it will run out of gas before ...
user avatar
0 votes
0 answers
10 views

Gas usage for 1155 vs 721a

A client is looking to optimize gas usage for an nft contract. Which uses less gas for minting/transfers (deployment isn’t really a concern but input on it is definitely welcome)? The collection in ...
user avatar
0 votes
0 answers
19 views

How do I determine the gas limit properly?

So I developed a minting website. But I don't know how can I determine and set the gas limit for users. I am new to blockchain.
user avatar
0 votes
0 answers
30 views

global variable vs state variable access gas cost

what costs more gas, accessing a global variable (like block.timestamp) or a state veriable (in particular, a value in a struct in a mapping, like infos[id].time) ?
user avatar
  • 101
0 votes
0 answers
37 views

How to fix gas problem in Ethernaut quiz 13?

I'm trying to call function hack. I set gas limit to 3000K but when call function 'hack' there is the error. Why does eth gas runs out of (63178) by such a simple function? and dramatically, when I ...
user avatar
0 votes
0 answers
19 views

How ERC 1155 standard prevents from "out of gas" error in batch operations?

I was checking the implementation of Openzeppelin's implementation of ERC-1155 standard and I'm curious about the use of _safeBatchTransferFrom function to transfer multiple tokens at once. The ...
user avatar
  • 636
2 votes
2 answers
150 views

What is the maximum amount of gas the Ethereum Virtual Machine can handle?

I'd like to know the EVM gas limit of a single node with modern computing specs. My understanding is that the current gas limit of Ethereum(15m/block or 1m/s) is constrained such that all nodes in the ...
user avatar
  • 230
0 votes
0 answers
22 views

why does EOA > contract cost more than contract > contract

Simple question but I'm having a hard time finding a clear answer online. I'm told contract -> contract interactions are cheaper (in terms of gas) compared to EOA -> contract interactions. What ...
user avatar
  • 101
0 votes
1 answer
21 views

Can someone help me with this question

Is there any way at all i can send crypto from wallet a to wallet b and pre pay the gas or pay the gas with a diffent address. for example on the tron chain is ther any way i can send trc20 usdt to ...
user avatar
0 votes
0 answers
9 views

My transaction only works when I speed it up on Metamask; how can I get it to work without doing that?

I'm building an NFT, and, on the Ethereum Rinkeby network, when I go to mint it, it will only work if I click "Speed Up" after submitting the transaction on MetaMask. I am using the ...
user avatar
0 votes
1 answer
15 views

Does a view function use gas if called by another function which access the same storage variable?

Let's say I have a view function that accesses a storage mapping like so: function performCalculation(uint256 _id) public view returns(uint256) { uint256 memory someValue = someMapping[_id]; ...
user avatar
  • 148
0 votes
2 answers
32 views

what is the naming convention around s_ in solidity

I have seen staking balances using s_balances in contracts. However, I tried searching around and I could not find the answers. what is the naming convention around s_ in solidity?
user avatar
0 votes
1 answer
29 views

Gas consumption of calling a view function from an other function

I have a public view function that have a for loop inside of it, I put the loop inside the view function so I wont need to worry about the gas. now my question is if I call the function internally ...
user avatar
  • 3
0 votes
0 answers
33 views

How to estimate gas for a solidity function params

I have a function that takes multiple structs like so: struct A { bytes myBytes1; bytes myBytes2; bytes myBytes3; } struct B { bytes myBytes1; bytes32 myBytes32; bytes myBytes3; } struct C { ...
user avatar
  • 1
0 votes
1 answer
20 views

Why is gas transferred while transferring eth?

I was watching this video: https://www.youtube.com/watch?v=mlPc3EW-nNA&list=PLO5VPQH6OWdVQwpQfw9rZ67O6Pjfo6q-p&index=39&t=59s It shows 3 ways to transfer eth. I want to know why is gas ...
user avatar
3 votes
0 answers
21 views

Why does a STORAGEADD op (SSTORE) add 80 bytes to state rather than 32?

According to this spreadsheet that Vitalik has referenced before, stating that it's what they used to determine gas fees for each opcode, a STORAGEADD opcode (presumably renamed to SSTORE) is ...
user avatar
1 vote
1 answer
28 views

If two transactions has the same gas fees, base gas fees, max priority fees, which transaction will come first in the same block?

If two transactions has the same gas fees, base gas fees, max priority fees, (aka gas fees config) which transaction will come first in the same block? Please kindly refer to the transactions below ...
user avatar
0 votes
1 answer
66 views

getFeeData() is not a function

i'm always got getFeeData() is not a function ? i was confused read on etherjs documentation. const feeData = await this.web3.currentProvider.getFeeData();
user avatar
  • 1
0 votes
2 answers
35 views

Cheapest way to hardcode a value

I have a smart contract that checks that the msg.sender is the owner. If I know that the owner address is 0xEA674fdDe714fd979de3EdF0F56AA9716B898ec8 for example, then what is the cheapest way to ...
user avatar
  • 133
0 votes
0 answers
25 views

In ERC721 contract , how to add different parameter on each token with out high gas fee

My contract will set “name” “x” “y” these 3 parameter to each contract.the name is string and the x y are uint256,My rules is each tokens’ name is different and the combination of x and y is different ...
user avatar
1 vote
1 answer
46 views

Gas cost of Create2

I code a very simple program to test create2(). The program has two contracts, an empty firstContract, and a test contract to deploy firstContract via create2. The codes are below. Then I call ...
user avatar
  • 11
0 votes
0 answers
156 views

Set maxFeePerGas and maxPriorityFeePerGas dynamically in ethers js

I want to set the value of maxPriorityFeePerGas and maxFeePerGas these two parameters when sending a transaction, say 10 gwei greater than the response from getFeeData() function. /* provider....
user avatar
0 votes
1 answer
37 views

Is it possible to get consumed and remained gas from within a smart contract?

How can I get consumed gas as well as remained gas (which is sent with tx by the caller) from within a smart contract in solidity?
user avatar
0 votes
0 answers
8 views

create multiple access tokens with erc721

I am trying to create an access control framework using erc721. the token would be used to get access. Each object owner owns an erc721 smart contract and will create one access token for every ...
user avatar
  • 1
0 votes
0 answers
21 views

Is it possible to redirect gas fee charges to another wallet?

I am carrying out a smart contract feasibility study for a potential client of mine. My client is a service provider with customers in the millions! Almost all write ( .sent() ) interactions with the ...
user avatar
  • 107
0 votes
0 answers
17 views

How many transferFrom function executions can be done in one transaction? (airdrop use case)

I'm developing a dApp, with an Smart Contract, to be able to send multiple tokens at once, in order to save gas (like https://cryptomultisender.com/). The tasks are pretty simple: Take an array of ...
user avatar
  • 636

1
2 3 4 5
31