-
Notifications
You must be signed in to change notification settings - Fork 64
/
crackcoin.py
52 lines (35 loc) · 979 Bytes
/
crackcoin.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
#!/usr/bin/python
import crackcoin
import crackcoin.wallets
import crackcoin.transactions
commands = {'q':'quit', 'h':'help', 'b':'broadcast', 't':'transaction', 'i':'information'}
running = True
if __name__ == "__main__":
crackcoin.network.startNetworking()
crackcoin.miner.startMining()
while running:
try:
ui = raw_input("> ")
if ui == 'q':
break
if ui == 'h':
for c in commands:
print "%s: %s" % (c, commands[c])
if ui == 't':
to = raw_input("To: ")
amount = raw_input("Amount: ")
crackcoin.transactions.createTransaction(to, amount)
if ui == 'i':
crackcoin.wallets.printBasicInfo()
if ui == 'b':
crackcoin.network.broadcastSync()
except KeyboardInterrupt:
print "Exiting ..."
running = False
break
except Exception as e:
print "Exception in main: " + e.message
break
crackcoin.network.stopServer = True
crackcoin.miner.stopMiner = True
crackcoin.threader.waitForThreads()