2

I am trying the sample voting contract given in the Solidity docs https://solidity.readthedocs.io/en/latest/solidity-by-example.html.

I managed to deploy the voting contract to the blockchain.

Once the contract is deployed, how do I access the different methods of the contract later from web3?

The functionality I need is:

  • new user signs up to a service
  • address of this new user should get added to the list of voters using the giveRightToVote method in the contract
  • After a fixed time,all the voters should cast their votes using the vote method
  • Get the results of the voting using winningProposal method

How do I achieve this functionality using just the contract address in web3?

pd176
  • 439
  • 4
  • 14
  • It is preferred if you can post separate questions instead of combining your questions into one. That way, it helps the people answering your question and also others hunting for at least one of your questions. Thanks! And have you read these sections: https://github.com/ethereum/wiki/wiki/JavaScript-API#web3ethcontract – eth May 13 '16 at 00:29
  • Or do you mean http://ethereum.stackexchange.com/questions/2508/getting-a-contract-by-address-only-without-abi-definition ? – eth May 13 '16 at 00:33
  • 1
    sorry! hadn't read the docs properly! got it working using contract.at(address) – pd176 May 13 '16 at 06:47

0 Answers0