Run Geth Node With Multiple Unlocked Accounts

August 20, 2017

There is a bit of a trick to run a Geth node with multiple unlocked accounts. It has to do with how to pass in the parameters.

There are two parameters to focus in on. The unlock and the password.

The first, the unlock accepts a list of accounts or a list of indexes into your account list. To keep you command line short you can, for example, pass in "0, 1" to unlock your first two accounts.

Next, you need to get your password passed in if you are starting geth from a script. The way to do this is to put your password in a file and pass that file in through the password command.

For two accounts, the trick is to use a single file for all the passwords you need to pass in. Put each on it's own line in the file. For the two account example you'd have a password file with two passwords each on it's own line.

Here is a mocked up command as an example.

geth --testnet --datadir $ETHEREUM/testnet --rpc --rpcaddr 0.0.0.0 --rpcport 8545 --unlock '0, 1' --password '$ETHEREUM/files/p.txt'

Tags: geth ethereum