3

How to prevent having to personal.unlockAccount() all the time when using geth and Remix?

I'm using geth and Remix in combination to learn contract development.

All the time, I've to switch to the terminal and enter personal.unlockAccount() to use Remix.

Is there an option to unlock the account on a permanent basis when testing things?

3 Answers 3

5

you can specify the unlock duration in unlockAccount:

personal.unlockAccount(addr, passwd, duration)

Unlock the account with the given address, password and an optional duration (in seconds).

so use for example ; personal.unlockAccount(addr, passwd, 300) //unlock for 5 minutes

web3.personal.unlockAccount(addr, passwd, 0);// the account is unlocked untill geth stops running.
2
  • Thanks, I guess it should be "you can specify the unlock duration..." - and also, an argument of 0 makes the account unlocked indefinitely, right?
    – Shuzheng
    Commented Sep 8, 2017 at 6:24
  • As i know there is no indefinitely unlock
    – Badr Bellaj
    Commented Sep 8, 2017 at 8:12
0

Remix allows you to switch to a JavaScript VM (like TestRPC) that has an account with a lot of Ether and several unlocked accounts - and very quick block times. It is very helpful for learning Solidity and quick development iterations:

enter image description here

0

Use any one of the below options

  1. testrpc -u Account#
  2. testrpc --secure
  3. web3.personal.unlockAccount("address", "pass", 0);
  4. geth --unlock YOUR_ACCOUNT_ADDRESS --password YOUR_PASSWORD
6
  • Where should I specify testrpc?
    – Shuzheng
    Commented Sep 8, 2017 at 6:22
  • yes, testrpc -u your account number Commented Sep 8, 2017 at 6:32
  • Is testrpc a command? Or is it an argument when invoking geth? Or should I write it at the geth JS-console? Sorry, I'm new to Ethereum.
    – Shuzheng
    Commented Sep 8, 2017 at 6:33
  • For geth use this geth --unlock <YOUR_ACCOUNT_ADDRESS> --password <YOUR_PASSWORD> Commented Sep 8, 2017 at 6:39
  • Thanks, what about testrpc?
    – Shuzheng
    Commented Sep 8, 2017 at 6:41

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.