Look up address balance for a wallet for Bitcoin on QuikNode

Auston Bunsen
December 16, 2020

Overview

If you're running your own bitcoin node (such as bitcoind or bcoin) there is a chance you will want the ability to look up the balance of an address that you do not own. The first time this happens, you might create a watch-only wallet and add the address in question. This works, but then you need to add another one, if you've built a wallet and you're running a (non-spv) light client then this strategy won't scale - your bitcoin node will run out of memory. 

That's why we've made an add-on available for customers who wish to access the bitcoin network, a simple address balance index. It allows you to supply a bitcoin address (such as 1LPE9YTzDBQF5vZNnKcTJejstfsS8Z6icx) and retrieve its current balance!

Let's take a quick look at how you can use this RPC method:

Example call

It's relatively simple: 
 curl -H "Content-type:application/json" \
     -d '{"id": 1, "method": "qn_addressBalance", "params": ["1LPE9YTzDBQF5vZNnKcTJejstfsS8Z6icx"]}' \
     https://your-node-name.bcoin.quiknode.pro/long-id-here/

That's it. Just specify your address and use the `qn_addressBalance` method. This call also supports batching like other RPC calls.

How to purchase

When creating your BTC endpoint on QuikNode API, be sure to select the "Address Balance Index" add-on to enable this feature.

Thanks

Also, we want to thank the entire bcoin team and Matthew Zipkin specifically for making awesome software and guiding our team in supporting bcoin for the QuikNode pro network!

Ready? Try QuikNode free for 7 days --> Sign Up Now
Auston Bunsen
Auston is a software engineer and the cofounder of QuikNode. He's passionate about the power of Web3 and curious to see what people build on top of QuikNode.

Related articles

All set for your QuikNode?