QUESTIONS:
- Does it look reasonable?
- What about change addresses? I couldn't figure out how to deal with them. My app uses sendtoaddress at this time and I'm not planning on implementing raw transactions for a bit. I need to make sure that a deposit address is never used for sending change and also that after descriptors restoring on a new server, I properly get all change UTXOs available and visible in listunspent and whatnot. Should I also "pre-generate" change addresses?
- Is using "getnewaddress" the proper way to do it? Should I use something else, like "derivateaddresses" (but then "listreceivedbyaddress 0 true" doesn't display them)?
- Reasonable, yes.
- In your descriptors, those active descriptors with "internal: true" result are used for generating your change addresses.
Notice that each has "range" values, that indicates how many keys Bitcoin Core will check upon scanning for related transactions.
The default is 1000 from the last used key, so when importing the descriptor, you may increase the range based from the number of change address that you think you've used before.
- Considering the info above, you can set the range when importing the descriptors to: "range": [0,10000] or more so Bitcoin Core will scan 10,000 addresses per descriptor which will be included in listreceivedbyaddress command result. (after a rescan)
- Why oh why is there not an option to set a change address in "sendtoaddress"?
The experimental
send command has it but as stated in its help tooltip, it may change in the future releases.