Saving and loading data

MicroCash at its simplest is just a chain of transactions which makes disk access quite simple. Simply serialize the transactions to disk and load them back when required. Today I began the code which does the actual loading and saving of the data, which is a bit more complicated than it should be due to the fact I have to code a platform independent version of it.

Most people when doing disk access in C++ use something like Boost or the basic C/C++ library functions. The unfortunate part of this is that some platforms don’t properly support UNICODE in the basic libraries and have quite weird issues. So the work-around is to code your own using the native API when appropriate, which is a bit more work and requires a bit more knowledge of the systems you want to target.

MicroCash also needs some code to handle directories, services and things of this nature so I have moved all platform dependent code into a single source file to make it easy to port to any platform. On Windows MicroCash will support being installed as a service or called from the command line. On Linux it will run similar to Bitcoin through command line access. Instead of doing a bloated Qt client which would make compiling MicroCash way more difficult you’ll simply be able to use your web browser to access a graphical client.

Currently MicroCash easily compiles on any platform which has a C++11 compiler (GCC, MSVC, etc) and requires zero other libraries, everything has been custom coded which makes looking at the source, compiling it, debugging it, so much more simpler compared to Bitcoin and other cryptocurrencies.

Back to the point of this post…… with disk saving and loading I can then begin work on the transaction engine which shouldn’t take very long at all. Like I showed before you can actually have multiple MicroCash “Networks” running in the same application due to my design you just have to give each one a different data directory like this.

CMicroCash mc1(“./test1”);
CMicroCash mc2(“./test2”);

mc1.StartNetwork(400);
mc2.StartNetwork(401);

IPV6Endpoint endpoint;
endpoint.SetLocalHost(400);
mc2.ConnectToNode(endpoint);

The above code starts 2 MicroCash services, each listening on a separate port and saving/loading the data from different directories. I then connect one to the other over UDP and from then on they stay in contact with one another. It makes it very easy to test certain edge scenarios and ways to streamline the network communication and disk access. It is one reason I will be able to release MicroCash much faster and hopefully with little or no bugs. 🙂

Advertisements

4 thoughts on “Saving and loading data

  1. roméo says:

    About the new blog design, i prefer the oder one.

    But what i think is too much is the “fascist” in the tittle
    If you develop an alternative, it’s already implied you do’nt like the current system. Addind it make it too loaded and can repulse some people

    Like

  2. Notyep says:

    What I got from the original post was a lot of “passion” behind the words (besides, MC is certainly a game changer when it comes to traditional banking… 😉

    Like

Comments are closed.

%d bloggers like this: