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:
I'm assuming you have the standard bitcoin client running already.
Download Abe. Unpack it, and run
python setup.py install
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:
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
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.
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