I am looking for an efficient way of getting the last 200 blocks and being able to pull all transactions related to an address. I would like to do this for BTC, ETH, and LTC. Is there any way to achieve this without running a full node for each blockchain myself? Any advice would help. Thank you!

*This is my first post. Any advice on how to write a better one also appreciated. Thank you.


yes, you can do it for bitcoin using https://blockchain.info/api

For example here is an example how to get all transaction related to 1ADJqstUMBB5zFquWg19UqZ7Zc6ePCpzLE in last 200 blocks,

import urllib2, json

def main(blocks_to_check, address):

    current_block_height = json.load(urllib2.urlopen("https://blockchain.info/q/getblockcount"))

    for x in xrange(current_block_height - blocks_to_check, current_block_height):
        block = json.load(urllib2.urlopen("https://blockchain.info/block-height/%d?format=json" %x))
        for transaction in block["blocks"][0]["tx"]:
            if address in str(transaction):
                print transaction
                print transaction["hash"]

if __name__ == '__main__':
    main(200, "1ADJqstUMBB5zFquWg19UqZ7Zc6ePCpzLE")

Bitcoin relies on verification instead of trust. Obtaining the data only on the last 200 blocks would require you to trust the data without a way to verify it. Now you could run a pruned node that will only keep the last 550 blocks on disk, but it initially downloads and verifies everything. Unfortunately running a pruned node does not allow you to see UTXO (balance) details of addresses you do not own; you would need a full node with transaction index on and write a block parser for that.

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.