June 09, 2021

Look up address balance for a wallet for Bitcoin on QuickNode

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

Related articles 5

Jun 9, 2021 How to setup WebHooks with QuickNode

In this article, we'll learn about WebHooks and how we can set-up WebHooks with QuickNode.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
Oct 18, 2021 Intro to EtherFlow

Sending RPC calls to get data is a common standard most blockchains follow. EtherFlow is a tool that makes it easier to send these RPC calls. This guide will explain in depth about EtherFlow, and how it...

Continue reading
Aug 24, 2021 How to setup referrer whitelist with QuickNode

Security is one of the most significant aspects when developing an application. If a resource like a node falls into the hands of an unauthorized individual, it can exhaust your limits and resources. In this guide, we will see how to avoid this and learn how to set up a...

Continue reading
Jun 21, 2021 How to set a custom provider in MetaMask

MetaMask is one of the essential tools for web3 development. It comes set up with Ethereum blockchain networks out of the box. But there can be some specific use cases where you might want to add a custom provider to MetaMask for faster transaction processing or to...

Continue reading
Oct 7, 2021 Look up all NFTs for a given address on an EVM based chain

If you're running your own EVM based chain, such as Ethereum, Polygon, xDAI, BSC, Fantom or Celo there is chance you will want the ability to look up all of the NFTs owned by an address on those chains. The first time this happens, you might create a small script to check...

Continue reading