[Ethereum] how to unlock the account with geth


when I use the web3 interface to sign on msgs, it tell me that the account should be unlocked, how can I manage this with geth and what exactly does unlocking mean?

Best Answer

By default, your accounts in Geth are "locked," which means that you can't send transactions from them. You need to unlock an account in order to send transactions from it through Geth directly or via RPC (though web3 does not support this). In order to unlock an account, you'll need to provide the password, which is used to decrypt the private key associated with your account, hence allowing you to sign transactions.

With that being said, how do you unlock an account? There are a couple different ways you can do it, which are highlighted in the Geth documentation. I'll provide an overview:

  1. Unlock account when you run Geth. The password parameter is optional. If you don't provide it, you'll be prompted to type in the password.

    geth --unlock <YOUR_ACCOUNT_ADDRESS> --password <YOUR_PASSWORD>

  2. Unlock account from the Geth interactive Javascript console. Again, the password is optional. If you don't provide it, you'll be prompted to type it in. Note that in earlier versions of Geth, providing the password as a parameter would cause the password to show up in the Geth log, which may be a security concern.

    personal.unlockAccount(address, "password")

Related Topic