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);
    ?>
3
  • Is that the entire xpub? It seems too short. Also, I can't get it to validate. – Nick ODell Mar 15 '17 at 16:16
  • 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 ???? – Adeel Nawaz Mar 16 '17 at 7:17
  • 1
    I 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 Mar 16 '17 at 16:20
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.

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.