We’re rewarding the question askers & reputations are being recalculated! Read more.
27

There is no fixed gas price that transactions must have. You can specify the gas price, and if you set a gas price within certain bounds, the transaction will be accepted by miners using their default values and oracle. The default gas price is now 0.02 microether which is equivalent to: 0.00000002 Ether (.02 * 1e-6) 0.02e12 wei 20000000000 wei 20e9 wei ...


21

Using Truffle and testrpc. It's actually pretty easy to build a development environment and test different use cases. For the gas estimation, it's mostly based on Web3 native functions: You can retrieve the gas price (in wei) using web3.eth.getGasPrice The function estimateGas will give the gas estimation for a function (with the parameters passed) ...


17

Gas is paid for out of the sender's ether balance, at the rate specified by the chosen gas cost. Any unused gas is refunded, and consumed gas is credited to the miner who mined the transaction, again at the rate specified by the gas cost.


16

The total cost of a transaction that creates a contract or executes a contract is based on 2 factors: gasUsed is the total gas that is consumed gasPrice specified in the transaction Total cost = gasUsed * gasPrice gasUsed Each operation in the Ethereum Virtual Machine (EVM) was assigned a number of how much gas it consumes. gasUsed is summing up all ...


15

Can I set the gas price to what ever I want? Yes, you can. But miners have a default strategy for determining gas price to charge and if the amount you're willing to pay is below that, your transaction will be rejected. (Try setting the slider all the way to the left in Mist and try to send a transaction.) What are these limits actually? Completely ...


14

This blog post (old since default gas price is currently 0.02 szabos) from Stephan Tual has the hint: The default gas price is set at 50 shannon (0.05 szabos, or 0.00000005 ether). Remember that the gas price is ultimately always defined by the users calling a contract, while the miners can set a parameter on their machines to accept or ignore ...


12

I suspect that the question about the price discovery mechanism of gas/Ether was not studied very deeply by the Ethereum developers. The mechanism that currently exists must work by miners adaptively changing the lower bound of Ether per gas (asking price), and creators of transactions - offering certain prices and watching if the transactions get mined. ...


12

Why shouldn't I set up a miner account, which would mine only transactions with the lowest gas-price possible - 1 wei? Yep, you can, but... Should some other miner catch them first (for some odd reason, because who would want to work for such a low price), I will end up paying 1 wei to that miner. For any given block, the rest of the network will (most ...


10

In order to have a 1% chance of finding a block, you need 1% of the global hash rate. And that will cost you, a lot. A back of the envelope computation tells me you'd need about 1 million Nvidia GTX 1070 cards to have 1% of the current global hashrate. Oh and the electricity for running those would also cost, since they'd consume about 100 megawatts. Also, ...


9

There are several different options for a private/consortium chain setup: Use a custom genesis block to set the difficulty level for mining to make it less intensive. Only turn mining on for some of the nodes that are participating in the network. In addition, you can pre-fund specific accounts Use something like Parity's Proof of Authority chain to ...


9

