7

I'm trying to independently verify the source code of solidity contracts, and stumbled across a case where the compiled bytecode for the source code of the contract does not match the data of the transaction which created the contract. According to https://etherchain.org/account_verify/info and other things I've read, the bytecode received from compiling the contract with the correct solidity version and optimized flag should match the input field of the creating transaction.

The contract can be found here: https://etherscan.io/address/0x9ffa45c5943a0203ee462c48c8b97064abbe28f3#code

Using web3.eth.getTransaction through parity, I see the data of the transaction (0xf991503a9e798e2c8e53c865b09e985f59100a1561f9a5fad546f59e8a4096db) to be:

606060405234610000575b60008054600160a060020a031916730807a2d6a675e7196a3d9b1910700cae9795b72a1790555b5b6104fb806100416000396000f300606060405236156100675763ffffffff60e060020a6000350416633ccfd60b81146101115780633feb5f2b146101205780635d4522011461014c57806370a082311461017557806372ea4b8c146101a05780637975ce28146101bf578063cee2a9cf146101d4575b61010f5b61007433610201565b15156100ee57600180548060010182818154818355818115116100bc576000838152602090206100bc9181019083015b808211156100b857600081556001016100a4565b5090565b5b505050916000526020600020900160005b8154600160a060020a033381166101009390930a92830292021916179055505b600160a060020a03331660009081526002602052604090208054340190555b565b005b346100005761010f610271565b005b34610000576101306004356102a3565b60408051600160a060020a039092168252519081900360200190f35b34610000576101306102d3565b60408051600160a060020a039092168252519081900360200190f35b346100005761018e600160a060020a03600435166102e2565b60408051918252519081900360200190f35b346100005761018e6102f4565b60408051918252519081900360200190f35b346100005761010f6004356024356102fb565b005b34610000576101ed600160a060020a0360043516610201565b604080519115158252519081900360200190f35b6000805b6001548110156102665782600160a060020a0316600182815481101561000057906000526020600020900160005b9054906101000a9004600160a060020a0316600160a060020a0316141561025d576001915061026b565b5b600101610205565b600091505b50919050565b600160a060020a03331660008181526002602052604080822054905181156108fc0292818181858888f150505050505b565b600181815481101561000057906000526020600020900160005b915054906101000a9004600160a060020a031681565b600054600160a060020a031681565b60026020526000908152604090205481565b6001545b90565b60015460009081908311156103105760015492505b50825b828110156104c857600060026000600184815481101561000057906000526020600020900160005b9054906101000a9004600160a060020a0316600160a060020a0316600160a060020a031681526020019081526020016000205411156104bf5760026000600183815481101561000057906000526020600020900160005b9054906101000a9004600160a060020a0316600160a060020a0316600160a060020a0316815260200190815260200160002054915060026000600183815481101561000057906000526020600020900160005b9054906101000a9004600160a060020a0316600160a060020a0316600160a060020a0316815260200190815260200160002060009055600060009054906101000a9004600160a060020a0316600160a060020a03166303f9c79383600184815481101561000057906000526020600020900160005b9054906101000a9004600160a060020a03166040518363ffffffff1660e060020a0281526004018082600160a060020a0316600160a060020a031681526020019150506000604051808303818588803b156100005761235a5a03f11561000057505050505b5b600101610313565b5b505050505600a165627a7a72305820e7c797ee36d8a2e4c28e3fa53150f5fac2d95456b0610d4b7e2a312b5249c2480029

I'm using the solc-js compiler (with the same solidity version, v0.4.8+commit.60cc1668, optimized), and compiling the same source code shown in the etherscan link gives:

