How I Integrated Blockchain to My Existing Product (Kanbanote)

How I Integrated Blockchain to my Existing Productivity App (Kanbanote)

#9 — How I created a cryptocurrency that rewards you for doing your own tasks

On the left, the wallet of the cryptocurrency created, and on the right, Kanbanote!

In order to learn about cryptocurrency and blockchain, I decided to create my own cryptocurrency and add it to my website Kanbanote. This is how the Motive cryptocurrency was born! 🚀

In this article, I will explain how I made this, what were the issues I faced and also how I integrated with an already existing product.

This article is part of my Learning challenge where I learn about one topic each month. As you can imagine, this month, I was learning about blockchain & cryptocurrencies. I based this studies on a Coursera MOOC, a few articles, some whitepapers and the building of my own Proof of Stake Cryptocurrency and Coin Generator. Click here, if you want to know more about my methodology.

Defining the cryptocurrency

There is no point of building a cryptocurrency if it doesn’t solve a problem. Once you have it there are a few details to set before building it!

Solving a problem

Why? This is the question you need to ask yourself before adding blockchain or a cryptocurrency.

Before explaining the problem let’s just remind what is Kanbanote. It’s a productivity tool that shows your tasks on a Kanban board. It’s very similar to Trello but it uses Evernote to read/store the tasks.

A screenshot from Kanbanote

The Kanban is a very productive tool for the Gettings Things Done methodology (GTD).

The GTD method rests on the idea of moving planned tasks and projects out of the mind by recording them externally and then breaking them into actionable work items. This allows one to focus attention on taking action on tasks, instead of recalling them. — Source: Wikipedia

I am a big fan of GTD method and I am using myself Kanbanote every day (every hour actually) but I am facing two issues:

  • Sometimes I prefer to keep tasks in my mind because when I see my board full of tasks I feel overwhelmed. Also, I always check the number of pending task, to know how many remaining things I have to do and I try to keep it as low as possible by cheating, and not adding tasks.
  • Ideally, all the tasks should have the same weight, then you can better assess how much tasks you can do a day. But most of the time all the tasks have a very different weight!

So I had this idea: giving in an automated way a MOTIV coin as a reward every time I complete a task. That way it can solve both problems:

  • By getting an incentive for completing the task, I should better have every task written on the board, that way I can empty my mind
  • Giving 1 MOTIV, no matter how long is a task, will force me to create tasks of a similar weight

Does it needs to be decentralized? This is the second question and a very important one. Can’t I achieve this by badges or centralized coins? Speaking for myself, getting a badge or a centralized coin will not motivate me. But cryptocurrencies are motivating, and maybe someday in the future, the coin will have a real value and will be used by anyone.

So I decided to take advantage of the decentralization when designing the cryptocurrency 🙌.

Also, remember the first reason I am building a cryptocurrency is to learn how to do it.

Designing the cryptocurrency

Define the identity of the cryptocurrency:

  • Purpose: Get rewarded by doing your own tasks
  • Name: Motive
  • Symbol: MOTIV
  • Future: Give MOTIVs to different productivity products and services so that they can distribute the coins to their users in order to boost their productivity!

Choosing a technical solution

There are many ways to build a cryptocurrency:

  • ERC20 Tokens — They run inside Ethereum blockchain. It’s very easy to create them, also there are many existing libraries to interact with Ethereum.
  • “Colored coin” — It’s a coin that runs inside another blockchain. For example with Peerassets you can create your own coin inside the peercoin cryptocurrency.
  • Creating a clone of a Proof of Work cryptocurrency with its own blockchain — There are many tutorials and generators to do it, the only problem is that Proof of Work requires mining, which “wastes” electricity and if you don’t provide enough computational work, someone can easily block your network!
  • Creating a clone of a Proof of Stake cryptocurrency with its own blockchain, it’s quite hard to find tutorials.
  • Create a cryptocurrency from scratch: the hardest solution, and the longest indeed, and maybe not secured enough if you are not skilled enough.

The easiest would be to use ERC20 Tokens, the only problem is that I would have to pay fees for each transaction which makes sending 1 MOTIV per task done, a very costly action for the users! Also ERC20 uses Ethereum that uses the proof of Work consensus which is using a lot of electricity power! That is why I went for the PoS solution.

If you want to understand the different Proof of … read this article I wrote.

Proof of What? Understand the Distributed Consensuses in Blockchain

Also another interesting link which I found after creating the cryptocurrency (it would have helped me more to find it before though) is this one:

Map of coins: the history of cryptocurrencies from bitcoin to dogecoin and more

You can see on this website where some cryptocurrencies are coming from. Where is the root source code coming from? Most of the cryptocurrencies are indeed clones of Bitcoin, or Litecoin (which is a fork of Bitcoin).

The long road to Motive

