Check if wallet is encrypted or not through RPC API

3

1

How can one check if their wallet is encrypted through the RPC API without receiving an exception?

I went through the Original Bitcoin client API calls list but didn't find any command that could facilitate this functionality without resulting into an error in the response.

Any ideas or workarounds?

Doug Peters

Posted 2014-04-14T01:05:30.193

Reputation: 1 326

Answers

0

From the source code (rpcprotocol.h):

RPC_WALLET_ERROR                = -4,  // Unspecified problem with wallet (key not found etc.)

So you could check for a JSON-RPC return value of -4, or if you want to be absolutely sure, you can use:

bitcoind [...] -help | grep walletlock

The walletlock RPC command becomes only available (in the -help list) after encrypting your wallet.

Jori

Posted 2014-04-14T01:05:30.193

Reputation: 1 522