forked from spipm/crackcoin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
crackcoin.py
46 lines (30 loc) · 881 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
#!/usr/bin/python
import crackcoin
import crackcoin.wallets
import crackcoin.transactions
commands = {'q':'quit', 'h':'help', 'b':'broadcast', 't':'transaction', 'i':'information'}
if __name__ == "__main__":
crackcoin.network.startNetworking()
crackcoin.miner.startMining()
while True:
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 Exception as e:
print "Exception in main: " + e.message
break
crackcoin.network.stopServer = True
crackcoin.miner.stopMiner = True
crackcoin.threader.waitForThreads()