user88193: I am trying to understand two commands listed in the following link.
1. walletpassphrase
Stores the wallet decryption key in memory for <timeout> seconds.

2. 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.

So if I am clear in my understanding, to encrypt my wallet I need to call the walletlockcommand and to decrypt it I need to call walletpassphrase command. Am I correct?

user90299: No, use encryptwallet to encrypt the wallet, read this document:
Examples:
Encrypt your wallet

bitcoin-cli encryptwallet "my pass phrase"

Now set the passphrase to use the wallet, such as for signing or sending bitcoin

bitcoin-cli walletpassphrase "my pass phrase"

Now we can do something like sign

bitcoin-cli signmessage "address" "test message"

Now lock the wallet again by removing the passphrase

bitcoin-cli walletlock


88193: <p>I am trying to understand two commands listed in the following <a href="https://en.bitcoin.it/wiki/Original_Bitcoin_client/API_calls_list" rel="nofollow noreferrer">link</a>.</p>

<p><strong>1. walletpassphrase</strong></p>

<pre><code>Stores the wallet decryption key in memory for &lt;timeout&gt; seconds.
</code></pre>

<p><strong>2. walletlock</strong></p>

<pre><code>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.
</code></pre>

<p>So if I am clear in my understanding, to encrypt my wallet I need to call the <code>walletlock</code>command and to decrypt it I need to call <code>walletpassphrase</code> command. Am I correct?</p>
 90299: <p>No, use <code>encryptwallet</code> to encrypt the wallet, read <a href="http://chainquery.com/bitcoin-api/encryptwallet" rel="nofollow noreferrer">this document</a>:</p>

<p>Examples:</p>

<p>Encrypt your wallet</p>

<blockquote>
  <p>bitcoin-cli encryptwallet "my pass phrase"</p>
</blockquote>

<p>Now set the passphrase to use the wallet, such as for signing or sending bitcoin</p>

<blockquote>
  <p>bitcoin-cli walletpassphrase "my pass phrase"</p>
</blockquote>

<p>Now we can do something like sign</p>

<blockquote>
  <p>bitcoin-cli signmessage "address" "test message"</p>
</blockquote>

<p>Now lock the wallet again by removing the passphrase</p>

<blockquote>
  <p>bitcoin-cli walletlock</p>
</blockquote>
