2

I have attempted to deploy a contract through geth, my understanding was that a null value could be given when creating the transaction to deploy the contract.

After mining the transaction I attempted to look up the transaction via the hash returned by the rcp call, I was given the following response in geth:

{
  blockHash: "0x06fe2ca8aae95b44057dbb663bed0faf9e8cc4d33418b21067d64de0eaa02f51",
  blockNumber: 37,
  from: "0x3440825288a9de705e2dbc26e4f6494b4d1f6426",
  gas: 90000,
  gasPrice: 20000000000,
  hash: "0x5e4c06e62aa70544f3349f51521e19454d4b43a224a402492cc256b115208391",
  input: "0x",
  nonce: 2,
  r: "0x3397da9897ee38d81511288de20e19d9b83ec98c056dc28604726749f350fd97",
  s: "0x44e3a8ef63f6e39118287b74deed6aa5b53f4234ad7f0669680bf9f2a4f7e030",
  to: null,
  transactionIndex: 0,
  v: "0x1c",
  value: 0
}

Is my understanding of how contract deployment works incorrect? Why is the address null on the blockchain? How can I call the contract or associated methods/functions?

I would be very grateful for any assistance that could be provided, thank you.

  • 1
    This should help? ethereum.stackexchange.com/questions/1871/… – Rob Hitchens - B9lab Dec 21 '16 at 18:16
  • I understand if deploying a contract in the geth console you can get the contract address returned, but how can I get the contract address from an rpc call which only returns the transaction hash? – Samuel Barnes Dec 21 '16 at 18:46
  • Surely the blockchain should have the location the transaction was sent somewhere, doesn't seem to be the case when looking up the transaction by it's hash (see above). Any ideas how I should be doing this in regards to rpc calls? Surely I won't have to generate my own contract address before making the rpc call? – Samuel Barnes Dec 21 '16 at 18:48
2

Did you remember to mine it?

About half way down this page, "If a transaction creates a contract it will also contain the contract address." https://github.com/ethereum/homestead-guide/blob/master/source/contracts-and-transactions/accessing-contracts-and-transactions.rst

Hopefully something on that page helps.

  • 1
    The call I was looking for was eth_getTransactionReceipt, given the transaction hash this provided the contract address in the result. – Samuel Barnes Dec 21 '16 at 20:34
  • I had remembered to mine the transaction for some reason in the geth console if you get the transaction details it returns the object in my original question. For some reason you have to call eth_getTransactionReceipt through rpc to see the address the contract deployed to. – Samuel Barnes Dec 21 '16 at 20:36
0

its normal to be set to null (not yet mined) after creation (mining) your contract will get an address.

check : https://github.com/ethereum/wiki/wiki/JavaScript-API#web3ethgettransaction

to: String, 20 Bytes - address of the receiver.
     null when its a contract creation transaction.

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.