I see that my transaction is mined. I am trying to store some data into a struct. The mining is successful, however, in the transaction receipt i see that the contract address is null. Is that an error? Also, when i try to get the data from the struct again, i dont get any data.

transaction receipt : 
  blockHash: "0x6835e94160e4db15196bae0718fcec9ea5e3ae94aa83fa9a837d49b736155276",
  blockNumber: 1135,
  contractAddress: null,
  cumulativeGasUsed: 52773,
  from: "0x627263e6a7e435feb257f9f17032026635b6bb4e",
  gasUsed: 52773,
  logs: [],
  logsBloom: "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
  root: "0x19a02c583d8855081cb16f2a3e5bded4b896f8c2db1e58aacb75738401f5cf9c",
  to: "0x031bad0e974ee22016e4578ceec980c35fa19e1e",
  transactionHash: "0x6420fba51c596055d917c8f7abb67164435c675b212188dd41efd9c8f334a9c7",
  transactionIndex: 0

transaction receipt : 
  blockHash: "0x6835e94160e4db15196bae0718fcec9ea5e3ae94aa83fa9a837d49b736155276",
  blockNumber: 1135,
  from: "0x627263e6a7e435feb257f9f17032026635b6bb4e",
  gas: 90000,
  gasPrice: 20000000000,
  hash: "0x6420fba51c596055d917c8f7abb67164435c675b212188dd41efd9c8f334a9c7",
  input: "0x136bbb5b000000000000000000000000e52743fbbc67a95283c7c1fed1764275e484a9f900000000000000000000000000000000000000000000000000000000000000e000000000000000000000000000000000000000000000000000000000000001200000000000000000000000000000000000000000000000000000000000000063000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000647616e657368000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000044d616c6500000000000000000000000000000000000000000000000000000000",
  nonce: 24,
  r: "0x1b5086663b5f034731625e1b3894834bdef2e8fe1d4bef8fc674d601b55fa200",
  s: "0x1b667db9dcc05a253d1b80812e85c8c07bab44226235f23f186b294c7161ace",
  to: "0x031bad0e974ee22016e4578ceec980c35fa19e1e",
  transactionIndex: 0,
  v: "0x2a",
  value: 0


However, i am not getting the data i stored in the struct back. I am unable to understand what is going wrong.

  • I might suggest you include a summary of your environment and the commands you use to get these results so people don't have to guess too much. If I understand correctly (not sure I do) these are receipts that indicate something was submitted. By design, these receipts are silent about what the network (mining) will do with the transactions. In the first case, the to: null, is consistent with the contract deployment process that begins by sending the deployment code to the 0x0 address in all cases. The second one seems to know the contract address, i.e. talking to something with an address. – Rob Hitchens Feb 10 '17 at 7:53

A contract is created (also called deployed) by sending the contract's byte code to Ethereum address 0x0 (that is, the to field will be 0x0).

If the contract creation succeeds, then (and only then) will there be a value in the contractAddress field of the transaction's receipt. That value will the the address of the newly created contract. Subsequent calls to that contract's address will always have 'null' in the contractAddress field of a receipt.

In other words, the contractAddress field could have been called newlyCreateContractAddress. Read more here: https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_gettransactionreceipt


I struggled with this behaviour as well. On contract deployment (to Rinkeby in my case), the contractAddress was null. I use web3.js library in my application which checks for this in the transaction receipt (more specifically web3-core-methods package checks for this), and throws an error in case the contractAddress is null.

This is an issue only if you run the light client (reproducible). When you run a full node, contractAddress returns the actual address.

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.