1

I'm using libwally to derive addresses from an extended private key. I shared the seed with Bitcoin Core (loaded it in a blank wallet with sethdseed), and noticed that there are 2 addresses in the dump of the wallet file under the same derivation path, one is labeled reserve=1 and is the same that I derive with libwally, the other is labeled change=1 and is different.

I have a few questions about this:

  1. what is exactly the meaning of reserve and change? My guess is that reserve are normal reception addresses and change are, well, change, but I'm still wondering if there's some meaning more specific to Bitcoin Core.
  2. I thought that change addresses were derived with a different path, like the reception addresses all end with ../0/{index} and change with ../1/{index}, or is Bitcoin Core doing things differently of say Electrum?
  3. Besides I wonder how to generate 2 different key pairs with the same master key and path, could I have generate the change address with libwally too?

[EDIT] After doing it one more time I only have one address with the same path in the dump file of Bitcoin Core, so I guess I made a mistake last time, I'll explain it here in case it helps: To create a wallet with a seed you choose yourself you need 2 commands, createwallet and sethdseed. Besides the required wallet_name, createwallet also takes an optional blank argument. By default it is false, and the command will use a random seed to generate a key pool. But since we want to use our own seed, we need to set it to true. If you dump the newly created wallet, it will be blank, no master key, no key pool, nothing. Then only you can sethdseed with a 32B seed encoded in wif format. I was having 2 keys under the same derivation path because I first created a wallet with a random seed, and then added my own with sethdseed, so I was having 2 key pools in my dump file. As Andrew said in the answer, it is impossible to have 2 different key pairs with the same master key and path.

2
  1. what is exactly the meaning of reserve and change? My guess is that reserve are normal reception addresses and change are, well, change, but I'm still wondering if there's some meaning more specific to Bitcoin Core.

reserve means that the key is in the keypool and has not been used yet. This is used for both change and receiving addresses as there are keypools for both.

change means that the key is used for change addresses.

  1. I thought that change addresses were derived with a different path, like the reception addresses all end with ../0/{index} and change with ../1/{index}, or is Bitcoin Core doing things differently of say Electrum?

They are. Bitcoin Core uses m/0'/0'/i' for receiving addresses and m/0'/1'/i' for change. However if you have an older Bitcoin Core wallet, this split doesn't exist and there's only one keypool. But if you are using sethdseed, that shouldn't effect you.

  1. Besides I wonder how to generate 2 different key pairs with the same master key and path, could I have generate the change address with libwally too?

There aren't 2 different key pairs with the same master key and path. Bitcoin Core doesn't do this, and that is not possible with BIP 32 (or any BIP).

| improve this answer | |
  • Thanks for the answer, I made a test again and this time I indeed only have one address with the same path in BC wallet, I think I messed up last time and didn't add the blank option to createwallet. I was thinking it was indeed impossible to have 2 key pairs with the same master key and path, so I'm relieved my wallet didn't break the laws of mathematics :) – Sosthène Jul 15 at 8:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.