import httprequest
miner_fee = 40000000
-max_output = 100
+max_output = 1500
def handle_input(_path, _account_id, _password):
lines.append(line)
if len(lines) > 0:
handle_transaction(lines, _path, _account_id, _password)
- print('Transaction is accomplished.Please check accomplished.txt')
+ print('Transactions are completed.Please check completed.txt')
def handle_transaction(lines, _path, _account_id, _password):
txid = data['tx_id']
if txid:
print('transaction_id:\n' + txid)
- lines = append_txid_to_lines(lines, txid)
write_lines_to_file(lines, _path)
else:
print('Sign transaction is failed.Please check account password.')
return httprequest.post('submit-transaction', parameter)
-def append_txid_to_lines(lines, txid):
- for i in range(len(lines)):
- # lines[i] = lines[i] + ',' + txid + '\n'
- lines[i] = lines[i] + ',' + '\n'
- return lines
-
-
# write complete transactions lines to file
def write_lines_to_file(lines, _path):
- _path = os.path.abspath(os.path.dirname(_path)) + os.path.sep + 'accomplished.txt'
+ _path = os.path.abspath(os.path.dirname(_path)) + os.path.sep + 'completed.txt'
with open(_path, 'a', encoding='utf-8') as file:
- file.writelines(lines)
+ file.write('\n'.join(lines) + '\n\n')
# control_address action
splits = line.strip().split(',')
validate_address(line, splits[0])
validate_amount(line, splits[1])
+ print('Transactions address and amount are valid')
return file_path, account_id, password
--- /dev/null
+import sys
+import httprequest
+
+
+def create_address():
+ address_list = list()
+ for i in range(1000):
+ parameter = {'account_alias': 'alice', 'account_id': '0F0CFLG7G0A08'}
+ data = httprequest.post('create-account-receiver', parameter)
+ address_list.append(str(data['address']).strip() + ',100000000')
+
+ path = '/Users/john/Desktop/btm.txt'
+ with open(path, 'a', encoding='utf-8') as file:
+ file.write('\n'.join(address_list) + '\n')
+
+
+if __name__ == "__main__":
+ sys.exit(create_address())
def post(endpoint, parameter):
headers = {'Content-Type': 'application/json'}
- data = json.dumps(parameter)
try:
- request = requests.post(host + '/' + endpoint, headers=headers, data=data)
+ request = requests.post(host + '/' + endpoint, headers=headers, json=parameter)
except Exception as e:
print(str(e) + '\n'
+ 'Connection error:Make sure bytomd run at http://localhost:9888 before you run this script.')