https://github.com/etaaa/queue-it-proof-of-work-python
A Python solution for Queue-it's Proof-of-Work challenge.
https://github.com/etaaa/queue-it-proof-of-work-python
proof-of-work python queueit
Last synced: 6 months ago
JSON representation
A Python solution for Queue-it's Proof-of-Work challenge.
- Host: GitHub
- URL: https://github.com/etaaa/queue-it-proof-of-work-python
- Owner: etaaa
- License: other
- Created: 2022-04-20T08:50:01.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2022-12-04T16:27:41.000Z (almost 3 years ago)
- Last Synced: 2023-03-21T22:57:48.672Z (over 2 years ago)
- Topics: proof-of-work, python, queueit
- Language: Python
- Homepage:
- Size: 3.91 KB
- Stars: 11
- Watchers: 1
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Queue-it Proof-of-Work
A Python solution for Queue-it's Proof-of-Work challenge ().
## Usage
Usage:
```python
import base64, hashlib, jsondef solveChallenge(input, zeroCount):
zeros = "0" * zeroCount
postfix = 0
while True:
postfix += 1
stri = input + str(postfix)
encodedHash = hashlib.sha256(stri.encode()).hexdigest()
if encodedHash.startswith(zeros):
x = 10 * [{ "hash": encodedHash,"postfix": postfix }]
return base64.b64encode(json.dumps(x, separators=(',', ':')).encode()).decode()
# GET THESE VALUES FROM THE RESPONSE WHEN FETCHING
# THE CHALLENGE AT .../challengeapi/pow/challenge/...
input = "f02b931c-52f0-4507-9406-f1221678dc16"
zeroCount = 2
# RETURNS THE CHALLENGE SOLUTION
solution = solveChallenge(input, zeroCount)
print(solution)
```## Questions
For any questions feel free to add and DM me on Discord (eta#1656).## Contributing
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change. Please make sure to update tests as appropriate.## License
[MIT](https://choosealicense.com/licenses/mit/)