-
Notifications
You must be signed in to change notification settings - Fork 2
/
send_csv.py
69 lines (53 loc) · 2.21 KB
/
send_csv.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
import time
import sys
"""
Call send_nogui.py (edit not to require manual confirmation)
for each address to pay.
rewards.csv is to be in the same dir.
format is one payout per line, comma separated, address,amount,extra
```25125e9bb305fafd51ceb2858d355f77da99550b933ec0923cd156ff,1310.4750655411829,5111
8f2d03c817c3d36a864c99a27f6b6179eb1898a631bc007a7e0ffa39,603.0595488461871,2352
0fc9b60126b8b5be3ab990eea6f184b02c1c0c5352709d023256ca58,459.7303448474547,1793```
Amount really sent will be reduced by the tx fee, 0.01
NO SAFETY there, be sure what you do.
The node has to be running with mempool on disk, not on ram or send_nogui does not work!!!
"""
import argparse
import os
__version__ = "0.0.1"
SEND_PATH = "send_nogui_noconf.py" # path to modified send_no_gui.py in the Bismuth Dir.
# That node has to be running with mempool on disk, not on ram!!!
PYTHON_EXECUTABLE = "python3"
parser = argparse.ArgumentParser(description='Bismuth Batch reward sender')
# parser.add_argument("-v", "--verbose", action="count", default=False, help='Be verbose.')
parser.add_argument("-y", "--yes", action="count", default=False, help='Do send')
parser.add_argument("-w", "--wallet", help='Path to wallet, use quotation marks')
parser.add_argument("-i", "--interval", help='Interval between txs')
args = parser.parse_args()
print(sys.argv[3])
if not sys.argv[4]:
interval = 1
else:
interval = sys.argv[4]
total = 0
nb = 0
with open("rewards.csv", "r") as rewards_file:
for line in rewards_file:
data = line.strip().split(',')
print(data)
if len(data) > 1:
try:
total += float(data[1])
data[1] = float(data[1]) - 0.01
command = f"{PYTHON_EXECUTABLE} {SEND_PATH} {data[1]} {data[0]} {None} {None} {sys.argv[3]} " #arguments are passed here
if args.yes:
print(f"Running: {command} tx")
os.system(command)
else:
print(f"Check: {command}, didn't you forget the magic word?")
sys.exit(0)
nb += 1
time.sleep(interval)
except Exception as e:
print(e)
print(f"{nb} Transactions, {total} $BIS total.")