Skip to content

Latest commit

 

History

History
244 lines (177 loc) · 9.77 KB

2018-02-09.md

File metadata and controls

244 lines (177 loc) · 9.77 KB

Mint 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.