I'm having difficulty getting going with truffle and testrpc.

The steps I've taken are:

  • Create a blank project and initialise with truffle init
  • Start testrpc with testrpc

Trying truffle migrate or truffle test then gives me "

Error: authentication needed: password or unlock
at Object.InvalidResponse (/usr/local/lib/node_modules/truffle/node_modules/web3/lib/web3/errors.js:35:16)
at /usr/local/lib/node_modules/truffle/node_modules/web3/lib/web3/requestmanager.js:86:36
at XMLHttpRequest.request.onreadystatechange (/usr/local/lib/node_modules/truffle/node_modules/web3/lib/web3/httpprovider.js:118:13)
at XMLHttpRequestEventTarget.dispatchEvent (/usr/local/lib/node_modules/truffle/node_modules/xhr2/lib/xhr2.js:64:18)
at XMLHttpRequest._setReadyState (/usr/local/lib/node_modules/truffle/node_modules/xhr2/lib/xhr2.js:354:12)
at XMLHttpRequest._onHttpResponseEnd (/usr/local/lib/node_modules/truffle/node_modules/xhr2/lib/xhr2.js:509:12)
at IncomingMessage.<anonymous> (/usr/local/lib/node_modules/truffle/node_modules/xhr2/lib/xhr2.js:469:24)
at emitNone (events.js:91:20)
at IncomingMessage.emit (events.js:185:7)
at endReadableNT (_stream_readable.js:974:12)

From what I've read this seems like an error with accounts being locked, but testrpc's documentation suggests that by default it will create 10 accounts which are unlocked - unless you specify --secure?

  • Try starting testrpc with $ testrpc -u 0 -u 1. Resolved? – Rob Hitchens - B9lab Apr 6 '17 at 9:53
  • @RobHitchens nope, same result – mbdavis Apr 6 '17 at 10:02

I had another instance of geth running, which truffle was trying to use instead of testrpc, and I hadn't deployed.

  • Make sure testrpc is the only geth instance running
  • Call truffle deploy before trying truffle migrate or truffle test

You have prob with testrpc,just try to restart it after you deploy with truffle. You can watch this tuto: truffle+MetaMask+testrpc

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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