Explore Courses Blog Tutorials Interview Questions
0 votes
in Blockchain by (4.1k points)

I am trying to write a python script that will take a bitcoin address and show how many transactions have processed against that address. I can pull the JSON data down and print it to the screen but I can not figure out how to actually make it so that I go into that data and pull out "n_tx" potion. Here is what I have so far, basic but it shows I am pulling the right data.

import requests
import json

r = requests.get('')

print r.json()

I have read several tutorials and tried lots of different ideas and I am sure it is a simple fix my brain just can't grasp it today.

Ultimately I would like to end up with the following on my screen: 1MtKaahhBAwc1Bs9JLgh2tTAmvHL4kauRb has 0 transactions

Thanks in advance.

1 Answer

0 votes
by (14.4k points)
edited by

Use the following line of code in your program, and it will execute: 

print r.json()['address'],' has ', r.json()['n_tx'], 'transactions'

Give yourself time to explore this field properly. Enroll in Blockchain Online Training now.

Browse Categories