def coin_sources_for_address(bitcoin_address):
    """"
    return an array of elements of the form:
        (tx_hash, tx_output_index, tx_out)
        tx_out is a TxOut item with attrs "value" & "script"
    """
    URL = "https://blockchain.info/unspent?active=%s&format=json" % (bitcoin_address)
    result = urlfetch.fetch(URL)
    if result.status_code != 200:
      return []
    r = json.loads(result.content)
    coins_sources = []
    for unspent_output in r["unspent_outputs"]:
        tx_out = TxOut(unspent_output["value"], binascii.unhexlify(unspent_output["script"].encode()))
        coins_source = (binascii.unhexlify(unspent_output["tx_hash"].encode()), unspent_output["tx_output_n"], tx_out)
        coins_sources.append(coins_source)
    return coins_sources
dataset/ETHPy150Open maraoz/proofofexistence/pycoin/services/blockchain_info.py/coin_sources_for_address/original