How to generate multiple payment addresses from a single secret key
I see that electrum wallet generates different payment addresses for receiving BTC. I'm trying to generate new addresses, but they are the same. Is it possible to make them different?
private function generateAddress()
{
$pubKeyHash160 = $this->_privateKey->getPublicKey()->getPubKeyHash();
$pubKeyHashAddr = new PayToPubKeyHashAddress($pubKeyHash160);
$this->_address = $pubKeyHashAddr->getAddress();
}
I've found that electrum generates multiple secret keys -> public keys -> addresses from a single seed phrase. But I don't understand how to restore all the secret keys from it. Any thoughts?
What do you mean the addresses are the same? The address in your code returns the same value every time, or you're trying to change the address type?
Recent & possibly related to this issue: https://github.com/Bit-Wasp/bitcoin-php/issues/792 https://github.com/Bit-Wasp/bitcoin-php/issues/794