On deploying a contract using Remix on private net and using eth.getCode(<contract's address>), I am getting "0x" as output. A simple contract like below is giving me the same result as well:

pragma solidity ^0.4.0;

contract SimpleStorage {
    uint storedData;

    function set(uint x) {
        storedData = x;

    function get() constant returns (uint) {
        return storedData;

I tried increasing gas limit using --targetgaslimit while initiating geth as well, but it didn't help either. Any suggestions on how to resolve this issue?

Adding output of Tx Receipt:

  blockHash: "0xae9bad233840e5acc872f167b3084e037c64d60d93c0229cdd6e9bc8229169d5",
  blockNumber: 26245,
  contractAddress: null,
  cumulativeGasUsed: 22872,
  from: "0x59d974cd767e994176c4950b7a231cb7c5403ec5",
  gasUsed: 22872,
  logs: [],
  logsBloom: "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
  root: "0xff06b18b48d1c2822d15cd03af57fd29ec67b69c6051587477858dbe3e4398da",
  to: "0x8584fa5f7c42783647c0fe344abf31b04886bc12",
  transactionHash: "0xb0e9618bc1b05b59fc4624ae7c4db9f95f22bfd24982ef55c5f28ce7e626977c",
  transactionIndex: 0
  • has the contract transaction been mined?
    – Malone
    Commented Nov 16, 2017 at 13:10
  • Yes, it is getting mined as I am able to see valid block# in the TransactionReceipt
    – kpratihast
    Commented Nov 16, 2017 at 13:15
  • contractAddress is null so you will not get a return. Make sure the address parameter is in hex! Commented Nov 16, 2017 at 13:22
  • Updating my geth client to v1.7.2 resolved the issue somehow!
    – kpratihast
    Commented Nov 17, 2017 at 9:11

1 Answer 1


I think your forgot to add an 0x to your contract address when calling that function.

https://github.com/ethereum/wiki/wiki/JavaScript-API web3.eth.getCode

web3.eth.getCode(addressHexString [, defaultBlock] [, callback]) Get the code at a specific address.


String - The address to get the code from. Number|String - (optional) If you pass this parameter it will not use the default block set with web3.eth.defaultBlock. Function - (optional) If you pass a callback the HTTP request is made asynchronous. See this note for details. Returns

String - The data at given address addressHexString.

  • 1
    I am picking up contract's address from following logs generated during mining: INFO [11-16|14:34:19] Submitted transaction fullhash=0xb0e9618bc1b05b59fc4624ae7c4db9f95f22bfd24982ef55c5f28ce7e626977c recipient=0x8584fa5f7c42783647c0fe344abf31b04886bc12 and querying eth.getCode("0x8584fa5f7c42783647c0fe344abf31b04886bc12") which is returning me "0x"
    – kpratihast
    Commented Nov 16, 2017 at 13:32

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.