I have set up a private network with Geth with the following command:

geth --datadir="PathToDatadir" --mine -minerthreads 2 -verbosity 3 -maxpeers 5 --ipcapi "admin,debug,eth,miner,net,personal,shh,txpool,web3" --ipcpath "geth.ipc" --port 30301 --rpc --rpcport 8101 --rpcapi eth,web3,personal --etherbase "e04fe31f4133f25ef3e5bfb39146edcf28724acd" --networkid 9990

So far so good.

I have developed a system of contracts using truffle and testrpc and am now trying to deploy this to multiple nodes. When running truffle migrate, i run into trouble:

Running migration: 1_initial_migration.js Replacing Migrations... Error encountered, bailing. Network state unknown. Review successful transactions manually. Error: account is locked

I have configured truffle to send from an address I want (same one that is defined as etherbase) but the account is locked. There are multiple ways to unlock an account using Geth. The only way it seems to work for me is if I unlock the account like this:

geth --unlock "e04fe31f4133f25ef3e5bfb39146edcf28724acd" --password "fullPathtoTxtPasswordfile"

Does the account remain unlocked for future Geth invocations ? Unlocking through personal.unlockAccount("address","fullPathtoTxtPasswordfile") in the console is not working either. web3.accounts is also undefined.

So I seem to have succeeded in unlocking the accounts but truffle migrate is still giving me the account locked error. I have found similar problems with account unlocks but have not found a solution for my own specific problem.

  • Seems like my problem was caused by not defining a network to use when running truffle migrate.
    – Morph
    Commented Dec 13, 2016 at 15:04

1 Answer 1


personal.unlockAccount does not take a file path, it takes a password. See: https://github.com/ethereum/go-ethereum/wiki/JavaScript-Console#personalunlockaccount

On the command line, try using this:

geth --unlock 0 --password "fullpathtofile" - the unlock argument takes an index. You can see the indexes by running geth account list.

If you want to make sure that it's not a problem with the file, you can also do this:

geth --unlock 0 --password <(echo "PASSWORD_HERE")

The <(command) form executes the command inside the parenthesis and creates a named pipe that it passes to the program, acting as a file with the contents of that output. You can use this as a test for non-sensitive test accounts.

  • 1
    Thanks for the useful information. I was already able to unlock the account by giving the address between brackets as parameter. However, if i prepend or append the unlock and password flags to the larger Geth command, I get the following message: Fatal: Could not list accounts: account index 0 out of range [0, -1] truffle migrate still seems to think the account is locked, while I have unlocked it in Geth.
    – Morph
    Commented Dec 13, 2016 at 14:32

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.