3

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.

Truffle:
0x60606040523415600e57600080fd5b5b60978061001d6000396000f300606060405263ffffffff7c01000000000000000000000000000000000000000000000000000000006000350416636482e6268114603c575b600080fd5b3415604657600080fd5b604f6004356061565b60405190815260200160405180910390f35b600281025b9190505600a165627a7a723058203747098ed60838a4e4a3a8ba05db5e7f3eeb60237761809e1f89f6007b52938e0029


Solidity Browser:
6060604052341561000f57600080fd5b5b60ab8061001e6000396000f30060606040526000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680636482e62614603d575b600080fd5b3415604757600080fd5b605b60048080359060200190919050506071565b6040518082815260200191505060405180910390f35b60006002820290505b9190505600a165627a7a72305820e77f3602d7e14b8ffd5ef32976d823a77ab5c91be0a1cad7a188ff3bdba9d4ea0029

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

Badr Bellaj
  • 18,780
  • 4
  • 58
  • 75
Dino Anastos
  • 847
  • 1
  • 13
  • 22

1 Answers1

2

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

Badr Bellaj
  • 18,780
  • 4
  • 58
  • 75