Live data from Hacker News

Show HN: An educational blockchain implementation in Python

github.com

11–20 of 44 posts

Re: Show HN: An educational blockchain implementation in Python

#11
FYI: Great blockchain (from sratch) starter article. At the Awesome Blockchains page [1] I collect starter blockchains and articles (in Python, Ruby, JavaScript, etc.) the idea is the best way to learn about blockchains is to do-it-yoursef - build your own blockchains from scratch. Great example. Keep it up. Cheers. [1] https://github.com/openblockchains/awesome-blockchains

Re: Show HN: An educational blockchain implementation in Python

#12
post #5
post #3

Very good writeup that shows all the steps. Note it uses MD5 hash instead of SHA256 so not exactly bitcoin. I wonder how much more work would be to make the code fully implement bitcoin. Will it still be readable? Or Etherium? Would be great value for understanding even if Python would be inefficient to run in prod.

Fully implementing Bitcoin white paper would require moderate amount of work if you do not consider every little detail related to security of your client code. However, current Bitcoin protocol added many features such as scripting. I think one can maintain code readability in a python implementation but documentation is the key here. Developer needs to clearly state the objective of each function. For ethereum, you…

Bitcoin has had scripting since that first release TX signatures themselves are OP_SIGHASH

Re: Show HN: An educational blockchain implementation in Python

#13
post #7
post #5

Earlier quoted context omitted.

Fully implementing Bitcoin white paper would require moderate amount of work if you do not consider every little detail related to security of your client code. However, current Bitcoin protocol added many features such as scripting. I think one can maintain code readability in a python implementation but documentation is the key here. Developer needs to clearly state the objective of each function. For ethereum, you…

I've been ignoring bitcoin for a while. Do the devs still maintain the official implementation is the only implementation possible since it contains quirks the spec doesn't specify?

Yup, though a group got fed up with that and forked to create Bitcoin Cash which has a spec and multiple teams and implementations. Much healthier situation.

Re: Show HN: An educational blockchain implementation in Python

#14
This is great. Just last weekend I did the same thing, coding a very basic blockchain in Python for educational purposes. You tackled wallets, which I didn't get to yet, so that was really helpful.

I'm still a little unsure around exactly how miners and nodes communicate with each other. Especially things like broadcasting transactions and new blocks. Any good resources for that?

Re: Show HN: An educational blockchain implementation in Python

#18

Why is this all contained in one big json document? Am I that out of touch with modern coding??

What the author wrote is a IPython / Jupyter notebook [0], which is implemented as a JSON document [1]. The notebooks are pretty much markdown with runnable code blocks in between.

Jupyter notebooks are popular in the data science / Python communities to explain concepts, for examples see here [2].

[0] https://jupyter.org/

[1] https://ipython.org/ipython-doc/3/notebook/nbformat.html

[2] https://github.com/jupyter/jupyter/wiki/A-gallery-of-interes...

Re: Show HN: An educational blockchain implementation in Python

#20
post #4

> It is NOT secure neither a real blockchain and you should NOT use this for anything else than educational purposes. It would be nice if non-secure parts of implementation or design were clearly marked. What's the point of education article, if bad examples aren't clearly marked as bad? If MD5 usage is the only issue, author could easily replace it with SHA and get rid of the warning at the start. If there are other…

[deleted]
Post reply on HN