Why can I deploy contract on REMIX even if I set the gas limit to be 0?
I am a beginner to blockchain and Ethereum but I think deploying a contract on a blockchain also takes gas, then how is it possible if my gas limit is 0?
Why can I deploy contract on REMIX even if I set the gas limit to be 0?
I am a beginner to blockchain and Ethereum but I think deploying a contract on a blockchain also takes gas, then how is it possible if my gas limit is 0?
Indeed, deploying a smart contract uses gas. Try to click the drop down next to the "Debug" button in your Remix console below your code. It will expand your mined transaction and show more data. There you will see that the transaction actually consumed gas and there was a cost involved (see example screenshot below).
I think Remix makes an estimate of the gas cost for every transaction, simulating it, and sends about 30% more as gas limit, ignoring what is in the configuration. Only when it cannot estimate the cost, it will use the gas limit config.
For example, if the transaction reverts it will discard the estimate and send what is configured.