0
I'm using this code to get a new address from an extended public key:
$index = 97;
$change = false;
$key = HierarchicalKeyFactory::fromExtended($tpubaddress, NetworkFactory::bitcoinTestnet());
$path = ($change ? '1' : '0').'/'.$index;
$child_key = $key->derivePath($path);
$address = new PayToPubKeyHashAddress($child_key->getPublicKey()->getPubKeyHash()))->getAddress();
echo $address;
This is resulting an an address like
15fuesDBKKnEMnrZz3mT9fxbm7dkjwDN3z
which is a mainnet P2PKH address.
Is there a way I can get it to give me a testnet P2PKH address (e.g. mjKxMDjShxKS5LymC43EmctDoB5Sg3n6UZ)?
This is breaking my attempt to create a raw transaction with the address b/c it's from the wrong network. If not, should I report this as an issue on their github project?