I am wondering if it's possible to create an HD address with bitcoind's getnewaddress RPC call? If not how does one create an HD address?
-
tgreco commented at 12:37 AM on July 4, 2019: none
-
promag commented at 12:42 AM on July 4, 2019: member
See the utility RPC
deriveaddresses. -
tgreco commented at 1:06 AM on July 4, 2019: none
Would you be able to provide an example of how to use that?
The example in the RPC docs is confusing.
bitcoin-cli deriveaddresses "wpkh([d34db33f/84h/0h/0h]xpub6DJ2dNUysrn5Vt36jH2KLBT2i1auw1tTSSomg8PhqNiUtx8QX2SvC9nrHu81fT41fvDUnhMjEzQgXnQjKEu3oaqMSzhSrHMxyyoEAmUHQbY/0/*)#trd0mf0l" "[0,2]"I was thinking the public key would be the scriptPubKey from the validateaddress command. But I have no idea what the first [d34db33f/84h/0h/0h] part is.
-
sipa commented at 1:11 AM on July 4, 2019: member
Maybe first explain what you're trying to do.
getnewaddress(Bitcoin Core wallets created after 0.13.0) always generates an HD address under the hood, but generally we don't reveal the derivation path that was used. - fanquake added the label Questions and Help on Jul 4, 2019
-
sipa commented at 1:12 AM on July 4, 2019: member
deriveaddressesdoesn't create a new address, it just computes one based on a descriptor (this for example does not make the wallet automatically treat transactions to the generated address as incoming payments). For more information on descriptors, see https://github.com/bitcoin/bitcoin/blob/master/doc/descriptors.md. -
tgreco commented at 1:44 AM on July 4, 2019: none
Maybe first explain what you're trying to do.
getnewaddress(Bitcoin Core wallets created after 0.13.0) always generates an HD address under the hood, but generally we don't reveal the derivation path that was used.I want to generate receiving addresses for my main address I obtained by using the
getnewaddressRPC call.What would be the steps to be able to plug this into
deriveaddressescommand? I am not sure how to obtain a descriptor for my main address. I have the private key. -
sipa commented at 1:47 AM on July 4, 2019: member
You're describing a means to accomplish a goal, but not what the goal is.
Generally if you want to construct a new receiving address for your wallet, you just use
getnewaddress, and don't worry about how the wallet came up with it.If you want something else, there may be a solution, but it won't be that simple generally. You can't derive more addresses from a given address.
-
tgreco commented at 1:51 AM on July 4, 2019: none
You're describing a means to accomplish a goal, but not what the goal is.
Generally if you want to construct a new receiving address for your wallet, you just use
getnewaddress, and don't worry about how the wallet came up with it.If you want something else, there may be a solution, but it won't be that simple generally. You can't derive more addresses from a given address.
The goal is to be able to differentiate deposits (using this for online bill pay on invoices). I would like to generate many addresses so I can track which client has paid their bill by assigning each one a unique address.
I know I could use
getnewaddressto do this but then I have to move funds to a main wallet at some point which adds mining fees for moving funds from one clients address to my main wallet address.However if everyone has just a receiving address and all the funds are actually spendable by the main wallet address I eliminate the mining fees required to move from each individual address to the main wallet.
-
sipa commented at 1:53 AM on July 4, 2019: member
What about just calling
getnewaddressonce for every client, but all on the same wallet? - sipa closed this on Jul 4, 2019
-
sipa commented at 2:00 AM on July 4, 2019: member
This isn't really the place for support questions. I'll happily continue answering on https://bitcoin.stackexchange.com
- DrahtBot locked this on Dec 16, 2021