Post
Topic
Board Hardware wallets
Merits 15 from 4 users
Re: REWARD $50: Funds not visible after using XPub to receive money in my store
by
witcher_sense
on 07/07/2022, 06:19:05 UTC
⭐ Merited by vapourminer (6) ,LoyceV (4) ,o_e_l_e_o (4) ,Pmalek (1)
BIP44 derivation path has five levels:

m / purpose' / coin_type' / account' / change / address_index

In your case the derivation path is the following:

m / 44' / 0' / 0' / $client_id.' / 0

But it should be this:

m / 44' / 0' / $client_id.' / 0' / 0 for receive addresses

m / 44' / 0' / $client_id.' / 1' / 0 for change addresses

The code you have presented in the OP is not suitable for changing an "account" part of the BIP44 derivation path, it only generates receive and change addresses (albeit with non-standard derivation paths) for one account.

Try changing it to something like this, but I am not sure it will work out:

Code:
require_once('./HD.php');

$xpub = 'xpub......';
$path = $client_id.'/0'/0';
$hd = new HD();
$hd->set_xpub($xpub);
$address = $hd->address_from_master_pub($path);