Exploring various blockchains using Python

We wrote a small script to query the block chains of Namecoin, Litecoin, Peercoin, Bitcoin and Dogecoin. It is meant as simple example for programmers new to blockchain technology.  You do not need to download any full blockchain for this example. The script currently has this functionality:

  • explore blocks
  • explore transactions
  • explore addresses

Screenshot of bkchain

The script is minimalistic, I made it in 20 minutes, and like all software it could be improved. I think it is simple enough to change to your own wishes. It relies on https://bkchain.org/  to collect the data, but could be modified for any webserver that has an JSON API interface.  To see the list of API calls visit https://bkchain.org/static/api.txt Every function is basically dealing with JSON data, while on the bottom there are some calls to these functions.

Save the script as coin.py and run:

This will output the data for those addresses and blocks. To change currency simply change ‘nmc’ to the blockchain you want.  The code does not have proper error checking yet. Have fun with it!