Open Sourcing Kinit

Berry Ventura Lev
Kin Blog
Published in
5 min readJul 4, 2018

In the last few months, my team has been working on Kinit, a standalone app that brings the Kin experience directly to users. Sarit Ariel, the Kinit Product Manager, has shared posts with you talking about the Kinit product vision, private beta launch, insights and lately about our next steps.

It has been important to us to move quickly so that we can test our assumptions and gain insights from our users as soon as possible. To accomplish this we have been working in 2 week agile sprints with a “keep it simple, develop fast” state of mind.

I am proud to announce that today we open sourced the code for the Kinit Android and iOS apps. Our server code has been open to the public since day one here.

In addition to open sourcing our code, we would like to start a series of technical posts where we will be telling you more about how we build Kinit. To kick this off, I will start with details on the integration with the kin core SDKs.

Integration with kin-core SDKs

The Kinit team has been the first to integrate with our stellar based kin-core Android, iOS and python sdks and have real (beta) users experiment with Kin. Kinit is using the SDKs to create wallets for users, check balance, and complete earn and spend transactions. The Kinit team started the integration before the SDKs were complete, and helped with testing and improving them. In order to move quickly we launched our private beta over the Stellar testnet blockchain but, of course, our public beta, which is due later this month ,will run on top of our Kin blockchain.

Kinit Wallet Creation

There are 3 steps that need to be taken when creating a new stellar wallet, and these are needed also when using the Kin SDKs.

1. A new public address and private key pair need to be generated.

2. An account for the new public address needs to be created on the Stellar blockchain and funded with native Stellar asset for fee purposes.

3. The account needs to be activated.

Our flow to complete these steps is as follows:

  1. Kinit app uses the Android/iOS kin-core SDK to create a `KinClient` object and add a new account. (This simply generates a new public address/private key pair).
  2. The Kinit app sends the newly created public address to the Kinit server.
  3. The Kinit server uses the kin-core python SDK to create the account on stellar, and to fund it with the native Stellar asset needed for fees.
  4. Kinit app uses the Android/iOS kin-core SDK to activate the account.

This one-time-only process to create and activate a wallet can take up to 20 seconds. We decided that it would be best in terms of robustness to block the user from using Kinit until the process has been completed and the user has a ready to use, activated wallet.

In the “keep it simple, develop fast’ state of mind, we chose to use a simple UX to inform the user that he/she needs to wait for their wallet to be created. We simply added ‘Creating wallet…’ text on the Kinit splash screen, and wait on that screen until the process is completed. The user is moved to the next screen only after the wallet is ready. If something goes wrong or there is a 20sec timeout, we display an error screen with an option to try again and/or contact support.

Earning Kin

In Kinit, users start off with 0 KIN in their balance, however they immediately get a chance to earn their first KIN by completing a simple task. Kinit provides users with a new task each day.

Here are the steps for our earn flow:

  1. As soon as a wallet is created we retrieve the first task from the Kinit server.
  2. User can complete the task at their own time. Once they have completed the last question of the task, we submit the user’s answers to our Kinit server and user is moved to the ‘Done’ screen.
  3. Upon submission our server uses the python SDK to create and sign a transaction to pay users the amount of Kin they earned. The server creates a unique identifier for the payment and adds it as a “memo” in the transaction details. The “memo” is returned back to the client in the result submission response.
  4. The client uses the Android/iOS SDKs to listen for an incoming transaction to the user’s public address that includes the specific transaction memo returned by our server. When the client SDK notifies that the incoming transaction has been completed, we celebrate the new earned Kin with a fun animation.

Spending Kin

Our ‘Spend’ tab provides a number of different offers that users can buy with Kin they have earned.

Our spending flow is as follows:

1. When a user clicks on buy, we send a request to our server to book the particular offer, and as long as there is an item available our server books it and returns an order-ID to the client.

2. The client uses the Android/iOS kin-core SDKs to generate a transaction with the amount of Kin needed for a transfer to our Kinit wallet public address. We add the order-id as a memo in the transaction.

3. Once the payment is completed, client sends our server the transaction ID.

4. Server verifies the transaction ID, amount and order id and if all is well returns the coupon code purchased to the client.

Peer to Peer transfer

One of the offers included in the offer list is an option to send Kin to a friend who is also using Kinit. The user can select a contact from their phone contacts and send them some Kin.

This is how it works:

  1. We use the Android/iOS native contacts list to let the user select a contact.
  2. Once a contact is selected, we send a request to our Kinit server to match the friend’s phone number to their wallet public address
  3. The Android/iOS client will create and sign a transaction to the friend’s public address using the core SDKs and notify our server that the transfer has been completed.
  4. Our server sends a push notification to the friend telling them they have received Kin!

Hope you have enjoyed reading this article. Thanks for reading, and stay tuned for more posts from our team.

--

--

Berry Ventura Lev
Kin Blog

Engineering Manager @ Kin, mentor @ she-codes; mom of 2 amazing teenagers and lifelong learner.