Author

Topic: Program Python3 to check address balance in Bitcoin Core (Read 2263 times)

hero member
Activity: 865
Merit: 1006
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
hero member
Activity: 812
Merit: 587
Space Lord
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.
sr. member
Activity: 374
Merit: 250
you can setup your own local explorer (ABE) and then check balance ...
ABE - https://bitcointalksearch.org/topic/announce-abe-07-open-source-block-explorer-knockoff-22785
tyz
legendary
Activity: 3360
Merit: 1533
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
sr. member
Activity: 518
Merit: 250
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.
copper member
Activity: 1498
Merit: 1528
No I dont escrow anymore.
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.
hero member
Activity: 865
Merit: 1006
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
legendary
Activity: 1610
Merit: 1000
Well hello there!
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
copper member
Activity: 1498
Merit: 1528
No I dont escrow anymore.
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.
hero member
Activity: 865
Merit: 1006
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
Jump to: