Example #1
0
            def cb(ec, history, order):

                # Debug
                # self._log.info('%s %s' % (ec, history))

                if ec is not None:
                    self._log.error("Error fetching history: %s" % ec)
                    # TODO: Send error message to GUI
                    return

                unspent = [row[:4] for row in history if row[4] is None]

                # Send all unspent outputs (everything in the address) minus the fee
                inputs = []
                for row in unspent:
                    assert len(row) == 4
                    inputs.append(str(row[0].encode('hex')) + ":" + str(row[1]))

                seller_signatures = []
                print 'private key ', self._transport.settings['privkey']
                for x in range(0, len(inputs)):
                    ms = multisign(tx, x, script, self._transport.settings['privkey'])
                    print 'seller sig', ms
                    seller_signatures.append(ms)

                tx2 = pybitcointools.apply_multisignatures(tx, 0, script, seller_signatures[0], msg['signatures'][0])

                print 'FINAL SCRIPT: %s' % tx2
                print 'Sent', pybitcointools.eligius_pushtx(tx2)
Example #2
0
            def cb(ec, history, order):

                # Debug
                # self._log.info('%s %s' % (ec, history))

                if ec is not None:
                    self._log.error("Error fetching history: %s" % ec)
                    # TODO: Send error message to GUI
                    return

                unspent = [row[:4] for row in history if row[4] is None]

                # Send all unspent outputs (everything in the address) minus the fee
                inputs = []
                for row in unspent:
                    assert len(row) == 4
                    inputs.append(
                        str(row[0].encode('hex')) + ":" + str(row[1]))

                seller_signatures = []
                print 'private key ', self._transport.settings['privkey']
                for x in range(0, len(inputs)):
                    ms = multisign(tx, x, script,
                                   self._transport.settings['privkey'])
                    print 'seller sig', ms
                    seller_signatures.append(ms)

                tx2 = pybitcointools.apply_multisignatures(
                    tx, 0, script, seller_signatures[0], msg['signatures'][0])

                print 'FINAL SCRIPT: %s' % tx2
                print 'Sent', pybitcointools.eligius_pushtx(tx2)
Example #3
0
 def push_tx(self, tx):
     # Send transaction
     if self.user_mode == 'mainnet':
         try:
             bc.pushtx(tx)
         except:
             try:
                 bc.eligius_pushtx(tx)
             except:
                 raise IOError("Unable to push transaction!")
     elif self.user_mode == 'testnet':
         try:
             bc.blockr_pushtx(tx, 'testnet')
         except:
             raise IOError("Unable to push transaction!")
     else:
         raise Exception("User mode {0} not supported for push_tx.".format(self.user_mode))
         
     return