0

We're creating a platform to buy/sell Bitcoin. We need to generate a new child address for each customer allowing them to receive Bitcoin. But all incoming Bitcoins should be stored in our main wallet actually.
These are what we have done up to now:

  1. Creating a new wallet using Blockchain.com API using /api/v2/create and receiving an address as 1551SHYQu8CPuRxJagViGkppNZrv2gkfFi
  2. Converting the wallet to HD using /merchant/:guid/enableHD
  3. Receiving the first sub-wallet (xPriv & xPub) if I am not wrong with a new public address 1CLpEvgs9o2mgKN5aS1mPeXGcqXs7fT75F
  4. Send BTC to the address generated in step 3.

We expected that the transaction happened on on the last address as a derived child from the first address should be stored and visible in the main wallet, but by using explorers, we found out that there is not any event on the main address, whereas the transaction on the second one is confirmed.
We may did something wrong, or we might have a misunderstanding about the correct behavior in this purpose.
Your assistant is much appreciated.

1 Answer 1

1

Addresses derived by an HD wallet are intentionally not publicly linkable to one-another (that would be obviously terrible for privacy). Your wallet software will know the addresses are related (ie, it derived them all from the same seed), but a casual observer will not.

Accordingly, when you pay some bitcoin to a child address, there is no associated activity involving the parent addresses.

How to generate sub addresses belonging to one private key in blockchain.com API

You cannot. Each address derived by an HD wallet will have a corresponding, unique private key related to it. The master private key for the wallet will not be able to sign and spend any funds stored at child addresses - you need the child private keys to do that.

3
  • Thank you @chytrik for the reply. I hope you know our needs based on the information I've provided in my question. Now, I am sure that we have a problem in our understanding about HD wallets. May you tell me please what is the usage of HD wallets if the generated addresses can not be associated with the main account? And what is the best solution regarding to our requirements in the project? Feb 4, 2020 at 15:57
  • HD wallets are useful in many ways, for example the ability to load an xpub key onto an insecure server in order to generate receiving addresses. Generally, if you're operating a business, each new user can be associated with a new address, helping differentiate payments. To spend those funds you just use the private key for each address, which is generated in parallel on a secure machine. I'd recommend reading through: github.com/bitcoin/bips/blob/master/bip-0032.mediawiki and github.com/bitcoinbook/bitcoinbook/blob/develop/ch05.asciidoc, at least
    – chytrik
    Feb 4, 2020 at 23:15
  • in this way, we can generate normal pub/priv keys too and we should store them somewhere like xpub/xpriv ones. Finally, we have to keep all key pairs and use them separately for transactions. Am I right? Feb 5, 2020 at 8:25

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.