BasicCoin, a cryptocurrency in less than 600 lines of Python
github.com
github.com
- Ledger is a file in a Git repo
- Blocks are confirmed by committing them with a SHA1 with sufficiently many leading zeros (adjust a nonce in the commit msg until it fits)
- Some bot accepts all pull requests into the Github repo that are fast-forward and whose commits have sufficiently many leading 0s (possibly after confirming that the booking is valid ;)
We could call that... oh I don't know, DvcsCoin or so.
Perfect name.
Knowing HN this is gonna be a show HN in a couple of days and rewritten in 10 lines of js a week after that.
The blockchains deliver trusted communication of stored work to us. The network has value in and of that function alone. That I can verify you have thing of X value and I have thing of Y value and that the ratio of X to Y is such as established by these market APIs/feeds. Which themselves are running on a trusted computing platform that is a fair and accurate representation of what is what in this world, up to a point.
That there will be a million blockchains working together in a mishmash of interconnected markets, is no more difficult than imagining a million seperate computer networks, each of which is using a private address block 10.0.0.0/24. Some things are meant to be highly distributed, some are not.
Why would you ever expect a cryptocurrency based on the thesis of high distribution to ever be a singleton itself?
[0]: http://sourceforge.net/p/bitcoin/mailman/message/32108143/
[1]: https://www.mail-archive.com/bitcoin-development@lists.sourc...
Of course, being written in a dynamic interpretive language goes against that.
I am not trying to do it in the minimal lines possible. It just happens to be that short.
You have 7 very sensible, and indeed admirable, style guidelines and while no line breaks only clearly violates one of them (PEP8), it's not really in the spirit of the others either. I opened gui.py and immediately was overwhelmed, rather than compelled to dive in and digest your small codebase.
Off the top of my head:
1.) There's no reason not to use newlines. They have no chance of introducing bugs in any reasonable language and they aid readability.
2.) You're using closures all over place and I haven't checked every occurrence, but I strongly suspect that almost all of them are unnecessary and unhelpful. Closures are not free in terms of code complexity. Use them only when necessary.
2) Some people group similar functions into classes. I dislike classes and prefer grouping code this way.
Wat.
A single file / pip install write into setup.py and you are good to go.
This I consider as educational, which I assume is the case by the desire to go smaller and implementing such socket server.
That means that, barring a huge design change in Bitcoin itself, the core client has to support every single feature ever implemented in Bitcoin, no matter how half-assed or poorly thought out.
That's why things like the way P2SH got implemented really grind my gears. Bitcoin has a few idiosyncratic and unintuitive design additions that make it really hard to make simple clients.
There has to be some place(s) online where peers register their existence, to find others to connect with.
Near as I can tell, this app doesn't have a feature for this yet. I'd argue it isn't a cryptocurrency unless there's a mechanism for finding other peers included in the code.
(That said, this is still an awesome proof of concept, and I'm going to work through all the source code carefully.)