Problems running (some) tutorial example solidity contracts

bolekbolek Member Posts: 3
Hi guys, if anyone has an abundance of generosity, please clue me in as to what I'm doing wrong.
I've successfully uploaded the Coin smart contract from https://github.com/ethereum/wiki/wiki/Solidity-Tutorial#subcurrency-example
(I've used the exact same code and also code which removes the check for sender == minter). However, when running this code in geth I can't actually access the data. I'm using a private network and have successfully initiated a hello world contract.

using geth on mac OSX
> coin.mint(eth.coinbase, 10)
invalid address
> coin.queryBalance(eth.coinbase)
0

proof my method exists
coin
{
address: "0x1b2a2b88b9bd992b847324f7c953e2ad8fcbc369",
transactionHash: "0x5f23d5e0c6f1b3577f9e4b6709c6976efca4b13211edfc6a1948641907310138",
Send: function(),
allEvents: function(),
mint: function(),
queryBalance: function(),
send: function()
}

Command line started with the following (trying to test with private network)
geth --networkid="12345" --bootnodes "enode://be474a567c4f661fff49a5cf932823968f62c067981439872c022322278e0946d[email protected]10.0.5.75:30303" --mine --minerthreads 1 --rpc --rpcport "8545" console

Answers

  • sansky09sansky09 Member Posts: 13
    Not sure what could be going wrong. But:
    - have you set your coinbase?
    - have you enabled it to spend ether? [personal.unlockAccount(eth.coinbase)]
    - also note that the code merely transfers the amount in an internal map:
    mapping (address => uint) balances;
    there is no real transfer of ether from one account to another?

    Regards,
  • bolekbolek Member Posts: 3
    Thanks for the response. I do have the coinbase set and have unlocked the account. It turns out that running transactions which require ether, necessitate adding another parameter to the call specifying the "from" address.

    Like coin.mint(eth.coinbase, 10, {from:eth.coinbase})
Sign In or Register to comment.