I am using react for interacting with my HelloWorld Smart Contract:
var ETHEREUM_CLIENT = new Web3(new Web3.providers.HttpProvider("http://localhost:8545"))
var helloworldcontractABI = <the json string>
var hellowordlcontractAddress = '0xffe299f7b09f53d716a0898b4454b3c53fb5c2e1'
var helloworldcontract = ETHEREUM_CLIENT.eth.contract(helloworldcontractABI).at(hellowordlcontractAddress)
In my contract i have a method getValue – which returns an integer
When i call the following lines i get some errors:
var value
console.log(value)
value = helloworldcontract.getValue()
console.log(value)
Uncaught Error: Error: could not unlock signer account
What is here the problem? When i try the same scenario in truffle it works fine – so the contract is ok
Best Answer
So many deployment/test scenarios. This should help you poke at it. Specify the from account and make sure it's unlocked.
I usually start testRPC with
to unlock the first two accounts. Or in geth/javascript
Then this should work:
Takes the guesswork out of what's going on.
Or, since this is a getter that won't make a state change, add "call" for local execution that doesn't need gas.