Bitcoin Forum
June 21, 2024, 08:45:16 PM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Program Python3 to check address balance in Bitcoin Core  (Read 2237 times)
xcbtrader (OP)
Hero Member
*****
Offline Offline

Activity: 865
Merit: 1006


View Profile
December 19, 2015, 01:13:46 AM
 #1

Hello

I need to make a program in python 3 for check the balance for any bitcoin address.
My idea is use the bitcoin core and check the blockchain stored in my computer.
Is posible?
Could anyone give an example?

Thanks

shorena
Copper Member
Legendary
*
Offline Offline

Activity: 1498
Merit: 1520


No I dont escrow anymore.


View Profile WWW
December 19, 2015, 03:29:37 AM
 #2

Hello

I need to make a program in python 3 for check the balance for any bitcoin address.
My idea is use the bitcoin core and check the blockchain stored in my computer.
Is posible?
Could anyone give an example?

Thanks

Bitcoin core does not keep a balance for addresses that are not part of the wallet. You would need to build your own database.

Im not really here, its just your imagination.
nwfella
Legendary
*
Offline Offline

Activity: 1596
Merit: 1000

Well hello there!


View Profile
December 19, 2015, 05:41:02 AM
 #3

Hello

I need to make a program in python 3 for check the balance for any bitcoin address.
My idea is use the bitcoin core and check the blockchain stored in my computer.
Is posible?
Could anyone give an example?

Thanks
I would recommend executing a getbalance RPC call to your bitcoin-qt client via jgarzik's bitcoinrpc https://github.com/jgarzik/python-bitcoinrpc

¯¯̿̿¯̿̿'̿̿̿̿̿̿̿'̿̿'̿̿̿̿̿'̿̿̿)͇̿̿)̿̿̿̿ '̿̿̿̿̿̿\̵͇̿̿\=(•̪̀●́)=o/̵͇̿̿/'̿̿ ̿ ̿̿

Gimme the crypto!!
xcbtrader (OP)
Hero Member
*****
Offline Offline

Activity: 865
Merit: 1006


View Profile
December 19, 2015, 11:09:23 AM
 #4

I test to check the balance with external service:

http://blockexplorer.com/q/addressbalance/address
https://blockchain.info/es/q/addressbalance/address

I need more links.
Does anyone know any more direction?

Thanks

shorena
Copper Member
Legendary
*
Offline Offline

Activity: 1498
Merit: 1520


No I dont escrow anymore.


View Profile WWW
December 19, 2015, 11:16:48 AM
 #5

I test to check the balance with external service:

http://blockexplorer.com/q/addressbalance/address
https://blockchain.info/es/q/addressbalance/address

I need more links.
Does anyone know any more direction?

Thanks

Blocktrail has an API that can do that.

Im not really here, its just your imagination.
bitsmichel
Sr. Member
****
Offline Offline

Activity: 518
Merit: 250



View Profile
December 20, 2015, 11:37:09 AM
 #6

I test to check the balance with external service:

http://blockexplorer.com/q/addressbalance/address
https://blockchain.info/es/q/addressbalance/address

I need more links.
Does anyone know any more direction?

Thanks

If you just want to check on blockchain explorer sites, there are quite a few of those:
http://blockr.io/api/v1/address/info/address

Simply parse the JSON data, python 3 has a module for that.

tyz
Legendary
*
Offline Offline

Activity: 3360
Merit: 1533



View Profile
December 20, 2015, 09:54:27 PM
 #7

Not sure, if i got you right. There is a bunch of libraries and examples how to access Bitcoin RPC using Python.

Here's an example: http://upcoder.com/7/bitcoin-rpc-from-python
dagi
Sr. Member
****
Offline Offline

Activity: 374
Merit: 250



View Profile WWW
December 21, 2015, 09:15:38 AM
 #8

you can setup your own local explorer (ABE) and then check balance ...
ABE - https://bitcointalk.org/index.php?topic=22785.0
Parazyd
Hero Member
*****
Offline Offline

Activity: 812
Merit: 587


Space Lord


View Profile WWW
December 21, 2015, 09:24:05 AM
 #9

Not sure, if i got you right. There is a bunch of libraries and examples how to access Bitcoin RPC using Python.

Here's an example: http://upcoder.com/7/bitcoin-rpc-from-python

This works well enough.
Read up on the bitcoin-cli manual and see what commands you need. It should be pretty straightforwward.

Also make sure you set up your bitcoin.conf with the RPC username and password.
xcbtrader (OP)
Hero Member
*****
Offline Offline

Activity: 865
Merit: 1006


View Profile
January 09, 2016, 12:09:38 AM
 #10

In the end I used Electrum to perform this task in Python 2.7 (Python 3.x does not work).
I put a piece of code as an example:

from electrum import Network
from electrum.util import json_encode, print_msg
import json

n = Network()
n.start()

addr ='1jHyghjyu67ggt56Ggth766ghhjUuggh76gtf5'

h = n.synchronous_get(('blockchain.address.get_balance',[addr]))
print h.get('confirmed')

Thanks

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!