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:

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). The Kinit app sends the newly created public address to the Kinit server. 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. 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:

As soon as a wallet is created we retrieve the first task from the Kinit server. 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. 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. 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: