Bitcoinjs-lib: How to get unspent / balance / getReceivedBy[...] for HD Wallet

Created on 16 Jun 2017  路  4Comments  路  Source: bitcoinjs/bitcoinjs-lib

I've set up an HD Wallet as described in BIP32 and BIP44. On the same server I am also running a bitcoin core daemon (bitcoind).

At first, I thought I could use a JS wrapper for the Bitcoin HTTP JSON-RPC to query for balances, unspent output, and getReceivedByAddress for addresses created by my bitcoinjs-lib HD Wallet. I managed to get such a wrapper working. However, many of those API calls won't work since the addresses are not connected to the wallet in the bitcoind, and will not return meaningful results.

I'm trying to figure out if there is a native bitcionjs-lib way to make queries about transactions to addresses created by HDNode. If not, am I forced to use an outside API like blockchain.info to get these results?

Thanks,

how to / question / docs

All 4 comments

If not, am I forced to use an outside API like blockchain.info to get these results?

bitcoinjs-lib does not have a blockchain associated with it, nor does it interact with the bitcoin network in any [direct] way.

So yes, you will need an external source for your blockchain data.

Thanks. So just to confirm, there's no way to 'register' bitcoinjs-lib keys with a separate blockchain on the same server, so the bitcoin-cli on that server recognizes me as their owner?

there's no way to 'register' bitcoinjs-lib keys with a separate blockchain on the same server

You can use bitcoind's RPC command importprivkey, whether that meets your use case is up to you.
The keys generated by bitcoinjs-lib adhere to the standards set by the community (WIF, BIP32, etc)

Great. Thanks for your help. My issue is resolved.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

yakitorifoodie picture yakitorifoodie  路  3Comments

namnv04 picture namnv04  路  3Comments

askucher picture askucher  路  3Comments

Mr-Mondragon picture Mr-Mondragon  路  3Comments

coingeek picture coingeek  路  4Comments