<p>Based upon the good answer by Andrew I want to discuss my output from <code>bitcoin-cli dumpwallet dump.txt</code> because I think this will be interesting for people who are at the same stage as me.</p>

<p><code>cat dump.txt</code> shows:</p>

<pre><code># Wallet dump created by Bitcoin v0.18.99.0-12fd4bbd1
# * Created on 2019-09-25T16:04:01Z
# * Best block at time of backup was 409484 (000000000000000000bec614513591c2e5d96a488c2513396e7a723bbf7b1dcd),
#   mined on 2016-04-29T22:30:07Z

# extended private masterkey: xprv*****
...
</code></pre>

<p>In my understanding the <code>masterkey</code> is derived from the seed and is used as parent for all child keys. The prefix <code>xprv</code> relates to it beeing hierarchical. </p>

<p>Then there is a list of pairs of private keys with addresses (public keys) of two kinds, <code>reserve=1</code>and <code>script=1</code>. Also, there is one <code>hdseed=1</code> in the list of <code>reserve=1</code>. All the keys have creation dates with them and <code>hdseed=1</code> has the earliest time (with others).</p>

<pre><code>K**************** 2019-09-04T14:04:25Z reserve=1 # addr=3********* hdkeypath=*****
</code></pre>

<p><code>hdkeypath</code> is probably a description to get from the masterkey to this specific child key, aka the index. This way all childkeys could be recovered from a known masterkey.</p>

<p>The last part of the dump contains several lines like this</p>

<pre><code>0014******* 0 script=1 # addr=3**************
</code></pre>

<p>I am still investigating what <code>0014</code> as a starting number means. </p>

<p><a href="https://en.bitcoin.it/wiki/List_of_address_prefixes" rel="nofollow noreferrer">This</a> is a list of address prefixes.</p>

<hr>

<p>The seed can also be encoded in easy to remember (and written) words with <code>bx hd-mnemonic &lt; SEED</code>.</p>

CC BY-SA 4.0
2019-09-25T17:22:23.993Z
The prefix 0014 is the bytes native P2WPKH scripts start with.
Pieter Wuille
CC BY-SA 4.0
2019-09-25T16:39:38.470Z
2019-09-25T18:53:58.230Z
2019-09-25T18:53:58.230Z
bomben
<p>Bitcoin Core will automatically create a new wallet on first start. This wallet will contain 2000 private keys (unless otherwise specified by the <code>-keypool=&lt;n&gt;</code> option) and the seed used to generate those and future keys, at least until you encrypt the wallet.</p>

<p>As such, there is not just one private key that you need to backup, rather you need to backup 2000 keys and the seed. Otherwise, restoring a backup will not restore all of your private keys.</p>

<p>The easiest way to backup your wallet is to just copy the wallet.dat file to a safe place. I would not recommend that you try to create a paper backup of your wallet.</p>

<p>If you insist on a paper backup, then you should record the seed. The seed can only be gotten by using the <code>dumpwallet</code> RPC command and then finding the private key labeled <code>hdseed</code>. The seed is a private key and cannot be used in any other wallet software since they do not accept the seed as a private key. You will need to remember that it specifically is not just a normal private key and that it only works in Bitcoin Core. To restore the seed, you can use the <code>sethdseed</code> command in a new wallet.</p>

<p>I really don't recommend that you try to backup the seed. There are changes happening to the Bitcoin Core wallet soon that may make your seed backup unable to work. The recommended way of backing up is to copy the wallet.dat file, and to do so periodically. This will guarantee that you have your private keys, guarantee that it is compatible with future versions of Core, and also backup transactions and metadata (such as labels).</p>

CC BY-SA 4.0
2019-09-25T16:41:37.807Z
Thanks for your comprehensive answer! I added my output as an answer, also. I wonder if the extended private key should be sufficient to recover all child keys. I recognise that `xprv` leads to a specific way of generation. But as long as someone uses exactly this method it should be possible to generate all the keys, right? I am doing this to investigate, not to backup a real wallet. Although I think backing up something physically on a paper might be a good thing!
bomben
CC BY-SA 4.0
2019-09-25T22:05:30.893Z
Bitcoin Core doesn't allow imports of xprvs due to the internal structure not supporting it. So that is not a good way to backup your wallet. The main thing that will cause issues with restoring backups, especially with different wallet software, is the derivation paths. Bitcoin Core uses a derivation path that isn't used by any other software.
Ava Chow
CC BY-SA 4.0
2019-09-25T15:33:30.830Z
2019-09-25T15:33:30.830Z
Ava Chow
<p>Since I have a <code>wallet.dat</code> I suspect I already have a private key and so I could extract it for backup purpose (on paper). </p>

