Can't execute my contract.

jbeuckmjbeuckm Member Posts: 2
I compiled and created a contract like this:
	var source = "" + 
	    "contract test {\n" +
	    "   function multiply(uint a) returns(uint d) {\n" +
	    "       return a * 7;\n" +
	    "   }\n" +
	    "}\n";
	var compiled = web3.eth.compile.solidity(source);

	web3.eth.sendTransaction({from: web3.eth.coinbase, data: compiled.test.code}, function(err, address) {

		if (!err) {
	    	console.log('contract address = '+address); // "0x92b9a602632a1f58aed750f32b5d434ae23ad56e"
		} else {
			console.log(err);
		}

	});
The transaction appears in the blockchain here: https://www.etherchain.org/tx/0x60c6872677d266a0c76a7ad33a6dec49b56f4340f96531b4260cb1e213d891a2

The reported contract address was: '0xbd95661809724c48452ef2d5a773b2d021208d63'

So I am trying to execute the multiply function in my contract like this:
	var MyContract = web3.eth.contract(compiled.test.info.abiDefinition);

	var myContractInstance = MyContract.at(contractAddress);

	console.log("answer = "+myContractInstance.multiply(6));
myContractInstance looks good, with the correct address and a multiply function. But the console reports "Uncaught Error: could not decode, from not valid, is required"

What am I doing wrong here?
Sign In or Register to comment.