This is very impressive, but I’ll be honest, I wouldn’t want to expose any new software written in C to the internet.
Show HN: Mako – a full Bitcoin implementation in C
11–20 of 129 posts
Re: Show HN: Mako – a full Bitcoin implementation in C
#12Some of this C code looks extremely obfuscated. Not a fan.
Re: Show HN: Mako – a full Bitcoin implementation in C
#13One question, in src/crypto/rand.c:25 you have a standalone RNG but comments say it is not used internally? what is it used for?
Re: Show HN: Mako – a full Bitcoin implementation in C
#14Some of this C code looks extremely obfuscated. Not a fan.
Do you mind elaborating? I obsess over clean code, so any criticism is appreciated.
Yep, it shows.
I got curious over the GP's comment, and I spot checked json.c[1] and json.h[2].
They're cleanly written, your data structures reflect your use and I can get an idea of what does what through the code alone.
Trying to figure out what could be considered obscure. For example would
if (!btc_amount_import(&x, obj->u.string.ptr))
return 0;
be considered obscure? Cause if you know the structure of a json_value, then you get what the phrase says.Well thought out and cleanly written code, I'd say.
[1] https://github.com/chjj/mako/blob/master/src/json.c
[2] https://github.com/chjj/mako/blob/master/include/mako/json.h
Re: Show HN: Mako – a full Bitcoin implementation in C
#15This is very impressive, but I’ll be honest, I wouldn’t want to expose any new software written in C to the internet.
Re: Show HN: Mako – a full Bitcoin implementation in C
#16I’m loving the well commented and standalone inplementations of crypto-primatives, will definitely be studying these. One question, in src/crypto/rand.c:25 you have a standalone RNG but comments say it is not used internally? what is it used for?
I originally wanted to vendor my libtorsion code and link to it, but it felt clunky since libtorsion pulls in a ton of crypto that bitcoin doesn't need. Also, since I was focusing on just a few algorithms, it gave me the opportunity to optimize a lot of them (in particular, the ECC backend was optimized for secp256k1 whereas in libtorsion it supports all kinds of curves).
Because of all of this, there's probably some leftover comments. That comment isn't true anymore. rand.c is definitely used internally for libmako, just not libtorsion.
edit: fixed link.
Re: Show HN: Mako – a full Bitcoin implementation in C
#17This looks like a herculean effort over just the past few months. Congratulations on hitting this milestone and hopefully you can take a breather and tie up loose ends at a more comfortable pace. As much as HN has changed over the years I still think this is a place where there are a lot of people who can appreciate how you feel right now. Nicely done!
Re: Show HN: Mako – a full Bitcoin implementation in C
#18Re: Show HN: Mako – a full Bitcoin implementation in C
#19Cloned and built on my Mac without any issues. Everything compiled and linked without warnings. A huge plus in my opinion. Other than stating that it builds two executables, there doesn't seem to be any documentation on using it. Did I miss it?
So, for example, `$ makod -datadir=foobar -chain=testnet` will create a data directory in `./foobar` and start syncing testnet.
`$ mako getblock 100 2 -chain=testnet` will return block #100 to you serialized as json.
In other words, it's something akin to this:
https://man.archlinux.org/man/bitcoind.1
https://man.archlinux.org/man/community/bitcoin-cli/bitcoin-...
Please let me know how things go on Apple. I have yet to test it on a Mac. It's possible Mac has some issues since the event loop backend is using poll(2). Apple has been known to break poll every now and then.