def history_fetched(ec, history):
    if ec is not None:
        print >> sys.stderr, "Error fetching history:", ec
        return
    unspent_rows = [row[:4] for row in history if row[4] is None]
    unspent = build_output_info_list(unspent_rows)
    print obelisk.select_outputs(unspent, 10000)
Beispiel #2
0
 def select_outputs(self, min_value):
     unspent = []
     for addr, history in self.addrs.iteritems():
         key = self.keys[addr]
         unspent_rows = [row[:4] for row in history
                         if row[5] == obelisk.MAX_UINT32]
         unspent.extend(build_output_info_list(unspent_rows, key))
     print unspent
     return obelisk.select_outputs(unspent, min_value)
Beispiel #3
0
 def select_outputs(self, min_value):
     unspent = []
     for addr, history in self.addrs.iteritems():
         key = self.keys[addr]
         unspent_rows = [
             row[:4] for row in history if row[5] == obelisk.MAX_UINT32
         ]
         unspent.extend(build_output_info_list(unspent_rows, key))
     print unspent
     return obelisk.select_outputs(unspent, min_value)
Beispiel #4
0
def build_actual_tx(unspent, root_hash):
    print "Building...", root_hash.encode("hex")
    fee = 10000
    optimal_outputs = obelisk.select_outputs(unspent, fee)
    tx = obelisk.Transaction()
    for output in optimal_outputs.points:
        add_input(tx, output.point)
    add_return_output(tx, root_hash)
    change = optimal_outputs.change
    add_output(tx, address, change)
    key = obelisk.EllipticCurveKey()
    key.set_secret(secret)
    for i, output in enumerate(optimal_outputs.points):
        obelisk.sign_transaction_input(tx, i, key)
    broadcast.broadcast(tx)
    tx_hash = hash_transaction(tx)
    return tx_hash
Beispiel #5
0
def build_actual_tx(unspent, root_hash):
    print "Building...", root_hash.encode("hex")
    fee = 10000
    optimal_outputs = obelisk.select_outputs(unspent, fee)
    tx = obelisk.Transaction()
    for output in optimal_outputs.points:
        add_input(tx, output.point)
    add_return_output(tx, root_hash)
    change = optimal_outputs.change
    add_output(tx, address, change)
    key = obelisk.EllipticCurveKey()
    key.set_secret(secret)
    for i, output in enumerate(optimal_outputs.points):
        obelisk.sign_transaction_input(tx, i, key)
    broadcast.broadcast(tx)
    tx_hash = hash_transaction(tx)
    return tx_hash
Beispiel #6
0
    def history_fetched(ec, history):
        # print('history_fetched')
        if ec is not None:
            # print >> sys.stderr, "Error fetching history:", ec
            return
        unspent_rows = [row[:4] for row in history if row[4] is None]
        unspent = build_output_info_list(unspent_rows)
        unspent = obelisk.select_outputs(unspent, 10000)

        if unspent is None:
            callback(0)
            return

        points = unspent.points

        if len(points) != 1:
            callback(0)
            return

        point = points[0]
        value = point.value

        callback(value)
Beispiel #7
0
    def history_fetched(ec, history):
        # print('history_fetched')
        if ec is not None:
            # print >> sys.stderr, "Error fetching history:", ec
            return
        unspent_rows = [row[:4] for row in history if row[4] is None]
        unspent = build_output_info_list(unspent_rows)
        unspent = obelisk.select_outputs(unspent, 10000)

        if unspent is None:
            callback(0)
            return

        points = unspent.points

        if len(points) != 1:
            callback(0)
            return

        point = points[0]
        value = point.value

        callback(value)