Bitcoin Forum
May 30, 2024, 12:35:46 PM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: which operations require the bitcoind wallet to be unlocked?  (Read 2208 times)
Staring Owl (OP)
Member
**
Offline Offline

Activity: 90
Merit: 10


View Profile
December 09, 2013, 01:47:32 PM
 #1

Say the wallet is encrypted, for which operations we should unlock it before doing them?
Sending money is understandable, what else?

 Grin SLOT machine with generous payouts and affiliate program. BTC No registration needed BTC Start playing for real within seconds BTC Provably fair and transparent BTC You can win up to 5000 times your bet BTC Or make 30% by referring friends. ->  BitBandit.eu
wumpus
Hero Member
*****
qt
Offline Offline

Activity: 812
Merit: 1022

No Maps for These Territories


View Profile
December 09, 2013, 02:59:01 PM
 #2

* dumpprivkey
* dumpwallet
* importwallet
* keypoolrefill
* sendfrom
* sendmany
* sendtoaddress
* signmessage
* signrawtransaction (if keys are not provided on command line)

(just look where EnsureWalletIsUnlocked is used)

Bitcoin Core developer [PGP] Warning: For most, coin loss is a larger risk than coin theft. A disk can die any time. Regularly back up your wallet through FileBackup Wallet to an external storage or the (encrypted!) cloud. Use a separate offline wallet for storing larger amounts.
flatfly
Legendary
*
Offline Offline

Activity: 1078
Merit: 1016

760930


View Profile
December 09, 2013, 08:37:56 PM
 #3

This wiki page has it (last column in the table):

https://en.bitcoin.it/wiki/Original_Bitcoin_client/API_calls_list
Staring Owl (OP)
Member
**
Offline Offline

Activity: 90
Merit: 10


View Profile
December 11, 2013, 04:50:14 PM
 #4

Thank you guys, that was very helpful.

Just one more thing, so I'm sure.

getnewaddress  is not supposed to require unlocking

but all GUI clients require the encryption password when creating new address, even bitcoin-qt which is supposed to create 100 addresses in advance.
why is that?

any chance the bitcoind will want unlocking password when it uses up the pre-generated 100 addresses?

 Grin SLOT machine with generous payouts and affiliate program. BTC No registration needed BTC Start playing for real within seconds BTC Provably fair and transparent BTC You can win up to 5000 times your bet BTC Or make 30% by referring friends. ->  BitBandit.eu
DeathAndTaxes
Donator
Legendary
*
Offline Offline

Activity: 1218
Merit: 1079


Gerald Davis


View Profile
December 11, 2013, 04:52:27 PM
 #5

getnewaddress will fail if the keypool (default 100 keys) is exhausted when you call it.  The keypool can only be refilled when the wallet is unlocked.  You can raise the size of the keypool if you anticipate this being a problem.
Staring Owl (OP)
Member
**
Offline Offline

Activity: 90
Merit: 10


View Profile
December 11, 2013, 07:39:44 PM
 #6

so bitcoind generates the new 100 addresses at once when the last one of the existing ones is used or it always keeps 100 unused ones in advance?


 Grin SLOT machine with generous payouts and affiliate program. BTC No registration needed BTC Start playing for real within seconds BTC Provably fair and transparent BTC You can win up to 5000 times your bet BTC Or make 30% by referring friends. ->  BitBandit.eu
DeathAndTaxes
Donator
Legendary
*
Offline Offline

Activity: 1218
Merit: 1079


Gerald Davis


View Profile
December 11, 2013, 07:46:24 PM
Last edit: December 11, 2013, 08:49:14 PM by DeathAndTaxes
 #7

so bitcoind generates the new 100 addresses at once when the last one of the existing ones is used or it always keeps 100 unused ones in advance?

Neither.  
If the wallet is unlocked the wallet will create as many new addresses to refill the pool back to 100 anytime it is less than 100 (default).
If the wallet is locked the wallet will not be able to refill the keypool and the number of addresses in the keypool will decline.
If the keypool has 0 addresses and you call getnewaddress it will fail.

Calling getinfo will show the number of keys remaining in the keypool.  Try experimenting with getnewaddress, getinfo, and walletpassphrase so observe how the keypool behaves.

Example:
Wallet has a keypool of 100

Lock Wallet. Keypool = 100
GetNewAddress. Keypool = 99
GetNewAddress. Keypool = 98
GetNewAddress. Keypool = 97
GetNewAddress. Keypool = 96
GetNewAddress. Keypool = 95
UnlockWallet. Keypool = 100
GetNewAddress. Keypool = 100 (generated as soon as used)
GetNewAddress. Keypool = 100
GetNewAddress. Keypool = 100
GetNewAddress. Keypool = 100
GetNewAddress. Keypool = 100
LockWallet. Keypool = 100
GetNewAddress. Keypool = 99
GetNewAddress. Keypool = 98
GetNewAddress. Keypool = 97
...
GetNewAddress. Keypool = 1
GetNewAddress. Keypool = 0
GetNewAddress. FAILURE. No address provided, keypool exhausted.
UnlockWallet. Keypool = 100




Staring Owl (OP)
Member
**
Offline Offline

Activity: 90
Merit: 10


View Profile
December 11, 2013, 08:41:50 PM
 #8

very very useful info! thank you big time.

I suppose this isn't documented?

 Grin SLOT machine with generous payouts and affiliate program. BTC No registration needed BTC Start playing for real within seconds BTC Provably fair and transparent BTC You can win up to 5000 times your bet BTC Or make 30% by referring friends. ->  BitBandit.eu
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!