We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent d6ab438 commit 6ee3d9eCopy full SHA for 6ee3d9e
blockchain/proof_of_work.py
@@ -1,11 +1,12 @@
1
import hashlib
2
import time
3
4
+
5
def proof_of_work(difficulty: int) -> int:
6
"""
7
Simulates a Proof of Work mining process.
8
- The miner must find a nonce such that the hash of the nonce starts
9
+ The miner must find a nonce such that the hash of the nonce starts
10
with a specific number of leading zeros (difficulty).
11
12
Args:
@@ -19,7 +20,7 @@ def proof_of_work(difficulty: int) -> int:
19
20
>>> isinstance(result, int)
21
True
22
- prefix = '0' * difficulty
23
+ prefix = "0" * difficulty
24
nonce = 0
25
start = time.time() # Timing starts
26
0 commit comments