Husnain
commited on
Commit
•
6cad06d
1
Parent(s):
8e9ecf2
Update proof_worker.py
Browse files- networks/proof_worker.py +16 -0
networks/proof_worker.py
CHANGED
@@ -1,3 +1,5 @@
|
|
|
|
|
|
1 |
import random
|
2 |
from datetime import datetime, timedelta, timezone
|
3 |
from constants.headers import OPENAI_GET_HEADERS
|
@@ -26,7 +28,21 @@ class ProofWorker:
|
|
26 |
OPENAI_GET_HEADERS["User-Agent"],
|
27 |
]
|
28 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
29 |
if __name__ == "__main__":
|
30 |
worker = ProofWorker()
|
31 |
config = worker.get_config()
|
32 |
print("Config:", config)
|
|
|
|
|
|
|
|
1 |
+
import base64
|
2 |
+
import json
|
3 |
import random
|
4 |
from datetime import datetime, timedelta, timezone
|
5 |
from constants.headers import OPENAI_GET_HEADERS
|
|
|
28 |
OPENAI_GET_HEADERS["User-Agent"],
|
29 |
]
|
30 |
|
31 |
+
def calc_proof_token(self, seed: str, difficulty: str):
|
32 |
+
config = self.get_config()
|
33 |
+
diff_len = len(difficulty) // 2
|
34 |
+
for i in range(100000):
|
35 |
+
config[3] = i
|
36 |
+
json_str = json.dumps(config)
|
37 |
+
base = base64.b64encode(json_str.encode()).decode()
|
38 |
+
# You can modify the proof generation logic here as per your requirement
|
39 |
+
# For now, I'm just returning a placeholder string
|
40 |
+
return f"proof_token_for_{seed}_{difficulty}"
|
41 |
+
|
42 |
if __name__ == "__main__":
|
43 |
worker = ProofWorker()
|
44 |
config = worker.get_config()
|
45 |
print("Config:", config)
|
46 |
+
seed, difficulty = "0.42665582693491433", "05cdf2"
|
47 |
+
proof_token = worker.calc_proof_token(seed, difficulty)
|
48 |
+
print(f"Proof token: {proof_token}")
|