<p>Bob can provide Alice with an extended public key (xpub). This will allow Alice to generate as many addresses as required, all of which will be accessible to Bob via the corresponding extended private key (xpriv), which only he has access to.</p>

<p>There are many tools and libraries around that support address derivation from xpubs, such as <a href="https://github.com/bitcoinjs/bitcoinjs-lib" rel="noreferrer">BitcoinJS-lib</a>.</p>

<p>As far as I know, blockchain.info is the only explorer with xpub support, and that also only applies to p2pkh addresses. Here's an example: <a href="https://blockchain.info/xpub/xpub6CUGRUonZSQ4TWtTMmzXdrXDtypWKiKrhko4egpiMZbpiaQL2jkwSB1icqYh2cfDfVxdx4df189oLKnC5fSwqPfgyP3hooxujYzAu3fDVmz" rel="noreferrer">https://blockchain.info/xpub/xpub6CUGRUonZSQ4TWtTMmzXdrXDtypWKiKrhko4egpiMZbpiaQL2jkwSB1icqYh2cfDfVxdx4df189oLKnC5fSwqPfgyP3hooxujYzAu3fDVmz</a></p>

CC BY-SA 3.0
2018-04-05T16:16:17.860Z
The process I'm after is described in BIP32 in the [section about generating public child keys from public parent keys](https://github.com/bitcoin/bips/blob/master/bip-0032.mediawiki#Public_parent_key_rarr_public_child_key). Then here is an [example](https://freedomnode.com/blog/58/generate-bitcoin-wallet-addresses-from-extended-public-key-with-php) use that can be used anonymously. You're correct there are many implementations, but do you have any idea whether or not the bitcoin core json rpc server supports this? Thanks.
toddmo
CC BY-SA 3.0
2018-04-05T16:29:02.240Z
Bitcoin Core supports BIP32 derivations, but has no concept of xpubs. You'll have to look elsewhere. Bitcoinjs-lib is a good place to start
Raghav Sood
CC BY-SA 3.0
2018-04-05T02:07:51.813Z
2018-04-05T02:07:51.813Z
Raghav Sood
<p>I thought I saw this feature existed somewhere but I can't find the reference.</p>

<p>Use Case: Alice needs to keep sending multiple bitcoin transactions to Bob, and wants to use a different payment address each time, but neither Alice nor Bob wants to trouble Bob with having to send over a new address for Alice to use. Neither Alice nor Bob want Alice to have Bob's private key.</p>

<p>Any service that sends bitcoins in multiple transactions to a client could make use of this feature. Current services that I've seen, like mining, just reuse the same address over and over, which is not recommended.</p>

<p>What is this feature called?</p>

<p>What bitcoin api (if any) facilitates it, or how would I get started using this api feature?</p>

<p><strong>EDIT</strong></p>

<p>With help from the answer, I was able to do this by adding bitwasp/bitcoin to my php project and this code:</p>



<pre><code>//bitwasp/bitcoin library
require_once(__DIR__.'\..\../vendor/autoload.php');
//use BitWasp\Bitcoin\Bitcoin;
use BitWasp\Bitcoin\Key\Deterministic\HierarchicalKeyFactory;
use BitWasp\Bitcoin\Key\Deterministic\HierarchicalKeySequence;
use BitWasp\Bitcoin\Key\Deterministic\MultisigHD;
use BitWasp\Bitcoin\Network\NetworkFactory;
use BitWasp\Bitcoin\Address\PayToPubKeyHashAddress;

//$xpub = 'xpub661MyMwAqRbcGYcu6n1FmV1TbE8EwnSKecRZLvKAMyj4qLf15qXsoNryiKNvCkRq3z5kBCeZG8115jj28eVqmeKBJZPqjAfwRD3TGx1w5hY';
//$xpub = 'xpub6CUGRUonZSQ4TWtTMmzXdrXDtypWKiKrhko4egpiMZbpiaQL2jkwSB1icqYh2cfDfVxdx4df189oLKnC5fSwqPfgyP3hooxujYzAu3fDVmz';
//$path = '0/0'; // 1st receiving address
// $path = '0/2'; // 3rd receiving address
// $path = '1/0'; // 1st change address
// $path = '1/1'; // 2nd change address
public static function NewReceivingAddress($xpub, $index, $change = false){
    $key = HierarchicalKeyFactory::fromExtended($xpub, NetworkFactory::bitcoin());
    $path = ($change ? '1' : '0').'/'.$index;
    $child_key = $key-&gt;derivePath($path);
    return new Result('data',(new PayToPubKeyHashAddress($child_key-&gt;getPublicKey()-&gt;getPubKeyHash()))-&gt;getAddress());
}
</code></pre>

