Bitcoin-Core

如何獲取訪問 URL 以從 BTC RPC Explorer 獲取 JSON 輸出

  • July 26, 2020

目前我正在使用 blockchain.info 來獲取這樣的地址的餘額:<https://blockchain.info/de/q/addressbalance/1Mj94YLoFudaD4MvfxoUx7nAur5kTeRVFR>

它輸出比特幣餘額。

由於 blockchain.info 有速率限制,我現在必須使用 BTC RPC Explorer。我可以訪問 GUI:https ://explorer.btc21.org/address/1Mj94YLoFudaD4MvfxoUx7nAur5kTeRVFR並顯示 JSON 選項卡,但我想要我的應用程序的原始 JSON。如何通過 URL 訪問這些數據?

在我看來,您的實際問題是獲取眾多比特幣地址的餘額。正如@darosior 所指出的,您正在研究的服務似乎沒有提供 API。但是,例如 blockchair.com 有一個 API 端點,允許您一次查詢多達 25,000 個地址。儘管 blockchair.com 也限制查詢,但您可以通過這種方式滿足您的數據需求,因為只需一次查詢即可檢查多個地址。

端點https://api.blockchair.com/{:btc_chain}/addresses/balances?addresses={:comma_separated_list} (GET)。_

端點僅返回帶有餘額的地址,因此,如果我查詢您的上述地址(餘額為 0)和第二個(隨機選擇)地址:

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

端點返回:

{"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}}

引用自:https://bitcoin.stackexchange.com/questions/97170