1

I deployed a contract under with Truffle. I am able to use my contract as user: web3.eth.accounts[0]. What if I wanted to use this deployed contract object as a different user, say: web3.eth.accounts[1]?

I have the private key for all these accounts, since TestRPC gives them to you at start up. But the web3.personal.unlockAccount does not work for me. Also this function seems to require a PASSWORD. I have a private key, whats this got to do with a password?

truffle(development)> web3.personal.unlockAccount(web3.eth.accounts[1])
Error: Error: RPC method personal_unlockAccount not supported.
    at GethApiDouble.handleRequest (/usr/local/lib/node_modules/ethereumjs-testrpc/lib/subproviders/geth_api_double.js:49:16)
    at next (/usr/local/lib/node_modules/ethereumjs-testrpc/node_modules/web3-provider-engine/index.js:95:18)
    at SolcSubprovider.handleRequest (/usr/local/lib/node_modules/ethereumjs-testrpc/node_modules/web3-provider-engine/subproviders/solc.js:28:7)
    at next (/usr/local/lib/node_modules/ethereumjs-testrpc/node_modules/web3-provider-engine/index.js:95:18)
    at VmSubprovider.handleRequest (/usr/local/lib/node_modules/ethereumjs-testrpc/node_modules/web3-provider-engine/subproviders/vm.js:40:12)
    at next (/usr/local/lib/node_modules/ethereumjs-testrpc/node_modules/web3-provider-engine/index.js:95:18)
    at GethDefaults.handleRequest (/usr/local/lib/node_modules/ethereumjs-testrpc/lib/subproviders/gethdefaults.js:17:12)
    at next (/usr/local/lib/node_modules/ethereumjs-testrpc/node_modules/web3-provider-engine/index.js:95:18)
    at FilterSubprovider.handleRequest (/usr/local/lib/node_modules/ethereumjs-testrpc/node_modules/web3-provider-engine/subproviders/filters.js:87:7)
    at next (/usr/local/lib/node_modules/ethereumjs-testrpc/node_modules/web3-provider-engine/index.js:95:18)
    at Object.InvalidResponse (/usr/local/lib/node_modules/truffle/node_modules/web3/lib/web3/errors.js:35:16)
    at RequestManager.send (/usr/local/lib/node_modules/truffle/node_modules/web3/lib/web3/requestmanager.js:61:22)
    at Personal.send [as unlockAccount] (/usr/local/lib/node_modules/truffle/node_modules/web3/lib/web3/method.js:145:58)
    at evalmachine.<anonymous>:1:15
    at ContextifyScript.Script.runInContext (vm.js:53:29)
    at Object.runInContext (vm.js:108:6)
    at TruffleInterpreter.interpret (/usr/local/lib/node_modules/truffle/lib/repl.js:136:17)
    at bound (domain.js:301:14)
    at REPLServer.runBound [as eval] (domain.js:314:12)
    at REPLServer.onLine (repl.js:433:10)

1 Answer 1

2

use this command $ testrpc --secure -u 0 -u 1

2
  • Thank you. Can you please explain what that does? I still get this error : truffle(development)> web3.personal.unlockAccount(web3.eth.accounts[1]) Error: Error: RPC method personal_unlockAccount not supported.
    – Raven
    Jul 25, 2017 at 1:15
  • see this doc github.com/ethereumjs/testrpc
    – TahaBA
    Jul 25, 2017 at 1:22

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.