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.
use-firstbits
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
commit
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
)
ImportError: No module named NCTestnet
– smatthewenglish Jun 08 '16 at 10:58