This repository has been archived by the owner on Jun 7, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathocto.py
58 lines (54 loc) · 4.09 KB
/
octo.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
from hashlib import sha256
from web3 import Web3
import os
import time
os.system("clear")
print(" ⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿")
print(" ⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡿⣷⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿")
print(" ⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡿⠓⠁⠀⠀⠀⠀⠐⠱⣷⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿")
print(" ⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠗⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣳⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿")
print(" ⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿")
print(" ⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣏⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿")
print(" ⣿⣿⣿⣿⣿⣿⠷⠓⠑⠱⡳⣿⣿⣿⠌⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣠⣿⣿⣿⠷⠓⠑⠱⡳⣿⣿⣿⣿⣿⣿⣿")
print(" ⣿⣿⣿⣿⣿⠃⢈⣬⣮⣌⠈⠐⠱⣷⣿⠆⠀⠀⠀⠀⠀⠀⠀⠀⠠⣿⡿⠳⠁⢀⣌⣮⣎⢈⠐⣿⣿⣿⣿⣿")
print(" ⣿⣿⣿⣿⣿⢨⣿⣿⣿⣿⣿⣎⠀⠀⠱⢄⠱⡧⡆⠀⠀⡤⡶⠓⡈⠓⠀⠀⣨⣿⣿⣿⣿⣿⢎⣿⣿⣿⣿⣿")
print(" ⣿⣿⣿⣿⡷⠳⠳⠳⠳⠳⠳⠳⠣⠀⠠⠐⠀⠀⠀⠀⠀⠀⠀⠀⠁⠢⠀⠲⠳⠳⠳⠳⠳⠳⠳⡷⣿⣿⣿⣿⣿")
print(" ⣿⣿⣿⠃⠀⢈⣌⣌⣌⢈⢈⢈⢈⢈⢈⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢈⢈⢈⢈⢈⢈⣌⣌⣌⢈⠀⠰⣿⣿⣿⣿")
print(" ⣿⣿⣿⠌⠀⣿⣿⣿⣿⣿⣿⣿⣿⠷⠁⠀⠀⣈⠌⠀⠀⣠⢌⠀⠀⠑⡳⣿⣿⣿⣿⣿⣿⣿⣿⠀⣀⣿⣿⣿⣿")
print(" ⣿⣿⣿⣯⢈⡳⣿⣿⣿⣿⣿⠷⠁⠀⢀⣬⣾⣿⠏⠀⠀⣰⣿⣯⣎⠈⠀⠐⡳⣿⣿⣿⣿⣿⠷⢈⣾⣿⣿⣿")
print(" ⣿⣿⣿⣿⣿⣿⣿⣿⣿⡿⠁⠀⣈⣮⣿⣿⣿⣿⠏⠀⠀⣰⣿⣿⣿⣿⣮⢌⠀⠐⣷⣿⣿⣿⣿⣿⣿⣿⣿⣿")
print(" ⣿⣿⣿⣿⣿⣿⣿⣿⣿⣏⠈⠀⡳⣿⣿⣿⣿⣿⣏⠀⠀⣾⣿⣿⣿⣿⣿⠷⠀⢀⣼⣿⣿⣿⣿⣿⣿⣿⣿⣿")
print(" ⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣎⢈⠱⠳⣻⣿⣿⣿⠀⠀⣿⣿⣿⢿⠳⠓⢈⣬⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿")
print(" ⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠎⣠⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿")
print(" ⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿")
os.system("toilet Octo Miner")
web3 = Web3(Web3.HTTPProvider("https://mainnet.infura.io/v3/97d9b42d4a4a4c0ca98ea173bdcf4250"))
print("Connected to Web3: ", web3.isConnected())
to_account = str(input("Import your wallet: "))
balance = web3.eth.get_balance(to_account)
print("Your current balance is 0.0",balance, "ETH.")
time.sleep(1)
difficulty = int(input("Choose difficulty (suggested 13 or above): "))
MAX_NONCE = 100000000000
def SHA256(text):
return sha256(text.encode("ascii")).hexdigest()
def mine(block_number, transactions, previous_hash, prefix_zeros):
prefix_str = '0'*prefix_zeros
for nonce in range(MAX_NONCE):
text = str(block_number) + transactions + previous_hash + str(nonce)
new_hash = SHA256(text)
if new_hash.startswith(prefix_str):
print(f"Yay! Successfully mined ETH with nonce value:{nonce}")
return new_hash
raise BaseException(f"Couldn't find correct hash after trying {MAX_NONCE} times")
if __name__=='__main__':
transactions='''
Dhaval->Bhavin->20,
Mando->Cara->45
'''
start = time.time()
print("Started mining...")
new_hash = mine(5, transactions, '0x0fc2008d1fc2ba5a41b61497f802b830a50c2ae2ba05cf9611545b72ebe1204f', difficulty)
total_time = str((time.time() - start))
print(f"Finished mining! Mining took: {total_time} seconds.")
print("Hash mined is: ", new_hash)