コード例 #1
0
def history_fetched(ec, history):
    if ec:
        print >> sys.stderr, "Error:", ec
        obelisk.stop()
        return
    elif not history:
        print >> sys.stderr, "No history yet at this address."
        obelisk.stop()
        return
    for id, hash, index, height, value in history:
        if id == obelisk.PointIdent.Spend:
            client.fetch_transaction(hash, tx_fetched)
            return
    # Not found the hash!
    print >> sys.stderr, "No spends yet for this address. Keep bidding."
    obelisk.stop()
コード例 #2
0
ファイル: check_addr.py プロジェクト: Cryptix23/darkleaks
def history_fetched(ec, history):
    if ec:
        print >> sys.stderr, "Error:", ec
        obelisk.stop()
        return
    elif not history:
        print >> sys.stderr, "No history yet at this address."
        obelisk.stop()
        return
    for id, hash, index, height, value in history:
        if id == obelisk.PointIdent.Spend:
            client.fetch_transaction(hash, tx_fetched)
            return
    # Not found the hash!
    print >> sys.stderr, "No spends yet for this address. Keep bidding."
    obelisk.stop()
コード例 #3
0
def tx_fetched(ec, tx):
    if ec:
        print >> sys.stderr, "Internal error or bad DB:", ec
        obelisk.stop()
        return
    tx = obelisk.Transaction.deserialize(tx)
    for input in tx.inputs:
        # This is the input script
        print input.script.encode("hex")
        # Extract the public key from the script (begins with 02, 03 or 04)
        public_key = extract(input.script)
        # Use obelisk.public_key_to_bc_address(public_key) to get input_address
        input_address = obelisk.public_key_to_bc_address(public_key)
        # Skip input if not the one we're looking for.
        if input_address != address:
            continue
        # Found the public_key!
        print public_key.encode("hex")
        obelisk.stop()
        return
    print >> sys.stderr, "Internal error, couldn't find spend input!"
    obelisk.stop()
コード例 #4
0
ファイル: check_addr.py プロジェクト: Cryptix23/darkleaks
def tx_fetched(ec, tx):
    if ec:
        print >> sys.stderr, "Internal error or bad DB:", ec
        obelisk.stop()
        return
    tx = obelisk.Transaction.deserialize(tx)
    for input in tx.inputs:
        # This is the input script
        print input.script.encode("hex")
        # Extract the public key from the script (begins with 02, 03 or 04)
        public_key = extract( input.script )
        # Use obelisk.public_key_to_bc_address(public_key) to get input_address
        input_address = obelisk.public_key_to_bc_address(public_key)
        # Skip input if not the one we're looking for.
        if input_address != address:
            continue
        # Found the public_key!
        print public_key.encode("hex")
        obelisk.stop()
        return
    print >> sys.stderr, "Internal error, couldn't find spend input!"
    obelisk.stop()