r/learnpython • • 2d ago

I built a mini blockchain in Python - Feedback welcome

I'm 19, studying computing in college. I built this to understand how blockchains work.

Repo https://github.com/h4rl0/mini-chain

What it does

-Genesis block, chain of blocks linked by SHA-256 hashes

-Proof of work with adjustable difficulty

-Chain validation

-Flask API with CORS enabled so a front end can talk to it

Built with

Python, Flask, flask-cors, requests, hashlib

What I'd like feedback on

-Is the code structure okay, or could it be improved

-Anything I may have gotten wrong

-What I could add next

0 Upvotes

4 comments sorted by

1

u/mopslik 2d ago

What I could add next

Type hints (see PEP484) and docstrings (see PEP257 and PEP8).

1

u/h4rln 1d ago

Thank you, ill start adding them today.

-1

u/[deleted] 2d ago

[removed] — view removed comment

1

u/h4rln 1d ago

Thank you very much! I’ve fixed my typo and after work ill get working on the rest of it. I appreciate you taking the time to help.