[Ethereum] How do i know if an account is unlocked in geth

go-ethereum

Is there any API available to check whether an account is locked/unlocked in geth ? If i try to unlock an account that is already in unlocked state, does geth look out for the cached decrypted key , instead of decrypting each time ?

Also what if there are concurrent requests for unlocking of the same account (which is initially locked) ? Can this result in out of Memory error ?

Best Answer

At the geth console (invoked by geth attach), run personal.listWallets to see a list of wallets and their statuses:


[{
    accounts: [{
        address: "0xae9c2ed2209d2228c131cc99569233a5d506770b",
        url: "..."
    }],
    status: "Unlocked",
    url: "..."
}]

You're interested in the wallet status field which can be either "Locked" or "Unlocked".

Related Topic