<p>All addresses and their corresponding private and public keys are stored in the <code>wallet.dat</code> file in the data directory. Assuming your Bitcoin Core is running on a machine which has access to many people but you want to prevent unauthorized persons from dumping the wallet on that shared machine, the best way I can think of is that you can encrypt your wallet with a passphrase. When they run the <code>dumpwallet</code> command, the private keys that are dumped will be encrypted.</p>

<p>When you want to get the unencrypted private keys you can run the command <code>walletpassphrase &lt;passphrase&gt; &lt;time to unlock in seconds&gt;</code> and then run the <code>dumpwallet</code> command.</p>

<p>However, using an online connected wallet for storing large number of bitcoins is not recommended as there always will be a weak point which can be exploited. You could run two Bitcoin core, one online and other offline. With the current Bitcoin Core, you create a wallet on your offline machine. Using it, you get one or more addresses (saving them, for example, to a text file). You copy those addresses to your online computer and give them to people to pay you. When you want to spend those payments, you create the transaction on the online computer in an unsigned form, copy it to your offline computer, verify it, sign it, copy the signed transaction back to the online computer, and send it. You can use the watch only functionality in the online Bitcoin Core wallet by importing the addresses using <code>importaddress</code> command.</p>

<p><strong>EDIT for Bitcoin Core v0.18</strong>. The latest release of Bitcoin Core v0.18 supports hardware wallet integration to allow command line management of several hardware wallets including Trezor Model T, Trezor One, Ledger Nano, Digital BitBox, KeepKey and ColdCard. This would allow you to get the same security of a hardware cold wallet but with added functionality of relying on your full node rather than the SPV node of the wallet. For more information refer <a href="https://github.com/bitcoin-core/HWI#readme" rel="nofollow noreferrer">Using Bitcoin Core with Hardware Wallets</a> on GitHub.</p>

CC BY-SA 4.0
2019-04-28T12:02:21.083Z
Actually, the server will only be accessible by authorized people. I was talking about the possible scenario of my server being hacked. Are there any way to prevent a hacker from getting all the funds? The solution you proposed is awesome from rpcs like dumpwallet. But what about sendtoaddress? Would a hacker be able to send all the funds from all the wallets?
zabbir
CC BY-SA 4.0
2019-04-28T12:10:05.760Z
@zabbir If you use the `passphrase` to encrypt your wallet, an attacker will not be able to spend your bitcoins without it.
Ugam Kamat
CC BY-SA 4.0
2019-04-28T12:22:25.807Z
But I want my app to interact with the funds. So I would have to store the pass phrase somewhere in the program which makes it useless
zabbir
CC BY-SA 4.0
2019-04-28T15:44:39.027Z
@zabbir In an online wallet there will be a weak point. You could run two Bitcoin core, one online and other offline. With the current Bitcoin Core, you create a wallet on your offline machine. Using it, you get one or more addresses (saving them, for example, to a text file). You copy those addresses to your online computer and give them to people to pay you. When you want to spend those payments, you create the transaction on the online computer in an unsigned form, copy it to your offline computer, verify it, sign it, copy the signed transaction back to the online computer, and send it
Ugam Kamat
CC BY-SA 4.0
2019-04-28T15:45:49.883Z
You can use the watch only functionality in the online Bitcoin Core wallet by importing the addresses using `importaddress` command.
Ugam Kamat
CC BY-SA 4.0
2019-04-28T11:21:26.983Z
2019-05-04T10:21:00.240Z
2019-05-04T10:21:00.240Z
Ugam Kamat
<p>When running a bitcoin node on an enterprise level: a lot of addresses will be generated with <code>getaddress</code> RPC for users to send their funds to. As far as I understand, these addresses, as well as the private keys for them, are all stored somewhere in the datadir. The whole key tree, as well as the seed key, can be dumped through rpc. Are there any rules of thumb to secure these keys from being dumped by unauthorized people? Are there any scalability problems with having too many keys stored in bitcoin core? Any other rules according to private keys and business set up? </p>

<bitcoin-core><address><private-key>
Bitcoin core wallet's security
zabbir
# Bitcoin core wallet's security

(Asked by: username_0 on 2019-04-28)

When running a bitcoin node on an enterprise level: a lot of addresses will be generated with `getaddress` RPC for users to send their funds to. As far as I understand, these addresses, as well as the private keys for them, are all stored somewhere in the datadir. The whole key tree, as well as the seed key, can be dumped through rpc. Are there any rules of thumb to secure these keys from being dumped by unauthorized people? Are there any scalability problems with having too many keys stored in bitcoin core? Any other rules according to private keys and business set up?

**Tags:** bitcoin-core, address, private-key


---

## 1 answers

### Answer by username_1 on 2019-04-28. Score: 0 | Accepted answer

All addresses and their corresponding private and public keys are stored in the `wallet.dat` file in the data directory. Assuming your Bitcoin Core is running on a machine which has access to many people but you want to prevent unauthorized persons from dumping the wallet on that shared machine, the best way I can think of is that you can encrypt your wallet with a passphrase. When they run the `dumpwallet` command, the private keys that are dumped will be encrypted.

When you want to get the unencrypted private keys you can run the command `walletpassphrase <passphrase> <time to unlock in seconds>` and then run the `dumpwallet` command.

However, using an online connected wallet for storing large number of bitcoins is not recommended as there always will be a weak point which can be exploited. You could run two Bitcoin core, one online and other offline. With the current Bitcoin Core, you create a wallet on your offline machine. Using it, you get one or more addresses (saving them, for example, to a text file). You copy those addresses to your online computer and give them to people to pay you. When you want to spend those payments, you create the transaction on the online computer in an unsigned form, copy it to your offline computer, verify it, sign it, copy the signed transaction back to the online computer, and send it. You can use the watch only functionality in the online Bitcoin Core wallet by importing the addresses using `importaddress` command.

**EDIT for Bitcoin Core v0.18**. The latest release of Bitcoin Core v0.18 supports hardware wallet integration to allow command line management of several hardware wallets including Trezor Model T, Trezor One, Ledger Nano, Digital BitBox, KeepKey and ColdCard. This would allow you to get the same security of a hardware cold wallet but with added functionality of relying on your full node rather than the SPV node of the wallet. For more information refer [Using Bitcoin Core with Hardware Wallets](https://github.com/bitcoin-core/HWI#readme) on GitHub.

> **Comments:**
> **username_0**: Actually, the server will only be accessible by authorized people. I was talking about the possible scenario of my server being hacked. Are there any way to prevent a hacker from getting all the funds? The solution you proposed is awesome from rpcs like dumpwallet. But what about sendtoaddress? Would a hacker be able to send all the funds from all the wallets?  
> **username_1**: @username_0 If you use the `passphrase` to encrypt your wallet, an attacker will not be able to spend your bitcoins without it.  
> **username_0**: But I want my app to interact with the funds. So I would have to store the pass phrase somewhere in the program which makes it useless  
> **username_1**: @username_0 In an online wallet there will be a weak point. You could run two Bitcoin core, one online and other offline. With the current Bitcoin Core, you create a wallet on your offline machine. Using it, you get one or more addresses (saving them, for example, to a text file). You copy those addresses to your online computer and give them to people to pay you. When you want to spend those payments, you create the transaction on the online computer in an unsigned form, copy it to your offline computer, verify it, sign it, copy the signed transaction back to the online computer, and send it  
> **username_1**: You can use the watch only functionality in the online Bitcoin Core wallet by importing the addresses using `importaddress` command.  

---

