Bitcoin Forum
May 30, 2024, 10:45:30 AM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: « 1 [2]  All
  Print  
Author Topic: APIs to know the balance of a bitcoin address  (Read 2722 times)
xcbtrader (OP)
Hero Member
*****
Offline Offline

Activity: 865
Merit: 1006


View Profile
September 10, 2016, 09:57:32 AM
 #21

New API added:

https://api.coinprism.com/v1/addresses/1dice97ECuByXAvqXpaYzSaQuPVvrtmz6


Coding Enthusiast
Legendary
*
Offline Offline

Activity: 1039
Merit: 2783


Bitcoin and C♯ Enthusiast


View Profile WWW
September 10, 2016, 11:14:10 AM
 #22

##
i Call with python program, no errors in others APIs but, this not work:

Code:
addr = '1dice8EMZmqKvrGE4Qc9bUFf9PX3xaYDp'

request = 'https://www.blockonomics.co/api/balance/' + addr
response = requests.get(request)
content = response.json()
content = int(content['response']['confirmed'])

####

your problem is in your first line of code `request` you should send the request to the URI without the appended `addr` instead you should put the `addr` inside of a HttpRequest (equivalent in python) and `post` it.

also you need to add a header with the ApiKey
Code:
POST https://www.blockonomics.co/api/balance
Request body: {"addr": <Whitespace seperated list of bitcoin addresses/xpubs>}
p.s. everywhere i look i see people are using python these days, i am getting depressed for choosing to learn C# Cool

Projects List+Suggestion box
Donate: 1Q9s or bc1q
|
|
|
FinderOuter(0.19.1)Ann-git
Denovo(0.7.0)Ann-git
Bitcoin.Net(0.26.0)Ann-git
|
|
|
BitcoinTransactionTool(0.11.0)Ann-git
WatchOnlyBitcoinWallet(3.2.1)Ann-git
SharpPusher(0.12.0)Ann-git
btc_enigma
Hero Member
*****
Offline Offline

Activity: 688
Merit: 567


View Profile
September 10, 2016, 11:45:22 AM
 #23

Quote
also you need to add a header with the ApiKey

Actually API key is not needed. This should work:

Code:
import json
import requests
addr = '1dice8EMZmqKvrGE4Qc9bUFf9PX3xaYDp'

request = 'https://www.blockonomics.co/api/balance'
response = requests.post(request, data=json.dumps({"addr":addr}))
content = response.json()
balance = content['response'][0]['confirmed']

xcbtrader (OP)
Hero Member
*****
Offline Offline

Activity: 865
Merit: 1006


View Profile
September 10, 2016, 12:00:50 PM
 #24

Quote
also you need to add a header with the ApiKey

Actually API key is not needed. This should work:

Code:
import json
import requests
addr = '1dice8EMZmqKvrGE4Qc9bUFf9PX3xaYDp'

request = 'https://www.blockonomics.co/api/balance'
response = requests.post(request, data=json.dumps({"addr":addr}))
content = response.json()
balance = content['response'][0]['confirmed']

Works fine...
Thanks

vishtany
Member
**
Offline Offline

Activity: 88
Merit: 10

Founder/Blogger/Web Developer at BITVoxy


View Profile WWW
September 12, 2016, 03:54:28 AM
 #25

Ok, i added these to my list https://github.com/BITVoxy/awesome-bitcoin

▀  ███       LEDGER  WALLET   PROTECT  YOUR  BITCOINS
▀  ▀▀▀       Smartcard security for your bitcoins        Decentralized,Open,Secure         Available now  []
▀  ▀  ▀       ▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀        ▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀         ▀▀▀▀▀▀▀▀▀▀▀▀▀▀

BITPin. Micropayments|BITVoxy Network|Fennx|Fennx Faucet
Bitrated user: vishtany.
xcbtrader (OP)
Hero Member
*****
Offline Offline

Activity: 865
Merit: 1006


View Profile
September 12, 2016, 06:40:43 AM
 #26

Ok, i added these to my list https://github.com/BITVoxy/awesome-bitcoin

Ok... No problem.

Pages: « 1 [2]  All
  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!