## how to get change address using derived BIP44 publicKey?

0

I have generated a private key using my master seed private key.

PHP Code:

 $bip44 = HierarchicalKeyFactory::fromExtended($result['masterPrivKey']);

$publicKey =$bip44->derivePath("m/44'/0'/0'")->toExtendedPublicKey();


Now using the public key

    $masterkey = HierarchicalKeyFactory::fromExtended($publicKey);

$result['address'] =$masterkey->derivePath("m/0/1")->getPublicKey()->getAddress()->getAddress();


Should I just change 0 in the middle m/0/1 to 1 to get change address?

1

I guess I've found the answer as explained in bip43

m / purpose' / * Apostrophe indicates that BIP32 hardened derivation is used.

We encourage different schemes to apply for assigning a separate BIP number and use the same number for purpose field, so addresses won't be generated from overlapping BIP32 spaces.

Example: Scheme described in BIP44 should use 44' (or 0x8000002C) as purpose.

Note that m / 0' / * is already taken by BIP32 (default account), which preceded this BIP.

Not all wallets may want to support the full range of features and possibilities described in these BIPs. Instead of choosing arbitrary subset of defined features and calling themselves BIPxx compatible, we suggest that software which needs only a limited structure should describe such structure in another BIP and use different "purpose" value.