def POST(self, signature, Type, timestamp, amount=None, destination=None, pid=None, mixin=None): times= int(time.time()) pubkey = MiniNeroPk message = Type+amount.replace('.', 'd')+timestamp+destination ver = Verify(signature.encode("utf8"), message.encode("utf8"), pubkey) if abs(times - int(timestamp)) > 30: ver = False return ('fail based on timestamp too old') if Type == 'address': if (ver): print("do rpc call") #bitmonerod.myAddress() return ("Your Address is ") if Type == 'balance': if (ver): print("do rpc call") #bitmonerod.myAddress() return ('your balance is ??') if Type == 'send': if (ver) : #create xmr2 order async, return uuid uuid, xmr_amount, xmr_addr, xmr_pid = SimpleXMR2.btc2xmr(destination, amount) bitmonerod.send(xmr_addr, float(xmr_amount), xmr_pid, 3) return ('order uuid: '+uuid)
def POST(self, signature, Type, timestamp, amount=None, destination=None, pid=None, mixin=None): times = int(time.time()) pubkey = MiniNeroPk message = Type + amount.replace('.', 'd') + timestamp + destination ver = Verify(signature.encode("utf8"), message.encode("utf8"), pubkey) if abs(times - int(timestamp)) > 30: ver = False return ('fail based on timestamp too old') if Type == 'address': if (ver): print("do rpc call") #bitmonerod.myAddress() return ("Your Address is ") if Type == 'balance': if (ver): print("do rpc call") #bitmonerod.myAddress() return ('your balance is ??') if Type == 'send': if (ver): #create xmr2 order async, return uuid uuid, xmr_amount, xmr_addr, xmr_pid = SimpleXMR2.btc2xmr( destination, amount) bitmonerod.send(xmr_addr, float(xmr_amount), xmr_pid, 3) return ('order uuid: ' + uuid)
def POST(self, signature, Type, timestamp, amount=None, destination=None, pid=None, mixin=None): times= int(time.time()) pubkey = MiniNeroPk global lasttime if (abs(times - int(timestamp)) > 30): ver = False return ('fail based on timestamp too old') else: if Type == 'address': message = Type+timestamp ver = Verify(signature.encode("utf8"), message.encode("utf8"), pubkey) if (ver): print("getting address") address = bitmonerod.myAddress() return (str(address)) if Type == 'balance': message = Type+timestamp ver = Verify(signature.encode("utf8"), message.encode("utf8"), pubkey) if (ver): print("getting balance") balance = bitmonerod.balance() return (str(float(balance)/1000000000000)) if Type == 'send': message = Type+amount.replace('.', 'd')+timestamp+destination ver = Verify(signature.encode("utf8"), message.encode("utf8"), pubkey) if (ver) and (abs(times - lasttime >30 )): #create xmr2 order async, return uuid uuid, xmr_amount, xmr_addr, xmr_pid = SimpleXMR2.btc2xmr(destination, amount) bitmonerod.send(xmr_addr, float(xmr_amount), xmr_pid, 3) lasttime = times return ('order uuid: '+uuid) if Type == 'sendXMR': message = Type+amount.replace('.', 'd')+timestamp+destination ver = Verify(signature.encode("utf8"), message.encode("utf8"), pubkey) if (ver) and (abs(times - lasttime >30 )): #create xmr2 order async, return uuid #uuid, xmr_amount, xmr_addr, xmr_pid = SimpleXMR2.btc2xmr(destination, amount) lasttime = times xmr_amount = amount xmr_addr = destination xmr_pid = pid bitmonerod.send(xmr_addr, float(xmr_amount), xmr_pid, 3) return ('sent')
import MiniNero import ed25519 import binascii import PaperWallet import cherrypy import os import time import bitmonerod import SimpleXMR2 xmr_addr = "44TVPcCSHebEQp4LnapPkhb2pondb2Ed7GJJLc6TkKwtSyumUnQ6QzkCCkojZycH2MRfLcujCM7QR1gdnRULRraV4UpB5n4" xmr_amount = "0.25" xmr_pid = "d8dd8f42cb13f26dbbf86d2d1da061628cdd17781be95e58a21c845465a2c7f6" bitmonerod.send(xmr_addr, float(xmr_amount), xmr_pid, 3)