<address><address-generation><php><address-reuse>
Is there a way to generate new addresses for someone else's wallet?
toddmo
# Is there a way to generate new addresses for someone else's wallet?

(Asked by: username_0 on 2018-04-05)

I thought I saw this feature existed somewhere but I can't find the reference.
Use Case: Alice needs to keep sending multiple bitcoin transactions to Bob, and wants to use a different payment address each time, but neither Alice nor Bob wants to trouble Bob with having to send over a new address for Alice to use. Neither Alice nor Bob want Alice to have Bob's private key.
Any service that sends bitcoins in multiple transactions to a client could make use of this feature. Current services that I've seen, like mining, just reuse the same address over and over, which is not recommended.
What is this feature called?
What bitcoin api (if any) facilitates it, or how would I get started using this api feature?
EDIT
With help from the answer, I was able to do this by adding bitwasp/bitcoin to my php project and this code:
//bitwasp/bitcoin library
require_once(__DIR__.'\..\../vendor/autoload.php');
//use BitWasp\Bitcoin\Bitcoin;
use BitWasp\Bitcoin\Key\Deterministic\HierarchicalKeyFactory;
use BitWasp\Bitcoin\Key\Deterministic\HierarchicalKeySequence;
use BitWasp\Bitcoin\Key\Deterministic\MultisigHD;
use BitWasp\Bitcoin\Network\NetworkFactory;
use BitWasp\Bitcoin\Address\PayToPubKeyHashAddress;

//$xpub = 'xpub661MyMwAqRbcGYcu6n1FmV1TbE8EwnSKecRZLvKAMyj4qLf15qXsoNryiKNvCkRq3z5kBCeZG8115jj28eVqmeKBJZPqjAfwRD3TGx1w5hY';
//$xpub = 'xpub6CUGRUonZSQ4TWtTMmzXdrXDtypWKiKrhko4egpiMZbpiaQL2jkwSB1icqYh2cfDfVxdx4df189oLKnC5fSwqPfgyP3hooxujYzAu3fDVmz';
//$path = '0/0'; // 1st receiving address
// $path = '0/2'; // 3rd receiving address
// $path = '1/0'; // 1st change address
// $path = '1/1'; // 2nd change address
public static function NewReceivingAddress($xpub, $index, $change = false){
    $key = HierarchicalKeyFactory::fromExtended($xpub, NetworkFactory::bitcoin());
    $path = ($change ? '1' : '0').'/'.$index;
    $child_key = $key->derivePath($path);
    return new Result('data',(new PayToPubKeyHashAddress($child_key->getPublicKey()->getPubKeyHash()))->getAddress());
}

**Tags:** address, address-generation, php, address-reuse


---

## 1 answers

### Answer by username_1 on 2018-04-05. Score: 5 | Accepted answer

Bob can provide Alice with an extended public key (xpub). This will allow Alice to generate as many addresses as required, all of which will be accessible to Bob via the corresponding extended private key (xpriv), which only he has access to.

There are many tools and libraries around that support address derivation from xpubs, such as [BitcoinJS-lib](https://github.com/bitcoinjs/bitcoinjs-lib).

As far as I know, blockchain.info is the only explorer with xpub support, and that also only applies to p2pkh addresses. Here's an example: <https://blockchain.info/xpub/xpub6CUGRUonZSQ4TWtTMmzXdrXDtypWKiKrhko4egpiMZbpiaQL2jkwSB1icqYh2cfDfVxdx4df189oLKnC5fSwqPfgyP3hooxujYzAu3fDVmz>

> **Comments:**
> **username_0**: The process I'm after is described in BIP32 in the [section about generating public child keys from public parent keys](https://github.com/bitcoin/bips/blob/master/bip-0032.mediawiki#Public_parent_key_rarr_public_child_key). Then here is an [example](https://freedomnode.com/blog/58/generate-bitcoin-wallet-addresses-from-extended-public-key-with-php) use that can be used anonymously. You're correct there are many implementations, but do you have any idea whether or not the bitcoin core json rpc server supports this? Thanks.  
> **username_1**: Bitcoin Core supports BIP32 derivations, but has no concept of xpubs. You'll have to look elsewhere. Bitcoinjs-lib is a good place to start  

---

