How to get new address on bitcoin core through extended public key

0

i am going to lunch a new service for merchants to use my service API to receive payments directly in their wallets through xpub key , now i have installed bitcoin core is this possible with bitcoin core or i need as well electrum server

<?php
    //replace with your BIP32 extended public key
    $xpub = "xpub661MyMwAqRbcGTFHLp4c7j2hByE3qAZdN37FqJHTAmSPE2vfL4GAQ4mZvGZz4bVzpfdwoeoEBXWV5g2vWwP";
    $url = "https://api.smartbit.com.au/v1/blockchain/address/".$xpub;
    $fgc = json_decode(file_get_contents($url), true);
    $next = $fgc["address"]["extkey_next_receiving_address"];
    ?>

    <!DOCTYPE html>
    <html>
    <head>
    <script type="text/javascript" src="js/jquery.min.js"></script>
    <script type="text/javascript" src="js/qrcode.js"></script>
    </head>
    <body>
    <center><br>
    <div id="qrcode"></div>
      <script type="text/javascript">
      new QRCode(document.getElementById("qrcode"), "<?php echo $next; ?>");
      </script>
    <br><?php echo $next;?><br>
    </center>
    </body>
    </html>
    <?php

    Print_r($fgc);
    ?>

Terry Higgins

Posted 2017-03-15T14:33:45.313

Reputation: 1

Is that the entire xpub? It seems too short. Also, I can't get it to validate.Nick ODell 2017-03-15T16:16:37.517

so here you are not for answer you only want to test xpub ? , i asked how to do this on bitcoin core without any api , so what ????Terry Higgins 2017-03-16T07:17:32.780

1I think the reason that you're having trouble is that the xpub isn't valid. That means that you'll have trouble no matter what library you use.Nick ODell 2017-03-16T16:20:11.837

Answers

1

There are php libraries that you can use. For example the ones in my plugin bitcoin address in the includes/libs directory. These libraries were originally created by the authors of the bitcoin payments for woocommerce plugin.

There is also the bitwasp php library but it is a lot larger and does more things than merely deriving addresses from xpubs.

Abdussamad

Posted 2017-03-15T14:33:45.313

Reputation: 1 850