Development Update 2018-02-16

Hello Mighty Minters!

The price of MintCoin rose this week, with the long-standing 7 satoshi wall finally giving way and seemingly arriving at a comfortable new 10 satoshi wall. This of course makes us all happy, but you can follow market changes anywhere! What we really want is to dig into the details of the MintCoin technologies, right?

This week saw our intrepid MintCoin developer sick for a few days. Luckily this was not enough to prevent all progress being made on the wallet and other MintCoin technologies.

Capitalizing MintCoin

What's in a name? That which we call a mint
By any other word would smell as minty fresh;

- William Shakespeare if he was alive today, probably

While working on the coin it occurred to me that I saw MintCoin being called both "Mintcoin" and "MintCoin". After a short discussion Minty All Day mentioned that he preferred "mintcoin". In true democratic fashion, he put up a Twitter poll and let the Internet decide:

https://twitter.com/MintcoinTeam/status/963874560318717952

The results are clear: MintCoin (capital 'M', capital 'C') received 73% of the votes.

From this day forward, we will use MintCoin as the official capitalization for MintCoin.

Fix for Assertion Failure on Exit

The wallet was exiting with an assertion failure on shutdown:

mintcoind: /usr/include/boost/thread/pthread/recursive_mutex.hpp:113: void boost::recursive_mutex::lock(): Assertion `!pthread_mutex_lock(&m)' failed.

An assertion is a check that software developers sometimes add to programs to prevent them from doing something unexpected. If a user encounters them then it is a bug.

In this case, probably nothing was done for a long time because this happened when the program was shutting down so did not seem to cause any harm. I decided that any assertion failure is a cause for worry, and dug into the problem. You can follow the debugging here if you are curious for the details:

https://github.com/shane-kerr/Mintcoin-Desktop-Wallet/issues/6

The end result is that the wallet was temporarily forgetting about threads trying to connect to other nodes - on purpose - to allow the wallet to exit faster. Unfortunately this also ended up corrupting memory!

It is possible that this could have far worse impact than just a scary message, so I added a fix. The drawback is that the wallet can take up to 5 seconds to shutdown - a small price to pay to avoid running through invalid memory.

Pushing Fixes Upstream

I started the process of getting the fixes and other changes that I have been working on pushed upstream, into the official MintCoin repository on GitHub. Minty All Day is the gatekeeper, and has been cautious about merging changes without proper review. Right now that seems to be the limiting factor on getting new code into the MintCoin wallet.

If you can read C++ code, please contact Minty All Day or me (Shane Kerr) and we can figure out how to get a proper review.

Security Audit

I was approached by a couple of people who have done work with security audits of code. They said they would be willing to provide such an audit for the MintCoin codebase, which would be awesome. Keep your fingers crossed, and stay tuned!

Goal Recap

The main focus now is getting a new version of the wallet that we can publish which contains updated builds and all of the fixes that we can. In order for that to happen, we need:

  • Updated documentation
  • A Windows wallet build
  • A macOS wallet build
  • Merging the changes upstream (or forking the repository)

Things that would be nice:

  • ARM wallet build (for example, for Raspberry Pi)
  • A continuous integration (CI) environment
  • Updated DNS peer discovery
  • Speeding up the initial sync

Things that should be done someday:

  • Wallet code automated testing
  • Reducing the memory footprint

As always, if you would like to help, please either contact us or just fork the code on GitHub and start hacking.

Until next update, stay minty fresh!

Your Minty Pal, Shane Kerr

Copying

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.

Development Update 2018-02-09

Hello all, here is an update about what is going on in the Mint Development world.

MintCoin had its 4th birthday this week, and Minty All Day put some effort into some, well, completely crazy videos and other activities on this special day. MintCoin is a serious crypto-currency that doesn't take itself too seriously!

The MintCoin Development: Who and What?

Right now there are basically two people working on MintCoin developments, Enlil and myself. Enlil is focused on the operations side and I am focused on the software development. There are several people who are kibitzing on the work, but mostly that's it. I think we can and will make reasonable progress with even with such a small team, but of course we welcome anyone with time and skills to join the work.

MintCoin Explorer Website

The most visible and awesome thing to happen recently was the work Enlil has done on bringing up the MintCoin Explorer website:

https://mintcoin.zone/

In addition to the blockchain explorer, Enlil publishes several other things on the site:

  1. Regular snapshots of the MintCoin blockchain, suitable for bootstrapping the MintCoin wallet:
    https://snapshot.mintcoin.zone/MintCoin-Snapshot-Latest.zip

  2. List of active MintCoin nodes, useful for getting the initial connection to the MintCoin network:
    https://snapshot.mintcoin.zone/PEERS.txt

Code Hygiene Work

On the software side, we have made some progress, although we do not have a release yet:

  1. The code builds and runs on both modern and older versions of Linux. The OpenSSL library has changed, so in order to support older and newer versions a bit of trickery was needed. Also, the compiler for the C++ language that MintCoin was written in has updated to include a different standard, and that also required a bit of work.

  2. All warnings in the code base have been fixed (except for one that cannot be fixed on older systems because of C++ version complaints).

  3. Debug information has been added to the RPC calls used by the wallet, which should help Enlil and I track down some complaints that the block explorer is making.

For the first two changes, your best bet right now is to look at my (Shane's) repository on GitHub here:

https://github.com/shane-kerr/Mintcoin-Desktop-Wallet/tree/remove-warnings-2018-02-04

For the RPC change, there is a separate branch for that here:

https://github.com/shane-kerr/Mintcoin-Desktop-Wallet/tree/improve-rpc

Minting CPU Bug Fix

I noticed that the wallet was using a lot of CPU when I unlocked my wallet. I do not have any MintCoin old enough to mint, but the wallet was spending a lot of CPU anyway.

It took me a bit of time to track down, but basically the problem is that when trying to mint the wallet will make a new block. If there are no MintCoin old enough to mint, then it makes an empty block. The wallet then thinks that it is trying to do Proof-of-Work (PoW) mining, instead of Proof-of-Stake (PoS) minting, and looks for the most recent PoW block.

The reason this was causing a lot of CPU usage is that MintCoin had an early phase of Proof-of-Work for a few weeks, but has been 100% PoS for almost 4 years since then, making a new block every 30 seconds. It took almost 2 seconds for the code to search back through all of those PoS blocks to get back to the very last PoW block. Since minting is attempted every 0.5 seconds, we were using 80% of a CPU core just looking back through these old blocks!

Here's some ASCII-art to explain it.

At the beginning of MintCoin, everything was PoW and our blockchain may have looked something like this:

+-+  +-+  +-+  +-+
|W|<-|W|<-|W|<-|W|<-
+-+  +-+  +-+  +-+
 0    1    2    3

To find the newest PoW block, one simply looks at the end for the blockchain.

After the first coins were 20 days old, we started adding PoS coins:

+-+  +-+  +-+  +-+  +-+  +-+  +-+  +-+
|W|<-|W|<-|W|<-|W|<-|S|<-|W|<-|S|<-|S|<-
+-+  +-+  +-+  +-+  +-+  +-+  +-+  +-+
 0    1    2    3    4    5    6    7

Notice that we are mixing PoW and PoS and they are not necessarily in any kind of order. At this point to find the newest PoW block you have to skip any PoS blocks, say by going through block 7 and 6 and finally ending up at block 5.

So far so good.

Now fast-forward 4 years. We have not mined any PoW blocks for most of that time, and have 2 million or so PoS blocks. Our blockchain now looks like this:

+-+  +-+  +-+  +-+  +-+  +-+  +-+  +-+                          +-+  +-+
|W|<-|W|<-|W|<-|W|<-|S|<-|W|<-|S|<-|S|<- 2 million PoS blocks <-|S|<-|S|
+-+  +-+  +-+  +-+  +-+  +-+  +-+  +-+                          +-+  +-+
 0    1    2    3    4    5    6    7                                ~2M

Today to find the oldest PoW block we have to go back through all of those PoS blocks, which is where we are wasting time. A lot of time!

The "proper" way to fix this is to simply not try to mint if there are no coins old enough. However, because of the way the code is written this is a non-trivial change. So instead I introduced a hack so that the code would search back for the last PoS block once, and then use that every time after. The 2 second piece of code now takes less than 0.001 seconds.

I do not know whether this fix makes much difference once you have coins old enough to mint. Once my MintCoins mature in a couple weeks I will check. In any case, this bug would impact anyone who unlocks their wallet without any mature MintCoins (for example someone who wants to send coins somewhere), so it is a real problem.

This code is available in my GitHub repository here:

https://github.com/shane-kerr/Mintcoin-Desktop-Wallet/tree/speed-minting

GitHub Updates

In the last update I had a few short-term goals related to GitHub.

Merge Open Pull Requests

I had a look, and all of the open pull requests were from a single developer. After reviewing the first PR, I discovered a couple things:

  1. While the approach was interesting, it has some deep problems that need to be fixed before it can be used in the wallet.
  2. It is only related to some bootstrapping activity, and probably not useful for how many people use the wallet today.

I have asked the PR developer what they want to do going forward, but not heard any response. This is probably not too surprising considering how long ago the PR was made, but is still disappointing.

Probably what I will do is see if the technique presented makes sense going forward, and implement a version without the problems if so. Otherwise we may just have to close the PR and not merge the changes.

In the future we must be more active with our GitHub and make sure that people willing to help improve the wallet are given quick feedback and treated with respect.

Address Open Issues on GitHub

I reviewed all of the open issues, and one has been fixed with the build patches mentioned earlier. All of the others are problems getting the wallet to sync, which have been responded to.

I would like to close these, but I have no permissions to do so on the GitHub site. I would prefer not to have to move the MintCoin "official" development somewhere else, but without ability to either close issues or merge code, that may be the only option.

Things to Look Forward To

Documentation

The final short-term goal from the last update was documentation. There is no special reason that this needs to be updated by Enlil or myself, so if you are either somewhat technical or have experience writing or updating documentation we would love some help in this area.

Continuous Integration (CI)

Enlil has ideas on putting together a system to automatically build and test different versions of the wallet (a few flavors of Linux, plus Windows and macOS). This would be great, and would help our next release, which I hope will be in February sometime.

ARM CPU Support

The current MintCoin wallet code does not support ARM CPU, which means that you cannot (for example) run it on a Raspberry Pi or other single-board computer (SBC).

We found some old ticket where someone had been able to make this work, and we hope to integrate that into the main code base so that it is an easy option for people. We may even put together a Raspberry Pi image so that people can run a MintCoin wallet on a low-power device all the time.

Finding Peers with DNS

As mentioned in the last update we would like to make it so that the wallet automatically finds other wallets on the network without any hassle. We have an idea of how to set this up, but it will require a little infrastructure work as well as some code changes to use it. But it seems like something that is achievable in the near future.

Longer Term Work

Also as mentioned in the last update, we have a few things which we would like to do but have no specific plans for:

  • Speeding up the initial sync
  • Wallet code automated testing
  • Reducing the memory footprint

Minting for Fun and Profit

I am much happier about the shape of the wallet than a week ago, and am glad we have a few hands working on MintCoin. We can always use more; if you are technical and want to make MintCoin even better get in touch!

Copying

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.

Development Update 2018-02-01

Hello Minty Fresh Folks!

This is the first of what will hopefully be regular updates about the status of MintCoin software development. I promise nothing, since I am lazy and easily distracted, but here at least is a first step.

Origin Story, or What the Mint is up with the Wallet?

I had been looking at altcoins, thinking about diversifying. MintCoin caught my eye. Even though the web pages I found had an unintentionally "retro" look to them, I like a few things about MintCoin:

  • Proof-of-Stake means that we don't need to destroy the planet to have a working crypto-currency.
  • Not only does the coin have an actual working wallet and network, it has been around for several years (almost 4 now).
  • There is no company or group of investors behind the coin; it is strictly a community effort.

That is all great, but when I downloaded the binary of the wallet from GitHub it would not run on my Linux desktop. Even worse, when I tried to build it, it failed with scary compiler warnings.

I poked around the code, and discovered that the last commits were several months ago, and that there were long-standing pull requests waiting to be accepted or not. That is never a sign of a healthy project.

So I popped into the Telegram group chat and discovered that all of the previous developers have basically left the project. This is obviously not great as there are over 1800 people in the group chat and Cryptopia trades something like 8 to 10 BitCoin worth of MintCoin every day. Not a lot compared to rock-star crypto coins like Ethereum or Litecoin, but still a lot of money if you think about it.

Rebooting the MintCoin Wallet Development

Rather than be sad, we can fix the situation!

The idea is to reboot the MintCoin wallet development. Right now there is a Telegram group chat for people interested in this, separate from the main Telegram group chat since I guess not everyone is interested in the detailed discussions of C++ changes or git commit policies.

There are two schools of thought on the development now:

  1. Fix and improve the existing wallet, and
  2. Build an awesome new wallet!

My own feeling is that we probably do want to shift effort into making a new wallet eventually.

The current code base was forked from NovaCoin 4 years ago, which it appears was itself forked from a long-forgotten version of BitCoin Core. This is not necessarily bad, but since MintCoin has not tracked changes to the pre-fork code, it is very likely that there are bugs that have been fixed which we still have. This should make anyone concerned with security; any bug is a potential security problem.

Having said that, I am putting the current effort into fixing a few things with the existing wallet, with the goal of getting a new release out, probably 2.0.3 but maybe 2.1.0.

Goals

I think there are a number of reasonable goals, both short-term and mid-term. Note that none of these results in dramatic improvements for the user, but should make the wallet slightly more solid.

Short-Term Goal #1: Build & Run on Modern Linux (DONE)

As mentioned, the existing release has Linux binaries that won't run on my system, because it is linked to libraries that have not shipped in several years. The code also would not build, mostly because of differences in the OpenSSL libraries used. I found another coin which had the same problem, and stole the approach from this commit:

https://github.com/bitshares/bitshares-fc/commit/fee06a4c75d3215f9b502f8145383005bdda2c80

I had to rework it for our code base, but the approach fixed 90% of the problems. A few more tweaks to adapt to more changes in the OpenSSL libraries, plus a Makefile fix for the command-line tool, and we now have something that will build and run.

If you are feeling brave you can check out the branch here:

https://github.com/shane-kerr/Mintcoin-Desktop-Wallet/tree/build-fixes-2018-01-31

Short-Term Goal #2: Merge Open Pull Requests

We have 4 outstanding pull requests, all from 2017-06. These are performance improvements, and seem pretty well thought out and relatively straightforward. I am reviewing these but hope to merge them soon.

Short-Term Goal #3: Address Open Issues on GitHub

There are 5 open issues on GitHub, which should all be addressed.

Short-Term Goal #4: Update the Developer & Other Documentation

The documentation needs to be reviewed and updated based on the current state of the code base. It will take some effort to avoid fixing things while documenting the current status, but I think it can be done with enough laziness^Wattention.

Short-Term Goal #5: Fix Compiler Warnings, Add More Compiler Warnings

The current code spews out lots of complaints when building. These should all be silenced by fixing the underlying problem. When this is done, we should turn on extra compiler warnings and fix any complaints that those raise.

And if we are feeling very brave, we can use static code checkers (also know as linters for historical reasons) and fix any errors those discover.

Medium-Term Goal #1: Release 2.0.3 or 2.1.0

In order to do this we would need to release a beta, with binary images built for Windows, macOS, and Linux. Since I don't have Windows or macOS this may be difficult. But it should be achievable, and might raise some interest in the coin.

Medium-Term Goal #2: Testing

It does not look like any of the automated tests were updated since the fork from NovaCoin. This is, obviously, very worrying. If I was intimately familiar with the code base and understood everything about Proof-of-Stake crypto currency then it would be worrying, because everybody makes mistakes. Since neither of those is true, it is terrifying.

So the idea here is to come up with some basic tests of the code that can be easily and automatically run. Since we probably do not want to keep this wallet code base forever this effort should be balanced and limtted, but not having any tests is too scary.

Medium-Term Goal #3: Finding Peers with DNS

Right now the wallet as shipped fails to ever find any peers. If you do some tricks with "addnode" to your configuration you can convince the program to connect to the MintCoin network, but it is a complete hack.

The MintCoin wallet actually includes a pretty good way to get these initial peers, by looking up the IP addresses in the DNS. However, none of the existing names configured in the wallet actually work at all. It should be relatively straightforward to change these to seeding from a working wallet. It means setting up a bit of infrastructure and maintaining that, but it is not rocket science.

Medium-Term Goal #4: Speeding Up Initial Sync

The software should have some faster way of getting the state of the blockchain. The current update system takes ages, and the current workaround of downloading this manually is not ideal, to say the least. It should not be that hard to set up a system where a full version of the blockchain is downloaded and used to start.

A Minty Call to Arms

Hopefully it is clear that I don't really know what I am doing. Maybe you do? Even if you don't I would love some help! Please? :)