How to Call JSON-RPC SendToAddress when the Wallet is Encrypted? I'm using JSON-RPC to send commands to my bitcoind, and it works fine.

Now I want to encrypt my wallet. When I've done that, I will need to send the passphrase when calling SendToAddress. How do I do that?

Right now I send these parameters:


address 
amount
comment
commentTo


which are put into an array in the order above.

Will the passphrase be another parameter that I append as the last element in that array?
Not in the current code. The way it works now, you have to make two RPC calls -- one to unlock the wallet for a period of time (walletpassphrase) and one to do the transaction (sendtoaddress). You can follow up with a command to lock the wallet immediately, if desired (walletlock).

  walletpassphrase &lt;passphrase&gt; &lt;timeout&gt;
  Stores the wallet decryption key in memory for &lt;timeout&gt; seconds.

  walletlock
  Removes the wallet encryption key from memory, locking the wallet.
  After calling this method, you will need to call walletpassphrase again
  before being able to call any methods which require the wallet to be unlocked.