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

CC BY-SA 4.0
2019-05-23T10:21:00.187Z
2019-05-23T10:21:00.187Z
Luong Nguyen
<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>

<bitcoin-core><bitcoind>
Understanding bitcoin-cli commands walletlock and walletpassphrase
Paras
# Understanding bitcoin-cli commands walletlock and walletpassphrase

(Asked by: username_0 on 2019-05-23)

I am trying to understand two commands listed in the following [link](https://en.bitcoin.it/wiki/Original_Bitcoin_client/API_calls_list).

**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 `walletlock`command and to decrypt it I need to call `walletpassphrase` command. Am I correct?

**Tags:** bitcoin-core, bitcoind


---

## 1 answers

### Answer by username_1 on 2019-05-23. Score: 1 | Accepted answer

No, use `encryptwallet` to encrypt the wallet, read [this document](http://chainquery.com/bitcoin-api/encryptwallet):

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


---

