1

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());
}
5

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.

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

  • The process I'm after is described in BIP32 in the section about generating public child keys from public parent keys. Then here is an example 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 Apr 5 '18 at 16:16
  • 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 Apr 5 '18 at 16:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.