I have a very simple contract, something like this:

contract Test_Variable{

    uint256 public variable;

    constructor() {
        variable = 100;

    function balanceTest() public {
        variable = address(this).balance;

In Remix, I run the balanceTest function. It fails and reports "out of gas". If I delete "variable = 100" from constructor, then balanceTest can run without problem.

Any feedback would be appreciated.

1 Answer 1


It seems a problem about JVM in Remix IDE. In fact, if you deploy your smart contract into Web3 with Environment dropdown in Deploy & run transactions section, you can see that your smart contract works!

  • Thank you! It is indeed a problem caused by JVM, I tried the Web3 approach and it works!
    – NomiY
    Apr 19 at 4:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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