# -*- coding:utf-8 -*- import sqlite3 from wrapper.client import Client seed = 'SDSSWWPCGGRDB6SVVOJUWFQ3ODQFX62GVTKCPELNULO5PXVCFE67L7HO' client = Client(seed, api_server='test') # 连接sqlite conn = sqlite3.connect('/home/cc5985/key_pairs.db') cursor = conn.cursor() sql_str = 'select * from key_pairs_2018_3_17' data = cursor.execute(sql_str).fetchall() cnt = 0 for line in data: if cnt >= 100: break address = str(line[2]) client.fund(destination=address, amount=1000000000 - 0.00001) cnt += 1 print "Operation done successfully" conn.close()
# f.close() # read the json file and convert it to an array: f = open('keys.json', 'r') key_pairs = json.loads(f.read()) f.close() # from stellar_base.builder import Builder seed = master_private_key cnt = 0 # make initial funded accounts: for key_pair in key_pairs: pub_key = key_pair['public_key'] print(client.fund(destination=pub_key, amount=10000)) # # funded_key_pairs=key_pairs[:51] # # # make an array of threads # threads=[] # import threading # for i in range(50): # priv=funded_key_pairs[i]["private_key"] # publ=funded_key_pairs[i+1]["public_key"] # thread=threading.Thread(target=op, args=(priv,publ,10,) ) # threads.append(thread) # # t1=time.time() # # do operations using multithread # for thread in threads:
# test funding function import time from wrapper.client import Client from wrapper.keypair import Keypair seed='SDSSWWPCGGRDB6SVVOJUWFQ3ODQFX62GVTKCPELNULO5PXVCFE67L7HO' client=Client(seed,api_server='test') key_pairs=[] t1=time.time() for i in range(0,5): key_pair=Keypair.random() secret_key=key_pair.seed().decode() address=key_pair.address().decode() client.fund(address,1000) print(secret_key+' '+address) key_pairs.append(key_pair) t2=time.time() print('\n' + str(t2-t1))