0

I am using geth via third party application. I want to verify that specific Ethereum accounts are already unlocked or not, since unlocking an account can be timeout.

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

[Q] Is there any way to verify that specific Ethereum accounts are already unlocked?


Please note that following script:

var Personal = require('web3-eth-personal');

Web3 = require("web3");
web3 = new Web3(new Web3.providers.HttpProvider("http://localhost:8545"));

if(!web3.isConnected()){
    console.log("notconnected");
    process.exit();
}

console.log(web3.personal

Returns, which does not have personal.listWallets:

Personal {
  _requestManager:
   RequestManager {
     provider:
      HttpProvider {
        host: 'http://localhost:8545',
        timeout: 0,
        user: undefined,
        password: undefined,
        headers: undefined },
     polls: {},
     timeout: null },
  newAccount: { [Function: send] request: [Function: bound ], call: 'personal_newAccount' },
  importRawKey: { [Function: send] request: [Function: bound ], call: 'personal_importRawKey' },
  unlockAccount: { [Function: send] request: [Function: bound ], call: 'personal_unlockAccount' },
  ecRecover: { [Function: send] request: [Function: bound ], call: 'personal_ecRecover' },
  sign: { [Function: send] request: [Function: bound ], call: 'personal_sign' },
  sendTransaction:
   { [Function: send]
     request: [Function: bound ],
     call: 'personal_sendTransaction' },
  lockAccount: { [Function: send] request: [Function: bound ], call: 'personal_lockAccount' },
  listAccounts: [Getter],
  getListAccounts: { [Function: get] request: [Function: bound ] } }
  • What do you mean with 'unlocked'? How can an account be locked / unlocked? – Lauri Peltonen Mar 12 '18 at 8:28
  • In order to send Tx we need to unlock an account: personal.unlockAccount(eth.accounts[0], "password"); @LauriPeltonen – alper Mar 12 '18 at 8:33
  • Ah in that sense :) – Lauri Peltonen Mar 12 '18 at 8:36
  • not necessarily exactly the same but some of the suggestions in this question may help – TC8 Mar 12 '18 at 9:08
1

Have a look at https://ethereum.stackexchange.com/a/32059.

Running personal.listWallets displays a list of all your wallets and shows their status (locked or unlocked).

  • web3.personal does not provide listWallets under nodejs @Fischa7 – alper Mar 13 '18 at 22:08
0

personal.listAccounts This will give you a list of address's within a wallet.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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