Truffle migrate works when I use testrpc but not geth.

Here's what I did for testrpc: In one console


In another

truffle console

resulting in

Using network 'development'.

Running migration: 2_deploy_contracts.js
  Deploying GoodFund...
  GoodFund: 0x18c9f7f2468714dab06264cf06446f66251ac930
Saving successful migration to network...
Saving artifacts...

However when I use

geth --testnet console
admin.startRPC("", 8545, "*", "web3,db,net,eth")
personal.unlockAccount('account key', 'blah', 15000)

and in another console

truffle  migrate

resulting in

Running migration: 1_initial_migration.js
  Deploying Migrations...
Error encountered, bailing. Network state unknown. Review successful transactions manually.
Error: authentication needed: password or unlock

I've tried changing truffle.js host from 'localhost' to '' and got the same error.

This is what I have in 2_deploy_contracts.js

var GoodFund = artifacts.require("./GoodFund.sol");

module.exports = function(deployer) {
  deployer.deploy(GoodFund, '0x6196bc7c252ac811ce06824cd5abbbe4b36db6dc', {gas:4000000});

Thanks for y'alls help!


1 Answer 1


You need to unlock the default account in case of geth which you created at the time of node setup probably using the following account -

geth --datadir path_to_dir/ account new

You can unlock the default account like this -

personal.unlockAccount(eth.accounts[0], 'password', 0)

If you don't remember the default account password, then I'd recommend you to setup the geth node again, unlock the default account and run truffle migrate.

You can follow the steps mentioned in this answer to do private net setup - How do I set up a private ethereum network?

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