I have migrated the contract via truffle, code like this, very simple
and it returns the contract account address
[root@localhost c2]# truffle migrate
Compiling ./contracts/Ballot.sol...
Writing artifacts to ./build/contracts
Running migration: 1_initial_migration.js
Replacing Ballot...
Ballot: 0x2eb2128b3150bd4b95e96540b7e2d2151bcfb2cc
Saving successful migration to network...
Saving artifacts...
then I created the contract instance like this
myBallot = eth.contract(abi).at(addr)
abi
and addr
are vars, and they are certainly right, then
myBallot
{
abi: [{
constant: false,
inputs: [{...}],
name: "vote",
outputs: [],
payable: false,
type: "function"
}
…………
],
address: "0x071d808a15df658c0b39b71d127f4df05bb66abb",
transactionHash: null,
allEvents: function(),
chairperson: function(),
giveRightToVote: function(),
proposals: function(),
vote: function(),
voteCast: function(),
voters: function(),
winnerName: function(),
winningProposalIndex: function()
}
the transactionHash
is null
and then I call the function myBallot.giveRightToVote(eth.accounts[0]);
and continue minned, the voters is still empty
myBallot.voters()
[false, 0, 0]