I have followed this guide https://ethereum.stackexchange.com/a/2787/2426 (or equivalently https://www.ethereum.org/greeter ) when trying to deploy a simple Smart Contract into Ethereum testnet. I am using geth CLI on testnet. Everything works except final step, uploading code at blockchain. This is what I did:
GETH SECOND INSTANCE:
geth --testnet --unlock 0 attach ipc:.ethereum/testnet/geth.ipc
instance: Geth/v1.4.10-stable-5f55d95a/linux/go1.6.2
coinbase: 0x47978a69f410d0f61850c92acdb0d4c464d70937
at block: 1697809 (Mon, 26 Sep 2016 07:10:20 UTC)
datadir: .ethereum/testnet
modules: admin:1.0 debug:1.0 eth:1.0 miner:1.0 net:1.0 personal:1.0 rpc:1.0 txpool:1.0 web3:1.0
> web3.fromWei(eth.getBalance(eth.accounts[0]).toNumber(), "ether")
"5.024681313417504"
COMPILE:
> var greeterSource = '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; } }'
> var greeterCompiled = web3.eth.compile.solidity(greeterSource)
INSERT THE CONTRACT CODE INTO THE BLOCKCHAIN:
> var _greeting = "Good Morning, Smart Contract!"
> var greeterContract = web3.eth.contract(greeterCompiled.greeter.info.abiDefinition);
> var greeter = greeterContract.new(_greeting, {from: eth.accounts[0], data: greeterCompiled.greeter.code, gas: 4000000}, 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); } } })
> debug.verbosity(4)
When exploring greeter, this is the output:
> greeter
{
abi: [{
constant: false,
inputs: [],
name: "kill",
outputs: [],
payable: false,
type: "function"
}, {
constant: true,
inputs: [],
name: "greet",
outputs: [{...}],
payable: false,
type: "function"
}, {
inputs: [{...}],
type: "constructor"
}],
address: undefined,
transactionHash: null
}
> greeter.greet();
TypeError: 'greet' is not a function
at <anonymous>:1:1
I wait a minute and got no message like this:
Contract mined! address: 0x...
So, contract seems to be properly compiled but I cannot obtain nor address, nor txHash after uploading into blockchain. Maybe it's not been uploaded, or mined. How can I figure it out? Did I miss something important?
Edit: Right after trying to deploy log is reporting a lot of messages like this one:
I0926 10:31:13.097817 core/state/state_object.go:160] 47978a69f410d0f61850c92acdb0d4c464d70937: #1048576 631783523629846744286 (+ 420000000000000)
Being 0x47978a69f410d0f61850c92acdb0d4c464d70937 the coinbase address of the geth node.