When I deploy a contract from node.js using the web3 JavaScript API (connected to a locally running geth), and then check the deployed bytecode using eth.getCode(address)
(either from the JS console or in node, both connected to a locally running geth), the deployed code sometimes differs from the code that was used when deploying (the former is a trailing substring of the latter, i.e. missing some data at the beginning).
Is this normal? Why does this happen?
The deployed contract works as expected though.
The script used for deploying is something like this:
web3.eth.contract(abi).new({from: addr, data: originalBin, gas: 4700000})
I am deploying a ETH/ETC splitter contract similar to this.
Eg. this bytecode:
6060604052732bd2326c993dfaef84f696526064ff22eba5b362600060006101000a81548173ffffffffffffffffffffffffffffffffffffffff02191690830217905550610163806100516000396000f36060604052361561003d576000357c010000000000000000000000000000000000000000000000000000000090048063d264e05e1461004a5761003d565b6100485b610002565b565b005b610057600480505061006f565b60405180821515815260200191505060405180910390f35b6000600060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166316c72721604051817c01000000000000000000000000000000000000000000000000000000000281526004018090506020604051808303816000876161da5a03f115610002575050506040518051906020015015801561014d575073901e93811ef02ce5e34b6f4ac2722a3ed6a1501273ffffffffffffffffffffffffffffffffffffffff16600034604051809050600060405180830381858888f193505050505b1561015b5760019050610160565b610002565b9056
got deployed at 0xde8e581f96707add7ebbeb678a0ba36778b96540 as:
0x6060604052361561003d576000357c010000000000000000000000000000000000000000000000000000000090048063d264e05e1461004a5761003d565b6100485b610002565b565b005b610057600480505061006f565b60405180821515815260200191505060405180910390f35b6000600060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166316c72721604051817c01000000000000000000000000000000000000000000000000000000000281526004018090506020604051808303816000876161da5a03f115610002575050506040518051906020015015801561014d575073901e93811ef02ce5e34b6f4ac2722a3ed6a1501273ffffffffffffffffffffffffffffffffffffffff16600034604051809050600060405180830381858888f193505050505b1561015b5760019050610160565b610002565b9056
Edit: added bytcode examples