Solidity has access to the remaining gas via msg.gas which changes from line to line. But I would like to know if I can access the initially submitted gasLimit. Is that possible in Solidity?

1 Answer 1


No, the transaction gas limit is unavailable in Solidity (though the block.gaslimit is). A suggestion is to file an EIP with your use cases and let the community provide input.

  • I came up with this when answering this question: ethereum.stackexchange.com/questions/18349/… I cannot come up with a use case that requires it but feel there might be some. The issue is: The delta between the actually set gas limit and msg.gas is irrevocably spent in any case. I dont see a reason why I'd need to act upon what I cant change anymore. If you give me one I'd write the EIP gladly ;)
    – SCBuergel
    Jun 21, 2017 at 11:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.