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); 

2 Answers 2


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.
    – user6307
    Commented Mar 30, 2017 at 20:12

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.