606060405234610000575b60008054600160a060020a031916730807a2d6a675e7196a3d9b1910700cae9795b72a1790555b5b6104fb806100416000396000f300606060405236156100675763ffffffff60e060020a6000350416633ccfd60b81146101115780633feb5f2b146101205780635d4522011461014c57806370a082311461017557806372ea4b8c146101a05780637975ce28146101bf578063cee2a9cf146101d4575b61010f5b61007433610201565b15156100ee57600180548060010182818154818355818115116100bc576000838152602090206100bc9181019083015b808211156100b857600081556001016100a4565b5090565b5b505050916000526020600020900160005b8154600160a060020a033381166101009390930a92830292021916179055505b600160a060020a03331660009081526002602052604090208054340190555b565b005b346100005761010f610271565b005b34610000576101306004356102a3565b60408051600160a060020a039092168252519081900360200190f35b34610000576101306102d3565b60408051600160a060020a039092168252519081900360200190f35b346100005761018e600160a060020a03600435166102e2565b60408051918252519081900360200190f35b346100005761018e6102f4565b60408051918252519081900360200190f35b346100005761010f6004356024356102fb565b005b34610000576101ed600160a060020a0360043516610201565b604080519115158252519081900360200190f35b6000805b6001548110156102665782600160a060020a0316600182815481101561000057906000526020600020900160005b9054906101000a9004600160a060020a0316600160a060020a0316141561025d576001915061026b565b5b600101610205565b600091505b50919050565b600160a060020a03331660008181526002602052604080822054905181156108fc0292818181858888f150505050505b565b600181815481101561000057906000526020600020900160005b915054906101000a9004600160a060020a031681565b600054600160a060020a031681565b60026020526000908152604090205481565b6001545b90565b60015460009081908311156103105760015492505b50825b828110156104c857600060026000600184815481101561000057906000526020600020900160005b9054906101000a9004600160a060020a0316600160a060020a0316600160a060020a031681526020019081526020016000205411156104bf5760026000600183815481101561000057906000526020600020900160005b9054906101000a9004600160a060020a0316600160a060020a0316600160a060020a0316815260200190815260200160002054915060026000600183815481101561000057906000526020600020900160005b9054906101000a9004600160a060020a0316600160a060020a0316600160a060020a0316815260200190815260200160002060009055600060009054906101000a9004600160a060020a0316600160a060020a03166303f9c79383600184815481101561000057906000526020600020900160005b9054906101000a9004600160a060020a03166040518363ffffffff1660e060020a0281526004018082600160a060020a0316600160a060020a031681526020019150506000604051808303818588803b156100005761235a5a03f11561000057505050505b5b600101610313565b5b505050505600a165627a7a723058202529b66753f69883ab5e76eebe3048611454a5662624196e7cac88f862841a990029

Additionally when I try to compile with the remix online compiler it gives me:

606060405234610000575b60008054600160a060020a031916730807a2d6a675e7196a3d9b1910700cae9795b72a1790555b5b6104fb806100416000396000f300606060405236156100675763ffffffff60e060020a6000350416633ccfd60b81146101115780633feb5f2b146101205780635d4522011461014c57806370a082311461017557806372ea4b8c146101a05780637975ce28146101bf578063cee2a9cf146101d4575b61010f5b61007433610201565b15156100ee57600180548060010182818154818355818115116100bc576000838152602090206100bc9181019083015b808211156100b857600081556001016100a4565b5090565b5b505050916000526020600020900160005b8154600160a060020a033381166101009390930a92830292021916179055505b600160a060020a03331660009081526002602052604090208054340190555b565b005b346100005761010f610271565b005b34610000576101306004356102a3565b60408051600160a060020a039092168252519081900360200190f35b34610000576101306102d3565b60408051600160a060020a039092168252519081900360200190f35b346100005761018e600160a060020a03600435166102e2565b60408051918252519081900360200190f35b346100005761018e6102f4565b60408051918252519081900360200190f35b346100005761010f6004356024356102fb565b005b34610000576101ed600160a060020a0360043516610201565b604080519115158252519081900360200190f35b6000805b6001548110156102665782600160a060020a0316600182815481101561000057906000526020600020900160005b9054906101000a9004600160a060020a0316600160a060020a0316141561025d576001915061026b565b5b600101610205565b600091505b50919050565b600160a060020a03331660008181526002602052604080822054905181156108fc0292818181858888f150505050505b565b600181815481101561000057906000526020600020900160005b915054906101000a9004600160a060020a031681565b600054600160a060020a031681565b60026020526000908152604090205481565b6001545b90565b60015460009081908311156103105760015492505b50825b828110156104c857600060026000600184815481101561000057906000526020600020900160005b9054906101000a9004600160a060020a0316600160a060020a0316600160a060020a031681526020019081526020016000205411156104bf5760026000600183815481101561000057906000526020600020900160005b9054906101000a9004600160a060020a0316600160a060020a0316600160a060020a0316815260200190815260200160002054915060026000600183815481101561000057906000526020600020900160005b9054906101000a9004600160a060020a0316600160a060020a0316600160a060020a0316815260200190815260200160002060009055600060009054906101000a9004600160a060020a0316600160a060020a03166303f9c79383600184815481101561000057906000526020600020900160005b9054906101000a9004600160a060020a03166040518363ffffffff1660e060020a0281526004018082600160a060020a0316600160a060020a031681526020019150506000604051808303818588803b156100005761235a5a03f11561000057505050505b5b600101610313565b5b505050505600a165627a7a723058209af8a6ef7fce5c06c5d80234a6a37e819ab91c3c3950d09db1c3ab478cbff2670029

