Ejemplo n.º 1
0
def checkaddresses():
  dbstring="SELECT * FROM ADDRESSES WHERE amount_withdrawn=0;"
  addresslist=databases.dbexecute(dbstring,True)
  print addresslist

  for address in addresslist:
    unspents=addresses.unspent(address[0])
    value=0
    for x in unspents:
      value=value+x['value']
    print "currently available in "+str(address[0])+" : "+str(value/100000000)

    if value>=address[2] and address[3]<address[2]:
      #makenewcoins
      fromaddr=address[0]
      colornumber=address[6]
      colorname=address[5]
      destination=address[7]
      fee_each=0.00005
      private_key=address[1]
      ticker=address[9]
      description=address[8]
      txdata=transactions.make_new_coin(fromaddr, colornumber, colorname, destination, fee_each, private_key, description)

      txhash=txdata[0]
      txhash=txhash+":0" #issuance always first output

      #mark as completed
      if len(txhash)>10:
        databases.edit_address(fromaddr, value, value, colornumber)
        their_email=address[9]
        email_commands.email_creation(str(their_email), str(colorname), str(colornumber), str(description), str(txhash))
        databases.dbexecute("insert into colors (source_address, color_name) values ('"+fromaddr+"','"+colorname+"');",False)
Ejemplo n.º 2
0
def checkaddresses():
  dbstring="SELECT * FROM ADDRESSES WHERE amount_withdrawn=0;"
  addresslist=databases.dbexecute(dbstring,True)
  print addresslist

  for address in addresslist:
    unspents=addresses.unspent(address[0])
    value=0
    for x in unspents:
      value=value+x['value']
    print "currently available in "+str(address[0])+" : "+str(value/100000000)

    if value>=address[2] and address[3]<address[2]:
      #makenewcoins
      fromaddr=address[0]
      colornumber=address[6]
      colorname=address[5]
      destination=address[7]
      fee_each=0.00004
      private_key=address[1]
      ticker=address[9]
      description=address[8]
      txdata=transactions.make_new_coin(fromaddr, colornumber, colorname, destination, fee_each, private_key, description)

      txhash=txdata[0]
      txhash=txhash+":0" #issuance always first output

      #mark as completed
      databases.edit_address(fromaddr, value, value, colornumber)

      #add entry to colors db
      # #referencehex=bitsource.tx_lookup(specific_inputs)
      # color_address=bitsource.script_to_coloraddress()
      #databases.add_color(color_address, fromaddr, colornumber, colorname)
      databases.dbexecute("insert into colors (source_address, color_name) values ('"+fromaddr+"','"+colorname+"');",False)
Ejemplo n.º 3
0
def checkaddresses():
    dbstring = "SELECT * FROM ADDRESSES WHERE amount_withdrawn=0;"
    addresslist = databases.dbexecute(dbstring, True)
    print addresslist

    for address in addresslist:
        unspents = addresses.get_unspent(address[0])
        value = 0
        for x in unspents:
            value = value + x["value"]
        print "currently available in " + str(address[0]) + " : " + str(value / 100000000)

        if value >= address[2] and address[3] < address[2]:
            # makenewcoins
            fromaddr = address[0]
            colornumber = address[6]
            colorname = address[5]
            destination = address[7]
            fee_each = 0.00005
            private_key = address[1]
            ticker = address[9]
            description = address[8]

            try:
                txdata = transactions.make_new_coin(
                    fromaddr, colornumber, colorname, destination, fee_each, private_key, description
                )
            except:
                print "ERROR CREATING NEW COIN"
                print str(fromaddr) + " / " + str(colornumber) + " / " + str(colorname) + " / " + str(
                    destination
                ) + " / " + str(fee_each) + " / " + str(private_key) + " / " + str(description)

            try:
                txhash = txdata["transaction_hash"]
            except:
                txhash = "Error"
                print "ERROR reading txdata"
                print txdata

            txhash = txhash + ":0"  # issuance always first output
            # mark as completed
            if txhash == "None:0":
                k = 1  # do nothing
            else:
                databases.edit_address(fromaddr, value, value, colornumber)
                their_email = address[9]
                email_commands.email_creation(
                    str(their_email), str(colorname), str(colornumber), str(description), str(txhash)
                )
                databases.dbexecute(
                    "insert into colors (source_address, color_name) values ('" + fromaddr + "','" + colorname + "');",
                    False,
                )
