Urgent help neededContract is deployed but execution of method always return

Hello everyone,

I have created a private blockchain and trying to create a sample contract given in https://github.com/ethereum/go-ethereum/wiki/Contracts-and-Transactions

I could create, compile and even deploy the contract but when I execute following statement:

It always returns "0".
Am I missing anything?

Steps I did -
1) Created a block chain.
2) Did some mining so that I can have some ether in my account. As it was a private network, I could get handsom amount of ether in my primary account.
3) Create and compiled contract in Geth Console as followed:

primaryAccount = eth.accounts[0]

source = "contract testA { function multiply(uint a) returns(uint d) { return a * 5; } }"
// compile with solc
contract = eth.compile.solidity(source).testA
// create contract object
var MyContract = eth.contract(contract.info.abiDefinition)
// extracts info from contract, save the json serialisation in the given file,
//contenthash = admin.saveInfo(contract.info, "~/info.json")
// send off the contract to the blockchain
var mycon = MyContract.new({from: primaryAccount, data: contract.code}, function(error, contract){
if(!error && contract.address) {
console.log("Contract mined! address: " + contract.address + " transactionHash: " + contract.transactionHash);

Got the address as output but no transaction hash (Could this be a problem??).

Ran following :
var address = "<<Address received in above code >>";

var Multiply = web3.eth.contract([{constant:false,inputs:[{name:'a',type:'uint256'}],name:'multiply',outputs:[{name:'d',type:'uint256'}],type:'function'}]);
var myMultiply = Multiply.at(address);

But last line always returns "0".

Unable to understand why this is happening. Am I missing certain steps? Do I need to do something else to get the contract executed?

Thanks in Advance..
Sign In or Register to comment.