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

  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

[false, 0, 0]
  • Check that your account is unlocked. Commented Dec 24, 2016 at 10:38

1 Answer 1


You're creating the contract instance with an address. You haven't told eth.contract anything about a transaction, so there's no reason why you should be seeing a transaction hash.

  • after executed myBallot = eth.contract(abi).at(addr), then txpool.status, the pending was still 0, so what should I do to make the instance have a normal transaction hash? Commented Dec 26, 2016 at 6:51
  • You don't need it to have a transaction hash. It's not a transaction. When you call giveRightToVote against it, that will be a transaction, and that (not the contract instance) will produce a transaction hash. Commented Dec 26, 2016 at 8:57

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.