1

This question already has an answer here:

I am trying to deploy the Greeter contract on a private test chain following this guide (Deploying the Greeter contract via the geth CLI is not registering in my private blockchain)

When I get to the "var greeter =" command pasted below, it runs but only ever returns "undefined", it does not look like the contract ever deploys.

Can anyone point me in the right direction please

thanks, P

var greeter = greeterContract.new(_greeting, {from: eth.accounts[0], data: greeterCompiled["<stdin>:greeter"].code, gas:20000000000}, function(e, contract) { 
  if (!e) { 
   if (!contract.address) { 
     console.log("Contract transaction send: TransactionHash: " + contract.transactionHash + " waiting to be mined..."); 
   } else { 
     console.log("Contract mined! Address: " + contract.address); console.log(contract); 
   } 
  }  
})

marked as duplicate by Waqar Lim Mar 31 '17 at 13:07

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

1

Variable declarations will return undefined. Its not an error.

In order to get contract address you need to mine in your private network. Make sure that your are mining.

  • Hi Gokulnath, thank you for the reply. I do understand that undefined is not an error, however I expected to see output "Contract mined! Address: " + contract.address". I am mining, so I'm not sure where I am going wrong. – pd26 Mar 30 '17 at 20:12
0

I found the issue, I have failed to unlock the account eth.account[0] (which I was using to deploy the contract), prior to attempting to deploy the contract.

After running personal.unlockAccount(eth.accounts[0]); the contract successfully deployed!

Not the answer you're looking for? Browse other questions tagged or ask your own question.