Hacker News new | comments | show | ask | jobs | submit login
Show HN: Misocoin – A barebones Bitcoin-like protocol implemented in Python 3.6 (github.com)
151 points by kendrick__ 7 months ago | hide | past | web | favorite | 18 comments



FYI, I think I see you using the P-256 curve in this project.

Word of warning, this is not Bitcoin's curve. This is a NIST curve.

The library you're using (fastecdsa) has secp256k1 available to use, if that's what you want to do.


Yes, it looks like this (and other differences) is why it's called a "Bitcoin-like" project. It also runs over HTTP instead of plain TCP/IP, so it can't be used as a Bitcoin node anyway (and there are numerous other differences).

But it's a nice example of a Bitcoin-like project, and manages to get the main ideas of Bitcoin in as an educational project.


The P-256 curve is rated as unsafe by https://safecurves.cr.yp.to/ .


I know, hence the 'bitcoin-like' title :-)


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.


> 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.


Cool project. It seems like the only way for nodes to mine on the same chain is for them each to use different ports. I tried to use different IPs on the same port, and it didn't work.


I guess its because the library I'm using is rpc over HTTP instead of TCP/IP :(


Awesome project!

Your cat looks like mine :)

Also, for the JavaScript fans: http://bcoin.io/ it's actually a full node implementation that can run in the browser (can if you have time and space for the blockchain).


How would that work? The Bitcoin network runs over TCP/IP, and you can't run raw TCP/IP connection over browsers.

I assume there is some kind of bridge server, or supernode, to allow the browser node to connect (via websocket?) to the actual Bitcoin network?


> Having a node set-up will allow you to more easily test and query the RPC/REST API, and begin monitoring new transactions added to the bitcoin blockchain/mempool.

> The default bcoin HTTP server listens on the standard RPC port (8332 for main, 18332 for testnet, 48332 for regtest, and 18556 default for simnet). It exposes a REST json api, as well as a JSON-RPC api.

Seems bcoin doesn't connect you directly, but rather to a node they're running elsewhere.


> It exposes a REST json api, as well as a JSON-RPC api.

So a bridge server.


I can’t answer that question, it does implement server and client and the demo does try to download the whole blockchain on your browser (I’m not sure who has the bandwith to play with that demo)

It’s tho in production use and many people like the project cause it’s a full node implementation.


Ugh I cannot find the demo, I think it might be a different project :/ I can only see the nodejs node.


Sounds a lot like me so horny, mi so coin... just the name already, oozes trust... </sarcasm>




Guidelines | FAQ | Support | API | Security | Lists | Bookmarklet | Legal | Apply to YC | Contact

Search: