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:
- what is exactly the meaning of
reserveandchange? My guess is thatreserveare normal reception addresses andchangeare, well, change, but I'm still wondering if there's some meaning more specific to Bitcoin Core. - 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? - Besides I wonder how to generate 2 different key pairs with the same master key and path, could I have generate the
changeaddress 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.