What's strange is that the compiled bytecode for solc-js and remix do not match each other, and also neither matches the on chain contract initialization data. Looking closer at the compiled bytecodes I noticed all start with:

606060405234610000575b60008054600160a060020a031916730807a2d6a675e7196a3d9b1910700cae9795b72a1790555b5b6104fb806100416000396000f300606060405236156100675763ffffffff60e060020a6000350416633ccfd60b81146101115780633feb5f2b146101205780635d4522011461014c57806370a082311461017557806372ea4b8c146101a05780637975ce28146101bf578063cee2a9cf146101d4575b61010f5b61007433610201565b15156100ee57600180548060010182818154818355818115116100bc576000838152602090206100bc9181019083015b808211156100b857600081556001016100a4565b5090565b5b505050916000526020600020900160005b8154600160a060020a033381166101009390930a92830292021916179055505b600160a060020a03331660009081526002602052604090208054340190555b565b005b346100005761010f610271565b005b34610000576101306004356102a3565b60408051600160a060020a039092168252519081900360200190f35b34610000576101306102d3565b60408051600160a060020a039092168252519081900360200190f35b346100005761018e600160a060020a03600435166102e2565b60408051918252519081900360200190f35b346100005761018e6102f4565b60408051918252519081900360200190f35b346100005761010f6004356024356102fb565b005b34610000576101ed600160a060020a0360043516610201565b604080519115158252519081900360200190f35b6000805b6001548110156102665782600160a060020a0316600182815481101561000057906000526020600020900160005b9054906101000a9004600160a060020a0316600160a060020a0316141561025d576001915061026b565b5b600101610205565b600091505b50919050565b600160a060020a03331660008181526002602052604080822054905181156108fc0292818181858888f150505050505b565b600181815481101561000057906000526020600020900160005b915054906101000a9004600160a060020a031681565b600054600160a060020a031681565b60026020526000908152604090205481565b6001545b90565b60015460009081908311156103105760015492505b50825b828110156104c857600060026000600184815481101561000057906000526020600020900160005b9054906101000a9004600160a060020a0316600160a060020a0316600160a060020a031681526020019081526020016000205411156104bf5760026000600183815481101561000057906000526020600020900160005b9054906101000a9004600160a060020a0316600160a060020a0316600160a060020a0316815260200190815260200160002054915060026000600183815481101561000057906000526020600020900160005b9054906101000a9004600160a060020a0316600160a060020a0316600160a060020a0316815260200190815260200160002060009055600060009054906101000a9004600160a060020a0316600160a060020a03166303f9c79383600184815481101561000057906000526020600020900160005b9054906101000a9004600160a060020a03166040518363ffffffff1660e060020a0281526004018082600160a060020a0316600160a060020a031681526020019150506000604051808303818588803b156100005761235a5a03f11561000057505050505b5b600101610313565b5b505050505600a165627a7a72305820

but have different endings after that. Does anyone know why this might be the case?

2

Verifying the Source code is not easy. You require "exact same compiler version".

See: https://ethereum.stackexchange.com/a/221/852

If you just want to know if a contract exists at the address, the easiest to include a simple function.

function contractExists () constant returns (bool result){
  return true;
}
0

Antonio, I am seeing the exact same problem, I select same remix and same very comp version.. all is good and all identical and it verifies.. BUT when I select optimize in remix and optimize in etherscan verify.. then the bytcodes are very different. 5 line simple state contract, no construct parameters and np libraries

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.