Hacker News new | ask | show | jobs
by Lambdanaut 3120 days ago
Very cool! I've been working on a similar project every so often(https://github.com/lambdanaut/lambdacoin). I'm not as far along as you are, but so far it seems like creating a cryptocurrency from scratch is not really all that big of a project, at least getting it into a prototypical state.

I was delighted to find that much of the math logic is already handled by libraries such as pycrypto.

It's funny to me how similar our codebases look. Especially our classes such as `Block` and `Transaction`. We each have to_json and from_json methods as well, in order to serialize the data for propagation.

2 comments

> It's funny to me how similar our codebases look.

To me, your codebases don't look very similar at all, except for the fact that you're both coding mini-Bitcoin nodes, so there will be inevitable similarities.

Edit: Not trying to be rude, but I'm never sure what people are suggesting when they say "hey, your codebase looks like mine!". Perhaps just an innocent remark, but otherwise, I just wanted to point out that the two codebases are quite different.

Just curious as to how you got started into this? Are there any references you'd recommend. I have a typical Web dev background(+ some machine learning from college). Been investing in crypto for a bit and would love to learn and implement some basic blockchain concepts on my own. I've also been looking at Solidity.
Really it's just a lot of googling and looking for good tutorials that explain how the Bitcoin protocol works. Whenever you hit a concept you don't understand, google it.

The Bitcoin Developer Documentation is gold: https://bitcoin.org/en/developer-documentation

Start by defining your basic objects, and then begin adding their methods, just like you would any sort of program. The basic objects here are the Blockchain, Transactions, and a Client to interact with the chain. The rest is just implementing rules for how these objects work together.

There's an old Bitcoin in Python project called ArtForz's Bitcoin "half-node" (or maybe "half-a-node") which is a compressed, single file, easy-to-follow simplified Bitcoin node. No wallet functions, just the basic networking and validating.

Actually, I found a copy here: https://pastebin.com/ZSM7iHZw

It's public domain, and it may help you figure things out (it did for me).

The main hurdle is understanding the message types: https://en.bitcoin.it/wiki/Protocol_documentation#Message_ty...

Once you understand these, it's pretty much all serializing, deserializing, validating, and passing these around over TCP/IP sockets. And then building the chain. And then adding wallet functions.

It's been a while since I've done this so now I'm thinking of building another one in some new language.