<p><strong>How to watch the addresses generated using xpub for incoming transactions? and Create transactions to send bitcoin to another address.</strong></p>

<pre><code>var bitcore = require('bitcore-lib');
var Address = bitcore.Address;
var PublicKey = bitcore.PublicKey;
var Networks = bitcore.Networks;

var xpub = 'tpubDFaw2mL2nZuxk9WeCTr5Y74xytQLqtxSet3FYigfTMX788gjZmd4juFYeLDchGMaXmjGeoy6FrULbZd9D8iogcPZyBeYfT5MAyqnaL8bMQb';
var hdPublickey = new bitcore.HDPublicKey(xpub);
var orderPublickey = hdPublickey.derive("m/44/0/4/0/0");
var pubkey = new PublicKey(orderPublickey.publicKey);
var address = Address.fromPublicKey(pubkey, Networks.mainnet);

console.log(address.toString());
</code></pre>

CC BY-SA 4.0
2019-11-20T07:29:30.760Z
What software are you using?
Pieter Wuille
CC BY-SA 4.0
2019-11-20T07:31:21.377Z
I using bitpay to get the xpub and doing programming in nodejs
Ishwar Chandra Tiwari
CC BY-SA 4.0
2019-11-20T07:35:19.547Z
my requirement is how to watch this newly generated address for incoming transactions  and transfer the bitcoin from this address to another address if funds come
Ishwar Chandra Tiwari
CC BY-SA 4.0
2019-11-30T14:19:46.663Z
If you're into nodejs you should check out bcoin. It's a library, full node, and wallet. You can create a watch-only wallet and import an xpub. https://bcoin.io
pinhead
<bitcore>
How to watch and use addresses generated from xpub
Ishwar Chandra Tiwari
# How to watch and use addresses generated from xpub

(Asked by: username_0 on 2019-11-20)

How to watch the addresses generated using xpub for incoming transactions? and Create transactions to send bitcoin to another address.
var bitcore = require('bitcore-lib');
var Address = bitcore.Address;
var PublicKey = bitcore.PublicKey;
var Networks = bitcore.Networks;

var xpub = 'tpubDFaw2mL2nZuxk9WeCTr5Y74xytQLqtxSet3FYigfTMX788gjZmd4juFYeLDchGMaXmjGeoy6FrULbZd9D8iogcPZyBeYfT5MAyqnaL8bMQb';
var hdPublickey = new bitcore.HDPublicKey(xpub);
var orderPublickey = hdPublickey.derive("m/44/0/4/0/0");
var pubkey = new PublicKey(orderPublickey.publicKey);
var address = Address.fromPublicKey(pubkey, Networks.mainnet);

console.log(address.toString());

**Tags:** bitcore

> **Comments:**
> **username_1**: What software are you using?  
> **username_0**: I using bitpay to get the xpub and doing programming in nodejs  
> **username_0**: my requirement is how to watch this newly generated address for incoming transactions  and transfer the bitcoin from this address to another address if funds come  
> **username_2**: If you're into nodejs you should check out bcoin. It's a library, full node, and wallet. You can create a watch-only wallet and import an xpub. https://bcoin.io  

---

## 0 answers

