The boring work

IC20067I have kept working all these days but it is rather boring stuff. For instance the serialization of classes. That is code which takes a C++ class and converts it to a string of 1s and 0s that can be sent over the network or saved to disk. The old MicroCash code I’m working on already had a serialization implementation but I wanted something different. The old one was inspired by Bitcoin and even though it had improved on that one by handling the edge cases it was more verbose than I thought it could be.

So I spent some time researching what others are doing and came up with my own implementation. The main difference with mine is that there is about 66% less code which should make it easier to understand and change in the future. For some reason Boost seems to use templates for its serialization classes but I did it using inheritance instead. A base CSerialization class which CSerializationWrite and CSerializationRead inherit. Then a class simply needs to export a single Serialize function using the base class and thats it. Of course I had to use some templated code in the actual CSerialization class but it’s the bare minimum and easy to understand. One BIG problem C++ has is that it is VERY easy to write code which is so advanced it takes hours to fully understand. I don’t like doing that and for an open source project like MicroCash you definitely do not want hard to understand code.

I have also reworked the UINT80 class which was using a UINT64 and UINT16 to form an 80bit integer which was used for MicroCash addresses. Instead I made a generic 64bit integer class which can be any size over 8bytes and as fast as is possible for what MicroCash uses. This has another benefit in that I can now use a UINT256 class to store public and private keys which will clear up a few opaque pointers I had added. I am pretty amazed that right now the codebase is so easy to read and make changes to, it is my best project yet I believe. However I want to thank Realsolid for giving me a good blueprint with the original sources.


2 thoughts on “The boring work

  1. Notyep says:

    Efficiency is always a good thing! These improvements behind the scenes are going to pay big dividends down the road!


Comments are closed.

%d bloggers like this: