Bitcoin Forum
June 28, 2024, 05:44:56 PM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: The best way to know if an address has balance?  (Read 179 times)
seoincorporation (OP)
Legendary
*
Offline Offline

Activity: 3206
Merit: 3004


Top Crypto Casino


View Profile
April 08, 2022, 08:12:22 PM
 #1

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.

█████████████████████████
████▐██▄█████████████████
████▐██████▄▄▄███████████
████▐████▄█████▄▄████████
████▐█████▀▀▀▀▀███▄██████
████▐███▀████████████████
████▐█████████▄█████▌████
████▐██▌█████▀██████▌████
████▐██████████▀████▌████
█████▀███▄█████▄███▀█████
███████▀█████████▀███████
██████████▀███▀██████████
█████████████████████████
.
BC.GAME
▄▄░░░▄▀▀▄████████
▄▄▄
██████████████
█████░░▄▄▄▄████████
▄▄▄▄▄▄▄▄▄██▄██████▄▄▄▄████
▄███▄█▄▄██████████▄████▄████
███████████████████████████▀███
▀████▄██▄██▄░░░░▄████████████
▀▀▀█████▄▄▄███████████▀██
███████████████████▀██
███████████████████▄██
▄███████████████████▄██
█████████████████████▀██
██████████████████████▄
.
..CASINO....SPORTS....RACING..
█░░░░░░█░░░░░░█
▀███▀░░▀███▀░░▀███▀
▀░▀░░░░▀░▀░░░░▀░▀
░░░░░░░░░░░░
▀██████████
░░░░░███░░░░
░░█░░░███▄█░░░
░░██▌░░███░▀░░██▌
░█░██░░███░░░█░██
░█▀▀▀█▌░███░░█▀▀▀█▌
▄█▄░░░██▄███▄█▄░░▄██▄
▄███▄
░░░░▀██▄▀


▄▄████▄▄
▄███▀▀███▄
██████████
▀███▄░▄██▀
▄▄████▄▄░▀█▀▄██▀▄▄████▄▄
▄███▀▀▀████▄▄██▀▄███▀▀███▄
███████▄▄▀▀████▄▄▀▀███████
▀███▄▄███▀░░░▀▀████▄▄▄███▀
▀▀████▀▀████████▀▀████▀▀
PrimeNumber7
Copper Member
Legendary
*
Offline Offline

Activity: 1624
Merit: 1899

Amazon Prime Member #7


View Profile
April 08, 2022, 09:44:26 PM
 #2

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.
PawGo
Legendary
*
Offline Offline

Activity: 952
Merit: 1369


View Profile
April 09, 2022, 10:01:02 AM
Merited by pooya87 (2), seoincorporation (1), webtricks (1)
 #3

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.
PrimeNumber7
Copper Member
Legendary
*
Offline Offline

Activity: 1624
Merit: 1899

Amazon Prime Member #7


View Profile
April 09, 2022, 06:38:54 PM
 #4

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.
Maus0728
Legendary
*
Offline Offline

Activity: 1960
Merit: 1578


Bitcoin Casino Est. 2013


View Profile
April 09, 2022, 11:50:40 PM
 #5

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

███▄▀██▄▄
░░▄████▄▀████ ▄▄▄
░░████▄▄▄▄░░█▀▀
███ ██████▄▄▀█▌
░▄░░███▀████
░▐█░░███░██▄▄
░░▄▀░████▄▄▄▀█
░█░▄███▀████ ▐█
▀▄▄███▀▄██▄
░░▄██▌░░██▀
░▐█▀████ ▀██
░░█▌██████ ▀▀██▄
░░▀███
▄▄██▀▄███
▄▄▄████▀▄████▄░░
▀▀█░░▄▄▄▄████░░
▐█▀▄▄█████████
████▀███░░▄░
▄▄██░███░░█▌░
█▀▄▄▄████░▀▄░░
█▌████▀███▄░█░
▄██▄▀███▄▄▀
▀██░░▐██▄░░
██▀████▀█▌░
▄██▀▀██████▐█░░
███▀░░
PrimeNumber7
Copper Member
Legendary
*
Offline Offline

Activity: 1624
Merit: 1899

Amazon Prime Member #7


View Profile
April 10, 2022, 06:20:25 PM
 #6

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.
seoincorporation (OP)
Legendary
*
Offline Offline

Activity: 3206
Merit: 3004


Top Crypto Casino


View Profile
April 10, 2022, 09:50:07 PM
 #7

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.

█████████████████████████
████▐██▄█████████████████
████▐██████▄▄▄███████████
████▐████▄█████▄▄████████
████▐█████▀▀▀▀▀███▄██████
████▐███▀████████████████
████▐█████████▄█████▌████
████▐██▌█████▀██████▌████
████▐██████████▀████▌████
█████▀███▄█████▄███▀█████
███████▀█████████▀███████
██████████▀███▀██████████
█████████████████████████
.
BC.GAME
▄▄░░░▄▀▀▄████████
▄▄▄
██████████████
█████░░▄▄▄▄████████
▄▄▄▄▄▄▄▄▄██▄██████▄▄▄▄████
▄███▄█▄▄██████████▄████▄████
███████████████████████████▀███
▀████▄██▄██▄░░░░▄████████████
▀▀▀█████▄▄▄███████████▀██
███████████████████▀██
███████████████████▄██
▄███████████████████▄██
█████████████████████▀██
██████████████████████▄
.
..CASINO....SPORTS....RACING..
█░░░░░░█░░░░░░█
▀███▀░░▀███▀░░▀███▀
▀░▀░░░░▀░▀░░░░▀░▀
░░░░░░░░░░░░
▀██████████
░░░░░███░░░░
░░█░░░███▄█░░░
░░██▌░░███░▀░░██▌
░█░██░░███░░░█░██
░█▀▀▀█▌░███░░█▀▀▀█▌
▄█▄░░░██▄███▄█▄░░▄██▄
▄███▄
░░░░▀██▄▀


▄▄████▄▄
▄███▀▀███▄
██████████
▀███▄░▄██▀
▄▄████▄▄░▀█▀▄██▀▄▄████▄▄
▄███▀▀▀████▄▄██▀▄███▀▀███▄
███████▄▄▀▀████▄▄▀▀███████
▀███▄▄███▀░░░▀▀████▄▄▄███▀
▀▀████▀▀████████▀▀████▀▀
PawGo
Legendary
*
Offline Offline

Activity: 952
Merit: 1369


View Profile
April 11, 2022, 07:42:59 AM
Merited by ABCbits (2)
 #8

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?
alexeyneu
Member
**
Offline Offline

Activity: 346
Merit: 32


View Profile
April 11, 2022, 11:31:02 AM
 #9

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
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!