2

I am new to geth command line for testnet in Windows. I got an error when trying to deploy this contract example

----------------------------------------------
source = "contract test { function multiply(uint a) returns(uint d) { return a * 7;} } ";

contract = eth.compile.solidity(source).test;

txhash = eth.sendTransaction({from: primary, data: contract.code});

eth.getBlock("pending", true).transactions;

miner.start(1); admin.sleepBlocks(1); miner.stop();

contractaddress = eth.getTransactionReceipt(txhash).contractAddress;

eth.getCode(contractaddress);

multiply7 = eth.contract(contract.info.abiDefinition).at(contractaddress);
fortytwo = multiply7.multiply.call(6);

I read similar questions, but did not help! most of the answers telling ignoring 'undefined' during compiling the code (the second command). But when i tried the third command i got this error

TypeError: Cannot access member 'code' of undefined at :1:52

Is there any solution?

Thanks

2
  • 1
    That code doesn't compile for me - it missing a function keyword, and there's an extra ; at the end. Can you confirm that this is the exact code you're trying to compile? Commented Mar 25, 2017 at 19:06
  • 1
    Thanks Richard, sorry for the typing mistake. it does have 'function' + ;. i updated the question
    – MWH
    Commented Mar 25, 2017 at 19:17

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.