<p>There are php libraries that you can use. For example the ones in my plugin <a href="https://wordpress.org/plugins/bitcoin-address/" rel="nofollow noreferrer">bitcoin address</a> in the includes/libs directory. These libraries were originally created by the authors of the bitcoin payments for woocommerce plugin.</p>

<p>There is also the <a href="https://github.com/Bit-Wasp/bitcoin-php" rel="nofollow noreferrer">bitwasp php library</a> but it is a lot larger and does more things than merely deriving addresses from xpubs.</p>

CC BY-SA 3.0
2017-03-16T07:18:04.883Z
2017-03-16T07:18:04.883Z
Abdussamad
<p>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 </p>

<pre><code>&lt;?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"];
    ?&gt;

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

    Print_r($fgc);
    ?&gt;
</code></pre>

CC BY-SA 3.0
2017-03-15T16:16:37.517Z
Is that the *entire* xpub? It seems too short. Also, I can't get it to validate.
Nick ODell
CC BY-SA 3.0
2017-03-16T07:17:32.780Z
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
CC BY-SA 3.0
2017-03-16T16:20:11.837Z
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
<bitcoind><bitcoin-core><electrum>
How to get new address on bitcoin core through extended public key
Adeel Nawaz
# How to get new address on bitcoin core through extended public key

(Asked by: username_0 on 2017-03-15)

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);
    ?>

```

**Tags:** bitcoind, bitcoin-core, electrum

> **Comments:**
> **username_1**: Is that the *entire* xpub? It seems too short. Also, I can't get it to validate.  
> **username_0**: 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 ????  
> **username_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.  

---

## 1 answers

### Answer by username_2 on 2017-03-16. Score: 1

There are php libraries that you can use. For example the ones in my plugin [bitcoin address](https://wordpress.org/plugins/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](https://github.com/Bit-Wasp/bitcoin-php) but it is a lot larger and does more things than merely deriving addresses from xpubs.


---

