[Ethereum] How to Set Gas Price in Private Blockchain

gasprivate-blockchain

I admit that I don't understand Gas at all. But I think it is basically the currency which dapps use to interact with each other and the blockchain. Yes?

If you're creating a custom/private network, is there a way to set the required gas per transaction to be 2x the cost of the ethereum blockchain? I have looked at the chainspec and genesis files and the setting doesn't jump out at me as something obvious.

If you did that, would that mean more reward for miners? And would the tradeoff be that is is more expensive to deploy a dapp?

Thank you.

Best Answer

Without making a significant change to the Ethereum protocol, you cannot enforce gas prices on the network. Ethereum works like so: users submit transactions at any gas price they choose. At every block, the winning miner chooses whether to include the pending transaction. The gas price is one of the factors the miner uses to decide.

If you wanted to make it impermissible for a miner to accept a transaction at a gas price lower than some fixed amount, you would have to change the protocol to consider those transactions invalid.

Alternatively, on a private network, you might control the miners. If so, you can define whatever gas price standards that you like.

It's worth noting that there is a dramatic spread in gas prices on the main network right now. The median price is 20 Gwei* (mostly because many clients default to that flat rate), but many transactions get processed at 0.6 Gwei*. The low price transactions take longer to process, because only ~15% of miners accept transactions at that rate.

* source: http://ethgasstation.info/

Related Topic