Ejemplo n.º 4
0
def makenewcolor():
  fromaddr=str(request.form['fromaddr'])
  colornumber=str(request.form['colornumber'])
  colorname=str(request.form['colorname'])
  destination=str(request.form['destination'])
  fee_each=str(request.form['fee_each'])
  private_key=str(request.form['private_key'])
  ticker=str(request.form['ticker'])
  description=str(request.form['description'])

  print str(fromaddr)
  result=transactions.make_new_coin(fromaddr, colornumber, colorname, destination, fee_each, private_key, ticker, description)
  return str(result)
Ejemplo n.º 5
0
def makenewcoin():
  public_address=str(request.form['public_address'])
  initial_coins=int(request.form['initial_coins'])
  name=str(request.form['name'])
  recipient=str(request.form['recipient'])
  fee_each=0.00005
  private_key=str(request.form['private_key'])
  ticker=str(request.form['ticker'])
  description=str(request.form['description'])

  response=transactions.make_new_coin(public_address, initial_coins, name, recipient, fee_each, private_key, ticker, description)
  response=make_response(str(response), 200)
  response.headers['Access-Control-Allow-Origin']= '*'
  return response
Ejemplo n.º 6
0
def makenewcolor():
    fromaddr = str(request.form['fromaddr'])
    colornumber = str(request.form['colornumber'])
    colorname = str(request.form['colorname'])
    destination = str(request.form['destination'])
    fee_each = str(request.form['fee_each'])
    private_key = str(request.form['private_key'])
    ticker = str(request.form['ticker'])
    description = str(request.form['description'])

    print str(fromaddr)
    result = transactions.make_new_coin(fromaddr, colornumber, colorname,
                                        destination, fee_each, private_key,
                                        ticker, description)
    return str(result)
Ejemplo n.º 7
0
def makenewcoin():
    public_address = str(request.form['public_address'])
    initial_coins = int(request.form['initial_coins'])
    name = str(request.form['name'])
    recipient = str(request.form['recipient'])
    fee_each = 0.00005
    private_key = str(request.form['private_key'])
    ticker = str(request.form['ticker'])
    description = str(request.form['description'])

    response = transactions.make_new_coin(public_address, initial_coins, name,
                                          recipient, fee_each, private_key,
                                          ticker, description)
    response = make_response(str(response), 200)
    response.headers['Access-Control-Allow-Origin'] = '*'
    return response
Ejemplo n.º 8
0
def checkaddresses():  #FOR PAYMENT DUE      #WORKS
  #check all addresses that are still pending
    #for each that is ready, go through makenewcoins process
    #mark as completed
    #send profits elsewhere

  #read all addresses
  dbstring="SELECT * FROM ADDRESSES WHERE amount_withdrawn=0;"
  addresslist=databases.dbexecute(dbstring,True)
  print addresslist

  for address in addresslist:
    unspents=addresses.unspent(address[0])
    value=0
    for x in unspents:
      value=value+x['value']
    print "currently available in "+str(address[0])+" : "+str(value/100000000)

    if value>=address[2] and address[3]<address[2]:
      #makenewcoins
      fromaddr=address[0]
      colornumber=address[6]
      colorname=address[5]
      destination=address[7]
      fee_each=0.00004
      private_key=address[1]
      ticker=address[9]
      description=address[8]
      txdata=transactions.make_new_coin(fromaddr, colornumber, colorname, destination, fee_each, private_key, ticker, description)

      txhash=txdata[0]
      txhash=txhash+":0" #issuance always first output
      specific_inputs=txdata[1]['output']  #THIS IS CRUCIAL IN FINDING COLOR ADDRESS

      #mark as completed
      databases.edit_address(fromaddr, value, value, colornumber)

      #add entry to colors db
      #referencehex=bitsource.tx_lookup(specific_inputs)
      color_address=bitsource.script_to_coloraddress()
      databases.add_color(color_address, fromaddr, colornumber, colorname)