Here is the process I followed to try to build Motive:

  1. I googled to find tutorials about “How to build a proof of stake cryptocurrency”. I found one paid solution and a few links.
  2. The first link I found was this one “ CLONING A COIN THE EASY WAY IN ABOUT 20 MINUTES” — https://pastebin.com/iL9DeTTS
  3. This tutorial explains how to build a fork of GorillaTeeth which is a clone of Peercoin (the first Proof of Stake cryptocurrency which also combines Proof of Work), it’s also a clone of bitcoin. It is built in C++, language that I am not familiar with at all. But the problem was just that it was impossible to compile because of deprecated dependencies. I then tried with Docker and I couldn’t manage as well
  4. Then I decide to keep searching and going for another solution, I then found Peershares — https://github.com/Peershares/Peershares
  5. It’s another clone of Peercoin, full Proof of Stake, no longer maintained but very well documented. It was made for creating ICOs, or just to be used for your own products, so exactly what I needed. I managed to compile it and make it run locally with Docker, I even managed to build the Genesis block, awesome moment! But I didn’t manage to build the binary files that I could share with the users.
  6. I then posted in the Peercoin forum to ask how could I solve this. Because it’s no longer maintained they recommended to better go for Peercoin, to understand its source and remove the Proof of Work part of the code. So I decided to give a try and to start just compiling it. Again I didn’t manage, I was quite frustrated because it was my third trial. I also realized that I was really lucky to be a web developer because everything is new and simplified to make development easy!
  7. At this moment I was about to abandon 😫, I had also a few other options such as going for a Proof of Work cryptocurrency or using Naive coin which is a simple implementation of a cryptocurrency in NodeJS. But I decided to look for cryptos built in other languages than C++, otherwise I could never maintain it. I then found NXT from Jelurida. After more researches, I even found the NXT Clone Starter: https://bitbucket.org/Jelurida/nxt-clone-starter. There was even a video tutorial made by the team. The only con which is actually good for adoption is that 10% of the new coins will be given to the NXT holders!
  8. I finally managed to make it run, and make transactions! A unique moment!! Then I struggled a bit to build it and create an installer, I even tried to build it with Electron but I finally managed after finding some piece of code from the Nxt repository that was not in the archive of nxt clone for some reason.

The integration with Kanbanote

Now the cryptocurrency works. I had to integrate it to Kanbanote.

Kanbanote is a bit my experimenting lab: I used it to learn AngularJS, then ReactJS, now Blockchain! Nevertheless, I always try to improve the user experience, so this Cryptocurrency should not interfere with a normal usage!

Defining rules

As I said above, the goal of Motive is to provide coins to different productivity tools that will distribute it to their users based on their own rules.

That is why I have to decide some rules to distribute MOTIVs to Kanbanote users. My idea is the following: since MOTIVs cannot be traded yet, there is no reason to cheat. Also in order to cheat you need to create an Evernote account and connect to Kanbanote. It’s too much effort.

So the rules I decided are simple: Kanbanote’s users choose one column of one board as the reward board, they give their Motive account address and every time they mark a task as done (move a card to the reward column) they get 1 MOTIV. With a maximum of 1 MOTIV / task of course.

I will first leave it like this and maybe change the rules in the future depending on how it goes, like adding a time limit or give this feature only for premium users.

Defining the architecture

The architecture is quite simple:

  • Starting with 2 nodes to keep the blockchain alive
  • 1 Lightweight wallet with the Kanbanote account
  • Kanbanote’s backend will query the lightweight wallet that has an API in order to send a MOTIV coin every time a task is dropped in the reward column and if it hasn’t been done before

Implementing it

The implementation was quite easy:

  1. I tried the API with the command line interface
  2. I created the CURL query
  3. I updated the database in order to track if one note got already its reward and also to save the public MOTIV address and the reward column. Kanbanote does not save your private key! So you are the only owner of it, keep it safe!
  4. Then I implemented the UI, in order to go faster it’s a server side rendered UI with some VanillaJS to query the API

Simplifying the account creation

In order to make Kanbanote’s life easier, they don’t need to download the wallet to create an account. That is why Kanbanote will generate a private key based on an algorithm.

Users have to keep this private key safe. Also in order to secure the account, it’s important to validate the account by making a transaction or clicking the validate account button in the wallet. So it’s recommended to download and run the wallet!

Hosting nodes

The last step before going into production was to deploy nodes. I decided to use OVH VPS and Amazon Web Service that provides a one-year free hosting.

Two nodes are good to start but not enough to scale, so if you want to host a node feel free to join the community and you can get some bounties!

Boosting my productivity!

Now everything is there, every time I complete a task I get 1 MOTIV plus a bit of dopamine. What else do I need?

The future of Motive

The plan

Here are the next steps of Motive:

  1. Make the Motive Network bigger, having more productivity apps & services distributing MOTIV coins
  2. Add more nodes to the network to make it more secure
  3. Make Motive more accessible: web wallet, mobile app
  4. Accept Motive payments in Kanbanote for premium plans
  5. List Motive in exchanges

How to get MOTIVs

There are currently different ways to earn MOTIVs:

Get started with Motive

Here is the website to get started.

Motive

Want to build your own cryptocurrency?

If you also want to build a cryptocurrency similar to Motive, it’s very easy. I created a generator and a small tutorial. Have a look, it’s free!

How to Build Your Own Cryptocurrency (PoS) in Just a Few Minutes

What’s next?

This article is part of my Learning Challenge about Blockchain & Cryptocurrencies. Like this one, I made 5 others article related to the topic.

If you liked this post, please click the clap 👏button below a few times to show your support! Also, feel free to comment and give any kind of feedback. Don’t forget to follow me!


How I Integrated Blockchain to My Existing Product (Kanbanote) was originally published in Learning Lab on Medium, where people are continuing the conversation by highlighting and responding to this story.