Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

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.

-1
votes
0answers
18 views

Wrong Txfee 10.143 Eth for 0.8 Eth transaction [on hold]

TxHash: 0x913bbcc78ca3c56cb1531a99c0c5febba427427f322d86f74b52e4647dc558a3 Block #7103411 I made a mistake while I entered Txfee manually and Txfee : 10.143 deducted from my account. My wallet ...
0
votes
2answers
13 views

How to calculate the difference between what was transferred and what was sent / received?

Hi I'm trying to get some clarity as to what the difference is between what was Transferred Sent Received Shouldn't what's transferred and received be the same? Transferred means the amount that was ...
0
votes
2answers
17 views

If Ethereum gas charges based on the individual CPU instructions

I'm trying to understand exactly how gas works. Wondering if it charges based on actual individual CPU instructions (like Assembly-level x86 instruction set architecture level of detail), or if it ...
0
votes
0answers
22 views

Matching inside my contract fails with multiple participants

my contract (can be found on my gist: https://gist.github.com/fabs993/e13fa6ecd9526d30c8a6d85c10180075) fails at more than 5+ participants. So in my use-case I have two kind of participants Producer ...
1
vote
1answer
19 views

Processing gas cost on a sidechain

I am developing a sidechain that will store data and I want to evaluate the processing of this data in the ethereum network to get the cost in gas. I'm going to develop a smart contract that will ...
0
votes
0answers
20 views

When will the ETH amount return to my wallet? [closed]

I recently tried to transfer ETH from my external wallet to Wirex. It failed due to gas price limit reached. When will the ETH return to the external wallet? TxHash: ...
0
votes
0answers
23 views

Transactions always fails on POA sokol testnet blockchain

POA Sokol is a ethereum like testnet blockchain. I am using ether.js to make a contract call . The eth_estimateGas method in testnet gives this response but works in mainet: { "jsonrpc": "2.0", ...
1
vote
1answer
31 views

Using web3 estimateGas API (with infura) always returns the last block's gas limit

I am entirely unsure what the root cause is, but every time I use web3.eth.estimateGas with my call's parameters, it results in the last blocks gas limit as the result (~8 million). I have even tested ...
1
vote
2answers
20 views

Storing gas in a contract for next interaction to be “free”

I have a contract where the user has to interact twice. Is it possible to deposit GAS and store it in the contract for the first interaction, so the later interaction will be "free"? (and additional ...
0
votes
0answers
24 views

Why I can use a lower gasPrice than the node I set in --gasPrice

I established a private network recently and I use web3.eth.sendTransaction({from:"0x14ca04ff85747def87d6c6c566db84cc24e4643b",to:"0xa04fce8906c870a47a8a7f5f7547dfc4a62cae7a",value:"1000000000",...
1
vote
0answers
22 views

Is there a standard way for 3rd party to pay gas?

A smart contract can be modified to provide, for each functions that allows a 3rd party to pay gas, an alternative of that function which takes a signed message and assume the signer to be the sender, ...
1
vote
1answer
100 views

Out of gas error for a view function

having a problem with calling a method of my deployed contract in the main Ethereum network. I have a 'view' function which returns user's refund balance, everything worked fine in my local ...
3
votes
1answer
37 views

web3.eth.getGasPrice() always return 1GWei

For estimate transaction cost, I use web3.eth.getGasPrice() function. The return callback value always 1Gwei(1,000,000,000) in ROPSTEN. web3.eth.getGasPrice(function(error, result){ console.log(...
0
votes
2answers
52 views

ropsten: insufficient funds for gas * price + value using web3

Im using "web3": "^1.0.0-beta.37" And I want to understand How can I send rawTransaction My code is: const pk = 'xxxxxxx'; const rawTransaction = { "to": "...
0
votes
2answers
29 views

The cost of using Ethereum as a reference database

As stated in the documentation there are 3 types of storage in the Ethereum VM (EVM) The storage, the memory, and the stack Each account has a data area called storage, which is persistent ...
0
votes
1answer
32 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 ...
0
votes
1answer
20 views

How do miners claim gas from an invalid transaction?

Suppose a transaction T changes the state from S to an invalid state S'. For example, say, it ran an long loop of no operations (no_op), and attempted a double spend. Since this T transforms the state ...
2
votes
2answers
1k views

How much Ethereum is used daily in gas?

I can see from this site - https://etherscan.io/chart/gasused - the amount of gas used on the Ethereum network daily. What I cannot work out is how much ETH that corresponds to. Is there some other ...
2
votes
2answers
58 views

Why is the Eternal Storage approach still used if it hugely increases gas usage compared to storing data in structs?

I was wondering why is the eternal storage approach (first code snippet) still used? I know it's meant to make contracts upgradable but it seems too expensive to me. contract Storage { mapping(...
0
votes
1answer
42 views

What is the gas cost of keccak256(“abc”)?

According to this answer, the gas cost of keccak256 is: 30 gas + 6 gas for each word (rounded up) for input data to a SHA3 Keccak-256 operation I'm assuming that the size of a word is 256 bits and ...
0
votes
1answer
28 views

I have question about private block chain gas structure

I have a basic question about gas price charged for transaction. Say I have a private ethereum block chain with ten nodes and I don't want to charge any fee for the transaction taking place in this ...
0
votes
2answers
44 views

How Does Exchanges Implement Gas Fees for ERC20 Tokens

Any crypto exchange like binance, bitfinex and so on let you deposit and withdraw various ERC20 tokens. Technically I don't understand how they implement gas fees when I withdraw? I deposited 100 ...
0
votes
1answer
19 views

Difference between transfer/transferFrom and approveAndCall in cost

Which of these functions cost less, computationally and in terms of gas usage?
3
votes
1answer
111 views

Gas costs of the following contract

I'm calculating the gas costs of the following contract: 0x6001600190016007026005016002900460049060016021900560150160030260059007600303600960110a60005260086000f3. Disassembled versions: contract ...
0
votes
2answers
58 views

Gas issue on sendRawTransaction on the rinkeby network

I'm facing a gas issue on rinkeby network on sendRawTransaction. Tested with various gas value to experiment and getting either insufficient funds for gas * price + value or exceeds block gas limit. ...
-1
votes
0answers
15 views

Direct token invocation works, indirect invocation gives Transaction ran out of gas

When i invoke the function mint directly on the ERC20Token it works as expected. However when i invoke via the TokenManager.mint i receive an out of gas expection. I am running a local parity client, ...
1
vote
1answer
88 views

Running out of gas during a deploy due to a large number of require() statements?

I have a smart contract that has a fair number of functions, but a large number of require() statements because I carefully check every incoming parameter and some intermediate calculation results too....
1
vote
1answer
87 views

Understand an EVM call instruction with gas as 0x00

I am trying to understand the following EVM call instruction generated from here: https://ethervm.io/decompile memory[temp3:temp3 + 0x00] = address(msg.sender).call.gas(0x00).value(var1)(memory[...
1
vote
0answers
18 views

function gas calculator and function gas padding

not sure if this is possible, but I was wondering if one function can calculate the gas cost of another function? Also can a function run a series of computations to match the gas cost of the ...
3
votes
0answers
56 views

Miner accepting 0 price transactions

I am hosting a private blockchain and I am testing out the Geth functionality. I have deployed a Solidity contract based on the Greeter example. The functionality is not important, but suffice to say ...
2
votes
1answer
75 views

What is a relayer? (Meta Transactions)

I don't quite understand this concept yet but is this term related to this question/answer? Link: what is the role of relayer in 0x protocol?
1
vote
2answers
40 views

transaction fails due to out of gas in mainnet

Transaction fails due to out of gas though gas used by transaction is 22.32 % . What might be the reason ? I have give enough gas : 203000 wei. Here is the link of the transaction
1
vote
2answers
183 views

Gas estimation errored with the following message

I got the "Gas estimation errored with the following message (see below). The transaction execution will likely fail. Do you want to force sending? Internal JSON-RPC error." in remix while using the ...
1
vote
2answers
82 views

Efficient way of checking and inserting array address that is unqiue

I have a following requirement that need to be cater in dapp. Insert array of address The array need to be unique. If one of the array address already exists, reject and revert entire operation. ...
2
votes
0answers
24 views

What Web3JS method do I call to know what value to use for the gas price with sendSignedTransaction?

I am using Web3JS 1.0+ to send transactions to my smart contract. I've been using the following constant for the gas price in my code that I got a long time ago from a tutorial. What is the "...
1
vote
2answers
50 views

How to set maximum block gas in ganache-cli

I'm running ganache-cli which seems to have a block gas maximum of around 6.5 million. All the research I've done about this question seems to provide answers of the user themselves setting the user ...
0
votes
1answer
13 views

Gas deduction on contract creation inside a contract

I want to create a Contract (TokenTimelock from Open Zeppelin) inside of a registry contract. It seems as if my contract needs gas to do this. So I am wondering about using delegate call because I ...
1
vote
1answer
21 views

Gas cost difference between uint[] and mapping(uint => uint)

When mapping for example a large integer to some integer, uint[] index; index.length = 1000000; index[600001] = 4; is it cheaper to use mapping(uint => uint) index; index[600001] = 4; ? one ...
1
vote
1answer
76 views

Smart Contracts without ETH Transactions

Maybe I'm wrong, but I understand that Smart Contract Transactions must always contain a "VALUE" field, that's to say, the amount of Ether Alice will transfer to Bob in case certain condition ...
0
votes
1answer
88 views

Clique PoA Private Blockchain: Need Suggestion for Block Gas Target and Block Gas Limit

I'm following this article to create my own PoA private blockchain. Now I'm stucked at this section after number 13: I've checked the Puppeth source code and Geth CLI docs, but I'm still not quite ...
1
vote
0answers
41 views

Smart contract design for gas refund

I'm designing a proxy smart contract that will be filled with eth by users so that anyone has an incentive to perform transactions useful to the user. I won't go into the detail of "usefulness" here. ...
2
votes
2answers
29 views

Does the require function need more gas when called with a message?

If I add a message to require as a second parameter, will it increase gas consumption?
1
vote
0answers
21 views

Impact of POS and Shrading on tx costs?

How transaction fees will be affected after implementation of Casper protocol?
0
votes
1answer
21 views

Deploying contract via Remix costs less gas than deploying via javascript

When I launch my contract via remix, it launches with no issues. When I try to launch the contract via my javascript web3, using the same gas price and gas limit, it fails b/c it ran out of gas. This ...
2
votes
1answer
22 views

Keeping track of Gas costs

I have a smart contract that allows for several different user to batch tx's for their ERC20 Token distribution. In this SC the user send some ether to the smart contract, and some tokens. I want ...
0
votes
1answer
40 views

Uncaught error: VM Exception while processing transaction:out of gas

pragma solidity^0.4.18; contract project3{ address owner; struct Users{ string companyName; string role; string country; string city; uint phoneNo; string physicalAddress;} constructor (uint ...
2
votes
1answer
24 views

How to determine the gas price mathematically

The mathematical equation to define the gas price is gasprice = 1 gwei / gasused. The mathematical equation to define the tax to be paid for each transaction is tax = gasprice x gasused. Are these ...
2
votes
1answer
33 views

Do I pay any fee to the miner if I call a non-constant function, when no state variable is changed?

Suppose I have a non-constant function which changes a state variable under some condition. In other words, the function may sometimes change this variable and sometimes leave it as is. Will I pay ...
0
votes
1answer
24 views

Gas cost for keep the contract

In Ethereum yellowpaper the gas cost to create a contract is equal 32000. But what is the cost to validate and keep the contract operating until it is executed? Edit: Imagine the following situation:...
1
vote
1answer
38 views

Why is delete on arrays implemented in an energy and gas wasting way?

If I delete the whole array (static/dynamic), then all elements of an array are set to default value. So, it means that if an array has a million elements, then I have to pay gas for setting up of ...