<blockquote>
  <p>1、Why not directly use the key derived based the wallet's passphrase?</p>
</blockquote>

<p>Encrypting a master key which is then used to encrypt the actual keys is a fairly standard practice for encrypting data. Doing this allows the master key to remain the same so that changing the password does not result in having to decrypt and then re-encrypt all of the encrypted data. It only requires decrypting and re-encrypting the encryption key.</p>

<blockquote>
  <p>2、Why the unencrypted master key is stored in memory, why not private keys?</p>
</blockquote>

<p>A wallet can contain thousands of keys (or tens of thousdands, or even hundreds of thousands). Keeping all of these keys in memory will use memory and possibly take up so much memory that the system is unable to keep running bitcoind. A master key is fixed size though, and fairly small, so keeping that in memory is not a burden.</p>

CC BY-SA 4.0
2018-07-19T01:47:43.563Z
2018-07-19T01:47:43.563Z
Ava Chow
<p>When encrypt wallet, using a master key to encrypt private key.The master key is encrypted by the key derived based the wallet's passphrase. 
When unlock wallet, the unencrypted master key is stored in memory, but not private keys.</p>

<p>1、Why not directly use the key derived based the wallet's passphrase?
2、Why the unencrypted master key is stored in memory, why not private keys?</p>

<wallet>
Why use the master key to encrypt private key? And why just store unencrypted master key in memory?
nicky
# Why use the master key to encrypt private key? And why just store unencrypted master key in memory?

(Asked by: username_0 on 2018-07-16)

When encrypt wallet, using a master key to encrypt private key.The master key is encrypted by the key derived based the wallet's passphrase.
When unlock wallet, the unencrypted master key is stored in memory, but not private keys.

1、Why not directly use the key derived based the wallet's passphrase?
2、Why the unencrypted master key is stored in memory, why not private keys?

**Tags:** wallet


---

## 1 answers

### Answer by username_1 on 2018-07-19. Score: 1

> 1、Why not directly use the key derived based the wallet's passphrase?

Encrypting a master key which is then used to encrypt the actual keys is a fairly standard practice for encrypting data. Doing this allows the master key to remain the same so that changing the password does not result in having to decrypt and then re-encrypt all of the encrypted data. It only requires decrypting and re-encrypting the encryption key.

> 2、Why the unencrypted master key is stored in memory, why not private keys?

A wallet can contain thousands of keys (or tens of thousdands, or even hundreds of thousands). Keeping all of these keys in memory will use memory and possibly take up so much memory that the system is unable to keep running bitcoind. A master key is fixed size though, and fairly small, so keeping that in memory is not a burden.


---

