May 10, 2021

Look up address balance for a wallet for Bitcoin on QuikNode

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!

NOTE: The address balance index only returns unspent transaction outputs from the last 5000 transactions for a given address. If the UTXOs are not in the most recent 5000, then they will not be returned.

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 to try QuickNode? Start your 7-day free trial

Related articles 1

Mar 20, 2021 How to setup WebHooks with QuikNode

In this article, we'll learn about WebHooks and how we can set-up WebHooks with QuikNode.What are WebHooks?Everything we do on the internet can be marked/considered as events and as the internet grows, these events grow in numbers. We...

Continue reading