Living the Simple Life with Recursive Parsing and Serialization

Hey <<First Name>>,

This past week I published an article on a major refactor I recently pushed to my in-progress Bitcoin node. The article is titled Living the Simple Life with Recursive Parsing and Serialization, and goes into the nuts and bolts of the changes I made.

I’ve been fiddling with this refactor for weeks, so it’s a relief to be done and back up to feature parity with where I was originally at:

The basic idea that that each of the messages I needed to serialize and parse from the Bitcoin network protocol was composed of smaller sub-structures. Ultimately, those sub-structures were composed of typed values with specific parsing and serialization rules. Instead of manually parsing and serializing each high-level message, I could describe its structure in terms of sub-structures and types, and recursively parse or serialize those.

After posting the article to, Liberza commented and linked to a Github project showing how they managed to implement a similar idea using nested keyword lists. I highly recommend checkout out their code. I especially like the use of macros to auto-generate pattern matching function heads.

Friendlysock also commented and said that they’d prefer to see more function-level pattern matching. I’ve been down that road, and I wasn’t happy with the aesthetics or maintainability of the final solution.

What do you think?

Also, Pinegrove finally released their newest album on Friday and I’ve been listening to it non-stop. Definitely check it out, and if you’ve never heard of the band, check out this Audiotree set that first got me hooked.
Copyright © 2018 East5th, All rights reserved.

Want to change how you receive these emails?
You can update your preferences or unsubscribe from this list