Suppose I want to

  • get the balance of an address I don't own, or
  • see all the transactions recently made

Bitcoin Block Explorer has this information, but I don't want to use it

  • because of security (they might lie)
  • because of privacy (they might log queries)
  • because it introduces an additional point of failure
  • because it's not terribly quick, being a free service and all

How can I get this information from my bitcoind?


bitcoind doesn't give you a way to query this, but by looking at the files it writes to disk, we can build our own tools that let us look at this. One such tool is Abe, and this is how you use it:

Installation (Ubuntu)

I'm assuming you have the standard bitcoin client running already.

Download Abe. Unpack it, and run python setup.py install

Go into abe.conf and add these lines:

# SQLite3 example:
dbtype = sqlite3
connect-args = abe.sqlite
# Specify port and/or host to serve HTTP instead of FastCGI:
port 2750
host localhost

A note about firstbits

If you want to do firstbits lookups, you need to add one more line to the config.


Note that you need to do this before you run abe, or else you'll need to run Abe.reconfigure too.

Back to the normal installation

Run python -m Abe.abe --config /path/to/abe.conf

You should see the screen get spammed with

block_tx 38944 39254

At time of writing, this will need to count up to 220,000. This took me about 8 hours. After the first startup, it will load in about a second.

Try opening http://localhost:2750/. If it shows no data, then there was an error. The output that the abe command produced immediately before saying that it was listening should give you some sort of insight.

Now your application can issue http requests to find out about the blockchain! There is a link to some documentation (http://localhost:2750/q), but you'll mostly be interested in

  • getreceivedbyaddress (http://localhost:2750/chain/Bitcoin/q/getreceivedbyaddress/ADDRESS)
  • getsentbyaddress (http://localhost:2750/chain/Bitcoin/q/getsentbyaddress/ADDRESS)
  • fb (http://localhost:2750/q/fb/ADDRESS)
  • I tried this but I got the error message ImportError: No module named NCTestnet – smatthewenglish Jun 8 '16 at 10:58

I am actually working on doing this myself for a project, like the above poster said you can use the bitcoind API.

To get the information on addresses you don't own the commands "getrecievedbyaddress" and so on wont work.

You will need to work your way through the blockchain which can take a long time and i would not recommend doing it manually.

Here is the order of commands you would follow in order to do follow the blockchain.

  1. getblockcount - this will give you the total number of blocks in the network
  2. Now starts the endless loop of going from block to block with the following command - getblockhash {index} index the is block height. For example when you do block count you might see something like 200890. So the index of the last block is 200890 so you would input getblockhash 200890 which will return the hash number of a block.

  3. getblock {hash} This command now gives you all the transactions within the block.

  4. Now your going to use each transaction ID in the block with the following command getrawtransaction {txid} This is going to give you a list of the inputs and outputs of each transaction. Here you will see the addresses which received and sent within that transaction and the amount involved.

Now you'll basically loop this until you've built up a database of the entire blockchain, their is no easy way to do it unfortunately. I am just starting out on all these steps so i may have missed something, but the general idea is thier.

Hopefully you find that block of text useful in some way =)


You can use the API to access each block, and then Raw Transactions to access each transaction within each block. It isn't trivial but it can be done.

  • Seems like this might take a while if you wanted to figure out the balance of an account. It's probably the right move if you want to find out about recent transactions, though. Good information! – Nick ODell Nov 27 '12 at 19:00

To see all transactions recently made (by anyone on the network), you can use the getrawmemorypool RPC call, it will give you a list of all txids in the memory pool (not yet in a block). Those can be passed to getrawtransaction to retrieve the actual transaction. getblock can be used to see the transactions in recent blocks.

Querying the unspent outputs by address (required to calculate the "balance") requires an index from addresses to txids. Bitcoind does not maintain such an index, as it is not required for normal operation, but it may be added as an optional feature somewhere in the future.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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