<p>How do I do it via terminal with <code>bitcoin-cli</code>?</p>

<bitcoin-core><wallet><paper-wallet>
I just compiled bitcoind and run for the first time. Do I already have a private key?
bomben
# I just compiled bitcoind and run for the first time. Do I already have a private key?

(Asked by: username_0 on 2019-09-25)

Since I have a `wallet.dat` I suspect I already have a private key and so I could extract it for backup purpose (on paper).

How do I do it via terminal with `bitcoin-cli`?

**Tags:** bitcoin-core, wallet, paper-wallet


---

## 2 answers

### Answer by username_2 on 2019-09-25. Score: 4 | Accepted answer

Bitcoin Core will automatically create a new wallet on first start. This wallet will contain 2000 private keys (unless otherwise specified by the `-keypool=<n>` option) and the seed used to generate those and future keys, at least until you encrypt the wallet.

As such, there is not just one private key that you need to backup, rather you need to backup 2000 keys and the seed. Otherwise, restoring a backup will not restore all of your private keys.

The easiest way to backup your wallet is to just copy the wallet.dat file to a safe place. I would not recommend that you try to create a paper backup of your wallet.

If you insist on a paper backup, then you should record the seed. The seed can only be gotten by using the `dumpwallet` RPC command and then finding the private key labeled `hdseed`. The seed is a private key and cannot be used in any other wallet software since they do not accept the seed as a private key. You will need to remember that it specifically is not just a normal private key and that it only works in Bitcoin Core. To restore the seed, you can use the `sethdseed` command in a new wallet.

I really don't recommend that you try to backup the seed. There are changes happening to the Bitcoin Core wallet soon that may make your seed backup unable to work. The recommended way of backing up is to copy the wallet.dat file, and to do so periodically. This will guarantee that you have your private keys, guarantee that it is compatible with future versions of Core, and also backup transactions and metadata (such as labels).

> **Comments:**
> **username_0**: Thanks for your comprehensive answer! I added my output as an answer, also. I wonder if the extended private key should be sufficient to recover all child keys. I recognise that `xprv` leads to a specific way of generation. But as long as someone uses exactly this method it should be possible to generate all the keys, right? I am doing this to investigate, not to backup a real wallet. Although I think backing up something physically on a paper might be a good thing!  
> **username_2**: Bitcoin Core doesn't allow imports of xprvs due to the internal structure not supporting it. So that is not a good way to backup your wallet. The main thing that will cause issues with restoring backups, especially with different wallet software, is the derivation paths. Bitcoin Core uses a derivation path that isn't used by any other software.  

---

### Answer by username_0 on 2019-09-25. Score: 0

Based upon the good answer by Andrew I want to discuss my output from `bitcoin-cli dumpwallet dump.txt` because I think this will be interesting for people who are at the same stage as me.

`cat dump.txt` shows:

```
# Wallet dump created by Bitcoin v0.18.99.0-12fd4bbd1
# * Created on 2019-09-25T16:04:01Z
# * Best block at time of backup was 409484 (000000000000000000bec614513591c2e5d96a488c2513396e7a723bbf7b1dcd),
#   mined on 2016-04-29T22:30:07Z

# extended private masterkey: xprv*****
...

```

In my understanding the `masterkey` is derived from the seed and is used as parent for all child keys. The prefix `xprv` relates to it beeing hierarchical.

Then there is a list of pairs of private keys with addresses (public keys) of two kinds, `reserve=1`and `script=1`. Also, there is one `hdseed=1` in the list of `reserve=1`. All the keys have creation dates with them and `hdseed=1` has the earliest time (with others).

```
K**************** 2019-09-04T14:04:25Z reserve=1 # addr=3********* hdkeypath=*****

```

`hdkeypath` is probably a description to get from the masterkey to this specific child key, aka the index. This way all childkeys could be recovered from a known masterkey.

The last part of the dump contains several lines like this

```
0014******* 0 script=1 # addr=3**************

```

I am still investigating what `0014` as a starting number means.

[This](https://en.bitcoin.it/wiki/List_of_address_prefixes) is a list of address prefixes.

---

The seed can also be encoded in easy to remember (and written) words with `bx hd-mnemonic < SEED`.

> **Comments:**
> **username_1**: The prefix 0014 is the bytes native P2WPKH scripts start with.  

---

