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,040 points
148 views

1 answer to this question.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
0 votes

Try this:

print r.json()['address'],' has ', r.json()['n_tx'], 'transactions'
answered Sep 14, 2018 by digger
• 27,620 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 26, 2018 in Blockchain by Perry
• 16,450 points
37 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
65 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 20, 2018 in Blockchain by Perry
• 16,450 points
24 views
0 votes
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 ariaholic
• 7,320 points
43 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
65 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
• 27,620 points
20 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
• 27,620 points
32 views

© 2018 Brain4ce Education Solutions Pvt. Ltd. All rights Reserved.
"PMP®","PMI®", "PMI-ACP®" and "PMBOK®" are registered marks of the Project Management Institute, Inc. MongoDB®, Mongo and the leaf logo are the registered trademarks of MongoDB, Inc.