This commit is contained in:
sairajzero 2018-09-30 20:08:41 +05:30
parent eb4a67dddb
commit 3b17810e63
6 changed files with 62 additions and 16 deletions

Binary file not shown.

View File

@ -53,7 +53,7 @@ def getJsonData(Dapps, lastTx):
lastTx = 0
print(lastTx)
for i in range(lastTx,len(data['last_txs'])):
print(i)
#print(i)
if(data['last_txs'][i]['type']=='vin'):
content = readUnitFromBlockchain(data['last_txs'][i]['addresses'])
#print(content)

View File

@ -70,7 +70,7 @@ def getJsonData(Dapps, lastTx):
lastTx = 0
#print(lastTx)
for i in range(lastTx,len(data['last_txs'])):
print(i)
#print(i)
if(data['last_txs'][i]['type']=='vin'):
content = readUnitFromBlockchain(data['last_txs'][i]['addresses'])
#print(content)
@ -246,7 +246,7 @@ except:
with open('Apps.json','w+') as F:
data = json.dumps({'Dapps':apps ,'lastTx':lastTx})
print(data)
#print(data)
F.write(data)
root = Tk()

View File

@ -44,7 +44,7 @@ def getJsonData():
app = json.loads(content)
except :
continue
print(app)
#print(app)
if 'Dapp' in app.keys():
Dapps = Dappend(Dapps,app['Dapp'])
#print(Dapps)

12
test.py
View File

@ -1,12 +0,0 @@
def searchDict(dicArr,key,val):
for i in range(len(dicArr)):
if(dicArr[i][key]==val):
return i
return -1
d = [{'id': '1', 'name': 'Alexandria', 'icon': 'Icon/Alexandria.png', 'type': 'Webapp', 'url': 'https://alexandria.io/browser/'}, {'id': '2', 'name': 'AlternateLove', 'icon': 'Icon/AternaLove.png', 'type': 'Cmdline', 'location': 'apps/aternalove', 'exec': './auto-aterna-love.sh', 'github': 'https://github.com/metacoin/aternalove.git'}, {'id': '3', 'name': 'Caltech', 'icon': 'Icon/Caltech.png', 'type': 'Webapp', 'url': 'https://etdb.caltech.edu/browse'}, {'id': '4', 'name': 'Flotorizer', 'icon': 'Icon/Flotorizer.png', 'type': 'Webapp', 'url': 'http://flotorizer.net/'}, {'id': '5', 'name': 'Medici', 'icon': 'Icon/Medici.png', 'type': 'Webapp', 'url': 'https://www.mediciventures.com/'}, {'id': '6', 'name': 'FloSharedSecret', 'icon': 'Icon/SharedSecret.png', 'type': 'Gui', 'location': 'apps/FLO-shared-secret/', 'exec': './FLO_Secret', 'github': 'https://github.com/akhil2015/FLO-shared-secret.git'}, {'id': '7', 'name': 'FloRate', 'icon': 'Icon/Florate.png', 'type': 'Gui', 'location': 'apps/FloRate-Dapp/', 'exec': './Florate', 'github': 'https://github.com/Tarun047/FloRate-Dapp.git'}, {'id': '8', 'name': 'tZero', 'icon': 'Icon/tZero.png', 'type': 'Webapp', 'url': 'https://www.tzero.com/'}, {'id': '9', 'name': 'WorldMood', 'icon': 'Icon/WorldMood.png', 'type': 'Webapp', 'url': 'http://worldmood.io/'}, {'id': '10', 'name': 'Xcertify', 'icon': 'Icon/Xcertify.png', 'type': 'Cmdline', 'location': 'apps/Xcertify/', 'exec': './xcertify', 'github': 'https://github.com/akhil2015/Xcertify.git'}]
del(d[1])
print(d)
i = searchDict(d,'id','4')
if(i!=-1):
print(i)

58
xsend_floData.py Normal file
View File

@ -0,0 +1,58 @@
import subprocess
import json
address = 'oXa7t72t3CgnR11ycxVfdupz55eucHufHj'
toAddress = 'ocZXNtzpiUqBvzQorjAKmZ5MhXxGTLKeSH'
process = subprocess.Popen(['flo-cli','-testnet','listunspent','1','9999999','["'+address+'"]'], stdout=subprocess.PIPE)
unspent = json.loads(process.communicate()[0].decode())
print("Enter floData :")
lines = []
while True:
line = input()
if line:
lines.append(line)
else:
break
floData = '\n'.join(lines)
try:
floData=str(json.loads(floData))
except:
None
print('floData='+floData)
print(len(unspent))
for i in range(len(unspent)):
print('\n'+str(i)+':'+str(unspent[i]['amount']))
if(unspent[i]['spendable'] and unspent[i]['amount']>0.01005):
txid = unspent[i]['txid']
amount = unspent[i]['amount']
print(txid)
print(amount)
process = subprocess.Popen(['flo-cli','-testnet','createrawtransaction','[{"txid":"'+txid+'", "vout":0}]','{"'+toAddress+'":0.01, "'+address+'":'+str(round(amount-0.01005,7))+'}','0','false','"'+floData+'"'], stdout=subprocess.PIPE)
createHash = process.communicate()[0].decode().strip()
print(createHash)
process = subprocess.Popen(['flo-cli','-testnet','signrawtransaction',createHash], stdout=subprocess.PIPE)
sign = json.loads(process.communicate()[0].decode())
print(sign)
if(not sign['complete']):
print("Failed to sign transaction : "+sign['errors'][0]['error'])
continue
process = subprocess.Popen(['flo-cli','-testnet','sendrawtransaction',sign['hex']], stdout=subprocess.PIPE)
newtxid = str(process.communicate()[0].decode())
print(newtxid)
if(newtxid):
break