Author

Topic: The best way to know if an address has balance? (Read 205 times)

member
Activity: 351
Merit: 37
Using an API endpoint is going to be expensive if you are doing this at any kind of scale. It will also likely be less efficient than a self-hosted setup due to network latency + authentication.

no. $35 / month , close to unlimited. quicknode provider with lib installed
legendary
Activity: 952
Merit: 1385
You all recommend the APIs, but as you already mentioned they have some limits, if we want to make unlimited requests we have to pay them. But I'm looking for a free way to do it. I main, bitcoin is open source, and paying for their services is kind of non-sense for me.

You pay someone who prepared API, who host server, pays electricity etc. It has nothing to do with fact if software they use is paid or not. Take an example: https://nextcloud.com It is for free, you may use it to host your files, contacts, calendars etc. But if you want someone to host it for you, you must pay.
Maybe just find 500GB on disk and keep the full blockchain locally. Or import founded/historical addresses to the local database.

Could you tell us more what is you use case? Manual check or from application?
legendary
Activity: 3346
Merit: 3125
You all recommend the APIs, but as you already mentioned they have some limits, if we want to make unlimited requests we have to pay them. But I'm looking for a free way to do it. I main, bitcoin is open source, and paying for their services is kind of non-sense for me.
copper member
Activity: 1652
Merit: 1901
Amazon Prime Member #7
Using an API endpoint is going to be expensive if you are doing this at any kind of scale. It will also likely be less efficient than a self-hosted setup due to network latency + authentication.

+1, especially if the API has its limitations.

If you are pertaining to knowing if AN address (which means only one) then using a simple API would suffice. I only know blockchair's API[1] and it is free if you would only work for 1440 requests per day and you would just use it for your personal or a mini project. And as you know, getting requests and queueing tons of queries to the blockchain requires equipment and money, hence I think there would be no free unless you invest on your own data-processing computers.

[1] - https://blockchair.com/api/docs#link_M05
Blockchair, and other blockchain explorers who offer API services are going to want to recoup their investments in setting up their database and offering their services. There is also fairly little competition but a decent amount of demand for blockchain related APIs.

There would obviously still be a cost if you were to set up a system yourself that can query if an address has a balance (or any other information about the blockchain). You would need the technical expertise and the cost of (usually) renting the computer infrastructure. If you are creating your own system, you can limit the costs by limiting the amount of information that can be queried to the amount of information you need.
legendary
Activity: 1904
Merit: 1563
Using an API endpoint is going to be expensive if you are doing this at any kind of scale. It will also likely be less efficient than a self-hosted setup due to network latency + authentication.

+1, especially if the API has its limitations.

If you are pertaining to knowing if AN address (which means only one) then using a simple API would suffice. I only know blockchair's API[1] and it is free if you would only work for 1440 requests per day and you would just use it for your personal or a mini project. And as you know, getting requests and queueing tons of queries to the blockchain requires equipment and money, hence I think there would be no free unless you invest on your own data-processing computers.

[1] - https://blockchair.com/api/docs#link_M05
copper member
Activity: 1652
Merit: 1901
Amazon Prime Member #7
Using an API endpoint is going to be expensive if you are doing this at any kind of scale. It will also likely be less efficient than a self-hosted setup due to network latency + authentication.
legendary
Activity: 952
Merit: 1385
There is another blockchain endpoint:
Code:
https://blockchain.info/balance?active=
You may use severally addresses, comma separated.

There are probably other services, free or paid, because if you want to check many addresses you will quickly exhaust free limit.

Locally you may launch your own node + maybe electrum server + rpc browser, so you may have “local copy” of blockchain.com functionalities.
Or you may download daily lists / dumps from blockchair or Loyce’s server and load them into local database (mysql, posgresql) for fast search.

All depends on your needs - how often you want to use it, how many addresses you want to check etc.
copper member
Activity: 1652
Merit: 1901
Amazon Prime Member #7
The most efficient way would be to create a set of addresses that have unspent outputs and compare the addressing you are querying to the items in your set.

I don't think importing an address as "watch only" is very efficient because I understand doing this will require a rescan to check for transactions associated with this address.
legendary
Activity: 3346
Merit: 3125
I have seen in the past list of all the addresses ever use and all the addresses with balance. And I'm I would like to know what's the best way to make a list like that.

I know we can use the bitcoin core to get that information if we import the address as 'watch only', but another way is to use some site API's to make calls on the blockchain and verify the balance.

But I would like to know what's the best way, and if someone can share a code for it that would be great.

I know we can use:
Code:
curl https://blockchain.info/rawaddr/$bitcoin_address
and then cut for "final_balance", but I would like to know if there are better ways.
Jump to: