Kin Sdk Unity Tutorial by hitwill - 1

Games & ProjectsSDK

A wrapper and sample app for connecting your app to the Kin blockchain

Unity 2019.1.7f1MIT LicenseUpdated 2 years agoCreated on July 11th, 2019
Go to source

Kin Unity SDK tutorial

This is a simple implementation of Kin SDK for Unity. It can work as a standalone implementation, or together with the server side implementation provided in the Kin Unity SDK tutorial-server.

Within 5-10 minutes, you should be able to make and receive calls to Kin’s blockchain from an Android client on Unity.

You can also extend it to suit your needs.

Kin Unity implementation


The main objective of this code is to get you interacting with the blockhain as quickly as possible, and to also understand a sample implementation. As such, abstraction is avoided and a wrapper is provided in a single file.

Additional info

You can find detailed explanation of this code on Stackoverflow


  1. Clone to your localhost directory
  2. Open in Unity
  3. Compile and run on an Android device or emulator.


Kin Unity SDK


You can immediately start usage with the tutorial app provided.

For your own project

  1. Create an empty KinWrapper object in your scene, and attach the script: Scripts/KinWrapper.cs
  2. Place this object in any scene you wish to use the blockchain transactions

The object will initialize itself, maintain itself across scenes, and also listen to changes in the blockchain (e.g. payments/ balance changes).

Listening to Kin’s blockchain

    void Start()
        string url = "";
        kinWrapper = GameObject.Find("KinWrapper").GetComponent<KinWrapper>();
        kinWrapper.Initialize(ListenKin, url, serverAddress);

Getting the balance


Sending a payment

    kinWrapper.SendPayment(1.00M, "test send", address); 

You can find more examples in Scripts/Tutorial.cs

The wrapper is pre-configured to use a test server, but you can modify the following variables to suit your needs:

    private readonly string serverKinAddress = "GCMVZ4B6P4QEZL727UH2A6ABA2AYY67GZC3NILDD2DVSZPRN4QQCRATG"; //Kin address for your server TODO:/ enter server address here
    private readonly string appId = "1acd"; //appId assigned by Kin foundation. Use "1acd" for testing
    private readonly Kin.Environment environment = Kin.Environment.Test;
    //URL to your server
    private readonly string baseURL = "";
    //Your server URL  for client to request whitelisting
    private readonly string whitelistURL = "?whitelist=1";
    //Your server URL for client to request payments (from your server)
    private readonly string requestPaymentURL = "?request=1";
    //Your server URL for client to request payments (from your server)
    private readonly string fundURL = "?fund=1";
    private readonly float secondsBetweenRetry = 4f;
    private readonly int maxInitializes = 15; //times to try initializing in case of network error
    private readonly bool verbose = true; // upate caller on statuses of initialization 


Please read for details.


This project is licensed under the MIT License - see the file for details

Show all projects by hitwill