Gas is not a token or a cryptocurrency. It is the most granular unit of payment for deploying and executing code in Ethereum. Currently conversion of ether to gas happens at the point where transaction (simple ether transfer or call to a contract) is included into a block (mined). Creator of a transaction offers a certain exchange ratio of ether to gas (this ...


9

You have to multiply the gasUsed for the gasPrice. The gasUsed is contained into the transaction receipt. While the gasPrice is into the transaction itself. Indeed, in your case, you're trying to multiply the gasPrice for the gas, which is the one provided by the sender (which can be higher that the gasUsed). ref: getTransaction, getTransactionReceipt So, ...


8

Gas consumed x Gas price = transaction fee. The transaction fee is paid to the miner of the block similar to Bitcoin.


8

The answer provided by Greg Jeanmart perfectly explained how to estimate the gas cost for a function. Here I want to point out that the design of your function giveAwayDividend() might be vulnerable to attack. Since each of the for loop is paying ether to a user, and it only executes the next loop after this payment is successfully sent, it could be the ...


8

From the documentation: var contractInstance = MyContract.new([constructorParam1] [, constructorParam2], {data: '0x12345...', from: myAccount, gas: 1000000}); Yes, you can just add a gasPrice to that object: var contractInstance = MyContract.new([constructorParam1] [, constructorParam2], {data: '0x12345...', from: myAccount, gas: 1000000, gasPrice: ...


8

in a nutshell : gas is the cost unit gas price is a single gas unit's price and Fee= gas*gas price why using gas instead wei? because we need a fixed value (unit) for expressing the operations cost. then this initial cost is "translated" in wei/ether which may vary according to the market. "y operation"= x gas => x gas * market gas price= your fee ...


7

Replying to euri10's question (this should be a comment instead of an answer but I cannot format in comments), here is the geth --help snippet that displays the options to set the gas price options - try setting it to "0": MINER OPTIONS: ... --gasprice "20000000000" Minimal gas price to accept for mining a transactions ...


7

The default gas price is 50 shannon on frontier, 20 on Homestead. (remember to upgrade) Vitalik recently ran a test to see how long it took for transactions with different gas prices to be included, finding: Hence, if you are fine with a ~2 minute extra confirmation time, you can start sending transactions with a 20 shannon gas price now,


7

This is a limitation of the 1.3.x stable branch. This check was already removed for own/local transactions in the 1.4 branch (https://github.com/ethereum/go-ethereum/pull/1997), allowing you to insert transactions of even 0 gas price into your local node. The nodes in the network will still not accept anything lower than their configured limit nor forward ...


7

Take a look to http://ethdocs.org/en/latest/contracts-and-transactions/account-types-gas-and-transactions.html. Also, check the following spreadsheet: https://docs.google.com/spreadsheets/d/1m89CVujrQe5LAFJ8-YAUCcNK950dUzMQPMJBxRtGCqs/edit


7

The amount you will pay for a transaction is gasPrice*gas, so gasPrice is exactly what the name indicates, is the price per 1 gas. The gas is a measure of how much computational work your transaction requires. You can omit these values and let the node select them if you do not know how to set it. The current gas price is 9000000000 yours is several orders ...


6

As explained in the Ethereum github's wiki the gas price is set by miners and the only way to guess the acceptable value is to look at the last block gas price. Then you look at the lowest and highest prices on the block and next block price should fit close to these values. Looking at more blocks in the past could give you a trend to guess if the price ...


6

Yes, there is a default gas price in the clients. For Geth, its gas price oracle (Gpo) has nothing to do with fiat. https://github.com/ethereum/go-ethereum/blob/master/cmd/utils/flags.go is Geth's code for the default gas price: GpoMinGasPriceFlag = BigFlag{ Name: "gpomin", Usage: "Minimum suggested gas price", Value: big.NewInt(20 * params....


6

Both. All transactions on the network cost gas. Contract deployments often take much more than regular transaction calls to contracts, but some calls can be pretty expensive. As for actual numbers, here are some. Deployment: The large parts for contract deployments are Tx cost - 21k. This is for all transactions Contract creation cost - 32k. This is for ...


6

Currently the only times you pay for storage are when you write it and when you read it back. There is no ongoing cost for storage, although there have been some discussions about whether there should be, and it is possible that there will be in future. As with other transaction costs, the cost for storage is set in gas. This means that you need to multiply ...


5

GASPRICE represents the amount in ether to be paid for one unit of GAS consumed.The thing to consider is that some miners could only accept transactions where the GASPRICE is over a certain value or they will prioritize transactions with the highest GASPRICE. STARTGAS - for each Ethereum Virtual Machine operation an amount of gas units was assigned in ...


5

In the transaction object { from:web3.eth.accounts[0], data:tokenCompiled.token.code, gas: 1000000 } the gas property is indeed the maximum to be used for the transaction. The transaction object can also have a gasPrice property. Miners determine what gasPrice they are willing to accept. If the gasPrice is too small, the miner will ignore the transaction. ...


5

To see what gas prices are currently being accepted by miners, and how long it will take your transaction to confirm with a given gas price, see EthGasStation.info. Here is a snapshot of the conditions at the time I wrote this post:


5

Do not amend the value to be transferred by costs. The value specified in the transaction is transferred as is. On top that, the sender will be charged gasSpent * gasPrice, which in the case of value transfer is fixed (as mentioned in the question). This is taken additionally. Note that the geth node will check if the account balance is less than gasLimit ...


5

I think this question is out of scope for this stackexchange and voted to close it, but since it's still open... (note that the first several sections are greatly-simplified world-views and thus opinions; the last section is very subjective). N.B. that I do not possess a finance background and that for answering your question about intrinsic value, I'm using ...


Only top voted, non community-wiki answers of a minimum length are eligible