Help Needed: Contract Not Getting Mined

glambethglambeth Member Posts: 7
edited August 2015 in Smart Contracts and Dapps
Hi everyone, I'm following the guide to create an ethereum greeter (found here: https://ethereum.org/greeter) and it seems like my contract is not getting mined. Any help would be appreciated.

I followed the instruction exactly, and after typing in
var greeter = greeterContract.new(_greeting,{from:web3.eth.accounts[0], data: greeterCompiled.greeter.code, gas: 300000}, 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);
      }

    }
})
I type in greeter and I just get
{
  address: undefined
}
and I never get a contract mined message.
This is what greeterContract returns:
abi: [{
    constant: false,
    inputs: [ ],
    name: 'kill',
    outputs: [ ],
    type: 'function'
  }, {
    constant: true,
    inputs: [ ],
    name: 'greet',
    outputs: [{
      name: '',
      type: 'string'
    } ],
    type: 'function'
  }, {
    inputs: [{
      name: '_greeting',
      type: 'string'
    } ],
    type: 'constructor'
  } ],
  at: function (address, callback),
  new: function ()
and greeterCompiled returns

{
  greeter: {
    code: '0x60606040526040516102b43803806102b48339016040526060805160600190602001505b5b33600060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908302179055505b806001600050908051906020019082805482825590600052602060002090601f01602090048101928215609e579182015b82811115609d5782518260005055916020019190600101906081565b5b50905060c5919060a9565b8082111560c1576000818150600090555060010160a9565b5090565b50505b506101dc806100d86000396000f30060606040526000357c01000000000000000000000000000000000000000000000000000000009004806341c0e1b514610044578063cfae32171461005157610042565b005b61004f6004506100ca565b005b61005c60045061015e565b60405180806020018281038252838181518152602001915080519060200190808383829060006004602084601f0104600302600f01f150905090810190601f1680156100bc5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b600060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561015b57600060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16ff5b5b565b60206040519081016040528060008152602001506001600050805480601f016020809104026020016040519081016040528092919081815260200182805480156101cd57820191906000526020600020905b8154815290600101906020018083116101b057829003601f168201915b505050505090506101d9565b9056',
    info: {
      abiDefinition: [{
        constant: false,
        inputs: [ ],
        name: 'kill',
        outputs: [ ],
        type: 'function'
      }, {
        constant: true,
        inputs: [ ],
        name: 'greet',
        outputs: [{
          name: '',
          type: 'string'
        } ],
        type: 'function'
      }, {
        inputs: [{
          name: '_greeting',
          type: 'string'
        } ],
        type: 'constructor'
      } ],
      compilerVersion: '0.1.1',
      developerDoc: {
        methods: {
        }
      },
      language: 'Solidity',
      languageVersion: '0',
      source: 'contract mortal { address owner; function mortal() { owner = msg.sender; } function kill() { if (msg.sender == owner) suicide(owner); } } contract greeter is mortal { string greeting; function greeter(string _greeting) public { greeting = _greeting; } function greet() constant returns (string) { return greeting; } }',
      userDoc: {
        methods: {
        }
      }
    }
  },
  mortal: {
    code: '0x60606040525b33600060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908302179055505b60d58061003f6000396000f30060606040526000357c01000000000000000000000000000000000000000000000000000000009004806341c0e1b5146037576035565b005b60406004506042565b005b600060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141560d257600060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16ff5b5b56',
    info: {
      abiDefinition: [{
        constant: false,
        inputs: [ ],
        name: 'kill',
        outputs: [ ],
        type: 'function'
      }, {
        inputs: [ ],
        type: 'constructor'
      } ],
      compilerVersion: '0.1.1',
      developerDoc: {
        methods: {
        }
      },
      language: 'Solidity',
      languageVersion: '0',
      source: 'contract mortal { address owner; function mortal() { owner = msg.sender; } function kill() { if (msg.sender == owner) suicide(owner); } } contract greeter is mortal { string greeting; function greeter(string _greeting) public { greeting = _greeting; } function greet() constant returns (string) { return greeting; } }',
      userDoc: {
        methods: {
        }
      }
    }
  }
}
Any Ideas? my node is synced and I do have the gas to send the transaction.
Post edited by glambeth on

Comments

  • juliussbensonjuliussbenson Member Posts: 5
    edited September 2015
    I'm having the same problem, but I'm using a private testnet with an empty genesis block. The contract won't even say "waiting to be mined".

    EDIT: I got it to work. I had the etherbase set to account 1 as opposed to account 0. The example greeter code on the ethereum website pulls gas from account 0 by default, and my account 1 had been locked the whole time.
    Post edited by juliussbenson on
  • bortzmeyerbortzmeyer Member Posts: 3
    It seems you use the eth (C++) implementation. I have exactly the same problem with eth, while it worked flawlessly with geth (Go) implementation. So, I switched to geth.
  • durdur Member Posts: 10
    @glambeth I'm facing the same problem. Have you tried:
    greeterContract.new(_greeting,{from:web3.eth.accounts[0], data: greeterCompiled.greeter.code, gas: 300000)

    For me it returns that this exceeds the gas block limit. Unfortunately reducing the gas from 300000 to 80000 doesn't seem to solve it for me.
  • ahanageminiahanagemini Member Posts: 2
    Hi, I have the error where my greeter has address:undefined and my account has 555 ether and I can unlock it. Please help!!:( :(
Sign In or Register to comment.