I executed the following:

➜  voting_truffle truffle migrate
Compiling ./contracts/Migrations.sol...
Compiling ./contracts/Voting.sol...

Compilation warnings encountered:

/Users/glaksmono/Documents/Blockchain Projects/voting_truffle/contracts/Migrations.sol:11:3: Warning: No visibility specified. Defaulting to "public".
  function Migrations() {
Spanning multiple lines.
,/Users/glaksmono/Documents/Blockchain Projects/voting_truffle/contracts/Migrations.sol:15:3: Warning: No visibility specified. Defaulting to "public".
  function setCompleted(uint completed) restricted {
Spanning multiple lines.
,/Users/glaksmono/Documents/Blockchain Projects/voting_truffle/contracts/Migrations.sol:19:3: Warning: No visibility specified. Defaulting to "public".
  function upgrade(address new_address) restricted {
Spanning multiple lines.

Writing artifacts to ./build/contracts

Using network 'development'.

Running migration: 1_initial_migration.js
  Deploying Migrations...
  ... undefined
Error encountered, bailing. Network state unknown. Review successful transactions manually.
Error: authentication needed: password or unlock
    at Object.InvalidResponse (/usr/local/lib/node_modules/truffle/build/cli.bundled.js:43303:16)
    at /usr/local/lib/node_modules/truffle/build/cli.bundled.js:331156:36
    at /usr/local/lib/node_modules/truffle/build/cli.bundled.js:175492:11
    at /usr/local/lib/node_modules/truffle/build/cli.bundled.js:314196:9
    at XMLHttpRequest.request.onreadystatechange (/usr/local/lib/node_modules/truffle/build/cli.bundled.js:315621:13)
    at XMLHttpRequestEventTarget.dispatchEvent (/usr/local/lib/node_modules/truffle/build/cli.bundled.js:70159:18)
    at XMLHttpRequest._setReadyState (/usr/local/lib/node_modules/truffle/build/cli.bundled.js:70449:12)
    at XMLHttpRequest._onHttpResponseEnd (/usr/local/lib/node_modules/truffle/build/cli.bundled.js:70604:12)
    at IncomingMessage.<anonymous> (/usr/local/lib/node_modules/truffle/build/cli.bundled.js:70564:24)
    at emitNone (events.js:111:20)
➜  voting_truffle

I have 2 migration files: 1. migrations/1_initial_migration.js 2. migrations/2_deploy_contracts.js

The content of migrations/2_deploy_contracts.js is the following:

var Voting = artifacts.require("./Voting.sol");
module.exports = function(deployer) {
  deployer.deploy(Voting, ['Rama', 'Nick', 'Jose'], {gas: 6700000});
/* As you can see above, the deployer expects the first argument to   be the name of the contract followed by constructor arguments. In our case, there is only one argument which is an array of
candidates. The third argument is a hash where we specify the gas required to deploy our code. The gas amount varies depending on the size of your contract.

Here's the status of my blockchain synchronization from geth attach:

> eth.syncing
  currentBlock: 2179367,
  highestBlock: 2179534,
  knownStates: 5799770,
  pulledStates: 5764000,
  startingBlock: 0

I've been trying to figure this out for days, and I'm stuck. Any ideas?

I'm trying to follow this tutorial, and I'm stuck in the migration section.

1 Answer 1


This line is your problem - Error: authentication needed: password or unlock

You need to open up the geth console and type personal.unlockAccount("address", "password", 0) to deploy the contracts to ropsten.

He says it in the tutorial in section 4 here:

mahesh@projectblockchain:~/voting$ truffle console
truffle(default)> web3.personal.newAccount('verystrongpassword')
truffle(default)> web3.eth.getBalance('0x95a94979d86d9c32d1d2ab5ace2dcc8d1b446fa1')
{ [String: '0'] s: 1, e: 0, c: [ 0 ] }
truffle(default)> web3.personal.unlockAccount('0x95a94979d86d9c32d1d2ab5ace2dcc8d1b446fa1', 'verystrongpassword', 15000)
// Replace 'verystrongpassword' with a good strong password.
// The account is locked by default, make sure to unlock it before using the account for deploying and interacting with the blockchain.

He has 1500, I put 0 in as the third variable. That indicates the amount of time you want the account unlocked. If you put 0 it unlocks for the entire session.

  • Do you actually execute the migration within the truffle console? Doesn't seem working with me: gist.github.com/glaksmono/a260ca02cd741ad5d1e9f107c663e4cc
    – 0xgoku
    Commented Dec 1, 2017 at 16:25
  • Instead of using the truffle console try using the standard geth console. When you first start geth on ropsten you should get an IPC endpoint. It should look like INFO [08-06|08:06:14] IPC endpoint opened: <path>. Once you get that path, type geth attach ipc:<path>. That should open up the console. In that console type personal.unlockAccount('0x60a9e63750adfafc77bd0ba692a20e4dbe330c24', 'pass', 0. Commented Dec 1, 2017 at 16:34
  • Then where do you type the truffle migration? I don't think you can type that in the geth console.
    – 0xgoku
    Commented Dec 1, 2017 at 16:49
  • truffle migrate --network ropsten in the project folder like you would normally. You should have 3 tabs open. One running geth, one running geth console, and one to migrate the contracts Commented Dec 1, 2017 at 16:59
  • This is my truffle.js: gist.github.com/glaksmono/f97543cf6da57fa4234f3445df977836 and I'm getting this error now: gist.github.com/glaksmono/e7dbbff3a31faae27f0eaefe587ac0e4
    – 0xgoku
    Commented Dec 2, 2017 at 2:53

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.