3

What is the best way to get balance of large amount of addresses? I tried to use APIs from different providers, but they are limiting the requests. Is there any APIs that give premium service without limiting requests?

Or maybe should I run full node, and use it? If yes, how I'm using the full node to get the addresses balances? I'm using Ruby on Rails.

Thanks.

bl0ck3d
  • 81
  • 1
  • 5

2 Answers2

4

I think your should consider that using an API could result in fakes, wrongly-validated data. Using an API means you fully trust the API service,... which is kind-of against bitcoin no-trust model.

I recommend you to run a full node (Bitcoin Core 0.13.2 during time of writing).

There is no address-index (there is a patch you can manually compile into Core).

Simplest way with standard Bitcoin-Core 0.13.2 is to import all your addresses as watch-only into a wallet.

import addresses

Use the RPC call importaddress <address> "" false to import a watch only address.

The 3rd argument false is required to not rescan the blockchain for each import (can take serval hours).

Once you have imported all addresses, stop bitcoind/qt and restart it with the startup argument -rescan.

The rescan may take a couple of minutes/hours (depending on your Disk/RAM/CPU). Once done, you can call getreceivedbyaddress <addr> for each address to get the balance.

This result in authentic, self-validated data.

Note: If you are using Bitcoin Core 0.14, consider importing multiple addresses with importmulti

Jonas Schnelli
  • 6,052
  • 1
  • 21
  • 34
  • Hi, thanks for your answer, but this method is not very effective if the addresses list change every run, because each run I need to go through this process that can take some time. If I'm running full node, I should have access to all data on the blockchain, no? No convenient way to access this data? – bl0ck3d Jan 18 '17 at 11:10
  • Then you need an address index. Either look at the existing Core patches (There is a pull request for Bitcoin Core) or try to use existing alternatives (Bitpays Insight [based on Bitcoin Core]) – Jonas Schnelli Jan 19 '17 at 17:18
  • Thanks! I tried to search for solution for my question, but I didn't find any. I think this solution should be added to Bitcoin Core official documentation/wiki. – bl0ck3d Jan 21 '17 at 01:01
-2

Have you tried blockonomics api . Their free plans allow 50 addresses at once and paid one upto 8000

If you want to run your own node. I would recommend running abe blockexplorer along with your node. Core wallet and other SPV wallets like electrum have known to become sluggish with large number of addresses

dark knight
  • 2,017
  • 9
  • 25