Show HN: Misocoin – A barebones Bitcoin-like protocol implemented in Python 3.6
github.com
github.com
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.
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.
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.
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.
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.
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.
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).
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?
> 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.
So a bridge server.
It’s tho in production use and many people like the project cause it’s a full node implementation.