I am compiling in solidity browser and then compiling the same exact code in truffle.

The code is the following:

pragma solidity ^0.4.11;
contract double{function d(int256 a)constant returns(int256){return a*2;}}

The resulting bytecodes are different from each other.


Solidity Browser:

Is there anything else I need to do in truffle so I can make it compile exactly the say solidity browser does?

  • are you using same compiler?
    – Badr Bellaj
    Commented Aug 7, 2017 at 22:51
  • I am using truffle as it comes and using solidity browser as it comes... The compliver version is the same in both pragma solidity ^0.4.11; Commented Aug 8, 2017 at 0:02

1 Answer 1


using ^0.4.11 means your contract will be compiled using by the compiler 0.4.11 or a newer version (current version is 0.4.15). so I think truffle and solidity browser are using different compiler. you need to check which version is used.
Truffle : How do I find the exact solidity compiler version used by truffle?
Remix : enter image description here

  • Unfortunately matching up the compiler versions still did not produce the same result in the bytecode. Commented Aug 9, 2017 at 2:24
  • have you enabled the optimization in remix?
    – Badr Bellaj
    Commented Aug 10, 2017 at 13:39

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.