Recently we launched the first Kin earn and spend opportunities in Kik, which we have been calling IPLv2. The goal of IPLv2 as discussed in a previous post was to introduce crypto to Kik users, minimize time to production and experiment with a two-sided economy. Today, we’ll review the high level technical details of the project, and how we minimized time to production.

The end result is a workflow that would allow any bot to use Kin, but only to the small number of restricted users on Kik that are able to participate in the IPLv2 Kin experience.

To start, I should probably introduce our team’s role in the project. Located in Toronto, our team is responsible for the development and design of the Bots Platform at Kik. Using the Kikteam bot to introduce our power users to Kin was a natural choice. Our team built the Kikteam bot experience as well as the UI for the Kin wallet.

The Kik Team Experience

Kikteam is every Kik user’s first friend — it was the logical choice to use as an introduction to Kin to our users. In IPLv2, this bot also takes care of sending the user polls, and rewards them for answering poll questions:

Kik Team Onboarding User Experience

Kik Team Survey Experience

Wallet UI

Our team was also responsible for the frontend development of the Kin wallet in Kik. This wallet interacts with the different earning and spending services and also contains a bridge to call native code, which handles sending Kin and store the user’s Kin wallet.

Kin Wallet UI

Now, let’s take a moment to talk about the components involved in building this project.

The Components

IPLV2 Components Breakdown

The diagram above shows all of the implementation components and where they live. Note, that Kik and Kin are separate, because none of the Kin components are specific to Kik. In fact, they can be used by any mobile service. For IPLV2, the service that’s using them is Kik.

Let’s examine each of the components.

This python SDK allows any web developer to send and receive Kin. In our example, our third-party service uses this repo to send Kin to users given their public address. In order to access the public address of the user, the service must use the wallet.

Third-Party Service Web Server

This component is the web server that powers the Kikteam bot, and uses the ERC20 Token Python SDK to send and receive Kin.

Third-Party Service Frontend Website

This component is the frontend webpage associated with the web server. It is allowed to interact with a component called Kin.js — which calls the KinPlugin either directly or via the wallet.

Kin.js

A javascript library that allows a webpage to grab information about the user’s wallet. It can be called by any web page on Kik — however, only the wallet can access some of its functionality. It utilizes a bridge that calls mobile code from the web browser. Kin.js provides a number of important interfaces for Kin integration:

isWalletAvailable:

Available to all web pages on Kik

Indicates whether a user has a Kin wallet or not

getPublicAddress:

Available to the wallet only

Retrieves the public address of the current user’s Kin wallet

A 3rd party website can call this function, however the Kik app will open the wallet (which has the actual permissions to get the public address) and display this page:

The data is passed back to the third-party website if the user accepts the request — this is all facilitated through kik.js (picker mode)

sendKin:

Available to the wallet only

Sends the amount of Kin from the current user’s wallet to a specified address

Similar to getPublicAddress, a 3rd party site can call this function, and the following page is presented to the user:

If the user accepts, the transaction ID is passed as data back to the requesting 3rd party site

getOrCreateWallet:

Available only to wallet

Returns the existing Kin wallet (public address and private key) or creates a new wallet and returns that

exportKeyStore:

Available only to wallet

Returns the key store of the current Kin wallet for import into a new wallet

Wallet:

The frontend website that has access (via kin.js) to the user’s Kin wallet. This wallet has access to all the functions described in the section above.

KinPlugin:

The native mobile code that wraps the Kin SDK. Kin.js uses a custom bridge to call the native mobile code written in this component.

Kin SDK:

The SDK that communicates with the blockchain — it securely stores the private key (and the public address), which can never leave this SDK, as well as can send Kin, and get the balance of the user’s Wallet.

Time to Market

We work iteratively, so we tried to reuse as much of our existing infrastructure as possible. In this way, we were able to bring our experiment to the masses very quickly.

The main criteria we used to build IPLv2 was speed to completion. We decided to do most of the work through frontend and backend web code, as opposed to rely on slow review cycles that are introduced by writing native code.