-1

Currently I'm using blockchain.info to get the balance of an address like this: https://blockchain.info/de/q/addressbalance/1Mj94YLoFudaD4MvfxoUx7nAur5kTeRVFR

It outputs the bitcoin balance.

Due to blockchain.info having a rate limit, I have to now use BTC RPC Explorer. I'm able to access the GUI: https://explorer.btc21.org/address/1Mj94YLoFudaD4MvfxoUx7nAur5kTeRVFR and it shows the JSON tab, but I want the raw JSON for my application. How can I get access to this data via a URL?

3
  • I don't think btc-rpc-explorer currently expose an API. Maybe post an issue on their Github (github.com/janoside/btc-rpc-explorer) ? – darosior Jul 24 '20 at 17:42
  • Have you asked btc21.org? – RedGrittyBrick Jul 25 '20 at 11:09
  • This feels like an XY question to me: you seem to be asking about your attempted solution rather than your actual problem. This question could be improved if you added more information about the broader picture or directly asked about the actual problem, how to get whatever specific information you want to have for the address, instead of asking about how to get it from a specific service. – Murch Jul 26 '20 at 16:18
0

It seems to me that your actual problem is getting the balances for numerous Bitcoin addresses. As @darosior noted, the service you were looking into does not appear to offer an API. However, e.g. blockchair.com has an API endpoint that allows you to query up to 25,000 addresses at once. Even though blockchair.com also limits queries, you may be able to cover your data needs this way, since it will only take a single query to check numerous addresses.

The endpoint is https://api.blockchair.com/{:btc_chain}/addresses/balances?addresses={:comma_separated_list} (GET).

The endpoint returns only the addresses with balances, so if I query for your above address (that has a balance of 0) and a second (randomly chosen) address:

https://api.blockchair.com/bitcoin/addresses/balances?addresses=1Mj94YLoFudaD4MvfxoUx7nAur5kTeRVFR,bc1q34aq5drpuwy3wgl9lhup9892qp6svr8ldzyy7c

the endpoint returns:

{"data":{"bc1q34aq5drpuwy3wgl9lhup9892qp6svr8ldzyy7c":7630000},"context":{"code":200,"source":"A","results":1,"state":640895,"cache":{"live":true,"duration":60,"since":"2020-07-26 16:28:29","until":"2020-07-26 16:29:29","time":null},"api":{"version":"2.0.64","last_major_update":"2020-07-19 00:00:00","next_major_update":null,"documentation":"https:\/\/blockchair.com\/api\/docs","notice":"Beginning July 19th, 2020 we start enforcing request cost formulas, see the changelog for details"},"time":0.06320500373840332,"render_time":0.01229715347290039,"full_time":0.07550215721130371,"request_cost":1.003}}

Not the answer you're looking for? Browse other questions tagged or ask your own question.