Python Script to pull data from Blockchain JSON

0 votes

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 get 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('http://blockchain.info/rawaddr/1MtKaahhBAwc1Bs9JLgh2tTAmvHL4kauRb')

print r.json()

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

can someone help me with this?

Sep 14, 2018 in Blockchain by slayer
• 29,350 points
1,559 views

1 answer to this question.

0 votes

Try this:

print r.json()['address'],' has ', r.json()['n_tx'], 'transactions'
answered Sep 14, 2018 by digger
• 26,740 points

Related Questions In Blockchain

0 votes
1 answer

How to retrieve data from a block to a blockchain?

web3.eth.getTransaction(txHash) will returns transaction details like blockHash, transactionIndex, ...READ MORE

answered Jun 27, 2018 in Blockchain by Perry
• 17,100 points
3,389 views
0 votes
1 answer
+1 vote
3 answers

Is it possible to store data about arbitrary objects on the blockchain using smart contracts?

Consider following tutorial from Hyperledger Fabric "Getting Started" pages. Basically ...READ MORE

answered Aug 30, 2018 in Blockchain by Artem
772 views
+1 vote
1 answer

Which data structure to prefer to model a blockchain?

To start with, let me tell you ...READ MORE

answered Apr 21, 2018 in Blockchain by Perry
• 17,100 points
2,342 views
+1 vote
1 answer

Protocols used in a distributed/dlt system for the nodes to establish communication

yes all are over TCP/IP connections secured by TLS encryption in hashgraph architecture-hashgraph, ...READ MORE

answered Aug 6, 2018 in Blockchain by aryya
• 7,450 points
876 views
0 votes
1 answer

Truffle tests not running after truffle init

This was a bug. They've fixed it. ...READ MORE

answered Sep 11, 2018 in Blockchain by Christine
• 15,790 points
1,282 views
0 votes
1 answer
0 votes
1 answer

How to parse Json data from remote server?

Yes, you can do it use the ...READ MORE

answered Aug 17, 2018 in Blockchain by digger
• 26,740 points
473 views
0 votes
1 answer

How to read file from subprocess.open in python?

you call: out, err = p.communicate() READ MORE

answered Aug 24, 2018 in Blockchain by digger
• 26,740 points
1,023 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP