

def payments_for_address(bitcoin_address):
    'return an array of (TX ids, net_payment)'
    URL = ('https://blockchain.info/address/%s?format=json' % bitcoin_address)
    d = urlopen(URL).read()
    json_response = json.loads(d.decode('utf8'))
    response = []
    for tx in json_response.get('txs', []):
        total_out = 0
        for tx_out in tx.get('out', []):
            if (tx_out.get('addr') == bitcoin_address):
                total_out += tx_out.get('value', 0)
        if (total_out > 0):
            response.append((tx.get('hash'), total_out))
    return response

dataset/ETHPy150Open maraoz/proofofexistence/pycoin/services/blockchain_info.py payments_for_address/original