Bitcoin Forum
May 28, 2017, 05:10:27 AM *
News: If the forum does not load normally for you, please send me a traceroute.
 
   Home   Help Search Donate Login Register  
Pages: [1]
  Print  
Author Topic: recommended way to test if wallet is encrypted using rpc  (Read 893 times)
mav
Full Member
***
Offline Offline

Activity: 169


View Profile
July 20, 2012, 06:13:50 AM
 #1

I'm using rpc to access remote wallets, and I want to ensure those wallets are encrypted before I store any details about how to access them.

Currently I'm calling getnewaddress and then dumpprivkey with that address, and if dumpprivkey returns an error I assume that the wallet is encrypted. If it gives me a private key, I assume the wallet is not encrypted.

This is a pretty terrible way of testing whether a wallet is encrypted.

Does anyone have a suggested 'best practice' way to achieve my goal?
1495948227
Hero Member
*
Offline Offline

Posts: 1495948227

View Profile Personal Message (Offline)

Ignore
1495948227
Reply with quote  #2

1495948227
Report to moderator
1495948227
Hero Member
*
Offline Offline

Posts: 1495948227

View Profile Personal Message (Offline)

Ignore
1495948227
Reply with quote  #2

1495948227
Report to moderator
"If you don't want people to know you're a scumbag then don't be a scumbag." -- margaritahuyan
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction. Advertise here.
1495948227
Hero Member
*
Offline Offline

Posts: 1495948227

View Profile Personal Message (Offline)

Ignore
1495948227
Reply with quote  #2

1495948227
Report to moderator
1495948227
Hero Member
*
Offline Offline

Posts: 1495948227

View Profile Personal Message (Offline)

Ignore
1495948227
Reply with quote  #2

1495948227
Report to moderator
koin
Legendary
*
Offline Offline

Activity: 874


View Profile
July 20, 2012, 06:30:38 AM
 #2

Does anyone have a suggested 'best practice' way to achieve my goal?

yes.  write a patch.
dooglus
Legendary
*
Offline Offline

Activity: 2170



View Profile
July 20, 2012, 06:36:03 AM
 #3

Kind of ugly still, but better than what you're doing:

Quote
$ bitcoind walletpassphrase '' 1 # not encrypted
error: {"code":-15,"message":"Error: running with an unencrypted wallet, but walletpassphrase was called."}
$ bitcoind walletpassphrase '' 1 # encrypted and locked
error: {"code":-1,"message":"walletpassphrase <passphrase> <timeout>\nStores the wallet decryption key in memory for <timeout> seconds."}
$ bitcoind walletpassphrase '' 1 # encrypted an unlocked
error: {"code":-17,"message":"Error: Wallet is already unlocked."}

Just-Dice                 ██             
          ██████████         
      ██████████████████     
  ██████████████████████████ 
██████████████████████████████
██████████████████████████████
██████████████████████████████
██████████████████████████████
██████████████████████████████
██████████████████████████████
██████████████████████████████
██████████████████████████████
██████████████████████████████
    ██████████████████████   
        ██████████████       
            ██████           
   Play or Invest                 ██             
          ██████████         
      ██████████████████     
  ██████████████████████████ 
██████████████████████████████
██████████████████████████████
██████████████████████████████
██████████████████████████████
██████████████████████████████
██████████████████████████████
██████████████████████████████
██████████████████████████████
██████████████████████████████
    ██████████████████████   
        ██████████████       
            ██████           
   1% House Edge
mav
Full Member
***
Offline Offline

Activity: 169


View Profile
July 20, 2012, 06:51:01 AM
 #4

Kind of ugly still, but better than what you're doing:

Quote
$ bitcoind walletpassphrase '' 1 # not encrypted
error: {"code":-15,"message":"Error: running with an unencrypted wallet, but walletpassphrase was called."}
$ bitcoind walletpassphrase '' 1 # encrypted and locked
error: {"code":-1,"message":"walletpassphrase <passphrase> <timeout>\nStores the wallet decryption key in memory for <timeout> seconds."}
$ bitcoind walletpassphrase '' 1 # encrypted an unlocked
error: {"code":-17,"message":"Error: Wallet is already unlocked."}


Excellent thanks a lot for this suggestion, it's definitely better than what I was doing. Not sure why I didn't think to do this in the first place.
Pages: [1]
  Print  
 
Jump to:  

Sponsored by , a Bitcoin-accepting VPN.
Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!