Пример #1
0
def givenewaddress():
  pair=addresses.generate_secure_pair()
  public_address=pair['public_address']
  private_key=pair['private_key']

  jsoninput=json.loads(request.data)

  coin_name=jsoninput['coin_name']
  color_amount=jsoninput['issued_amount']
  dest_address=public_address
  description=jsoninput['description']
  email=jsoninput['email']
  fee_each=0.00005
  markup=1
  tosend=str(transactions.creation_cost(color_amount, coin_name, "", description, fee_each, markup))

  responsejson={}
  responsejson['name']=coin_name
  responsejson['minting_fee']=tosend
  responsejson['issuing_public_address']=public_address
  responsejson['issuing_private_key']=private_key
  responsejson=json.dumps(responsejson)

  amount_expected=str(int(float(tosend)*100000000))
  amount_received="0"
  amount_withdrawn="0"
  k=databases.add_address(public_address, private_key, amount_expected, amount_received, amount_withdrawn, coin_name, color_amount, dest_address, description, email)
  print k

  response=make_response(responsejson, 200)
  response.headers['Content-Type'] = 'application/json'
  response.headers['Access-Control-Allow-Origin']= '*'
  return response
Пример #2
0
def givenewaddress():
  pair=addresses.generate_secure_pair()
  public_address=pair['public_address']
  private_key=pair['private_key']

  coin_name=request.form['coin_name']
  color_amount=request.form['issued_amount']
  dest_address=request.form['destination_address']
  description=request.form['description']
  ticker=request.form['ticker']
  email=request.form['email']

  fee_each=0.00005
  markup=1
  tosend=str(transactions.creation_cost(color_amount, coin_name, coin_name, description, fee_each, markup))

  responsejson={}
  responsejson['name']=coin_name
  responsejson['minting_fee']=tosend
  responsejson['issuing_public_address']=public_address
  responsejson['issuing_private_key']=private_key
  responsejson=json.dumps(responsejson)

  color_address='SFSDF'#addresses.hashlib.sha256(coin_name).hexdigest() #FIGURE THIS OUT

  # #write address to db
  amount_expected=str(int(float(tosend)*100000000))
  amount_received="0"
  amount_withdrawn="0"
  k=databases.add_address(public_address, private_key, amount_expected, amount_received, amount_withdrawn, coin_name, color_amount, dest_address, description, ticker, email)
  print k

  response=make_response(responsejson, 200)
  response.headers['Access-Control-Allow-Origin']= '*'
  return response
Пример #3
0
def makerandompair():
  pair=addresses.generate_secure_pair()
  pair=json.dumps(pair)
  response=make_response(str(pair), 200)
  response.headers['Content-Type'] = 'application/json'
  response.headers['Access-Control-Allow-Origin']= '*'
  return response
Пример #4
0
def message_queue():
  text=str(request.form['text'])

  r=addresses.generate_secure_pair()
  public=r['public_address']
  private=r['private_key']

  #CALCULATE COST NOW
  cost=0.002*(int(len(text)/37)+1)

  #DO SOMETHING WITH TEXT IN DB
  dbstring="insert into text_queue (text, public_address, private_key, amount_expected, success) values ('"+str(text)+"','"+public+"','"+private+"','"+str(int(cost*100000000))+"', 'False');"
  db.dbexecute(dbstring,False)

  results={}
  results['public_address']=public
  results['cost']=cost
  results=json.dumps(results)
  response=make_response(str(results), 200)
  response.headers['Access-Control-Allow-Origin']= '*'
  #response.headers['Access-Control-Allow-Origin']= 'http://www.chainscribe.com'
  return response
Пример #5
0
def makerandompair():
  return str(addresses.generate_secure_pair())