Is there a way that I can print the intermediate result on a console or some log file in order to debug my contract?


you could use events to debug(log) the desired variable.Please read the official documentation to get more details.

e.g :

 pragma solidity ^0.4.0;

    contract test {
        event test_value(uint256 indexed value1);
        uint256 value_test;

        function test_f()  {

            //value_test processing
            test_value(value_test); // log the current value

an alternative solution is to use the remix (browser solidity) debugger : enter image description here

enter image description here

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.