Building a Kin-powered app with Unity, Part 4

Will Gikandi
Kin Blog
Published in
3 min readAug 11, 2019

What did my phone just say?

In the last tutorial, we learned how to set up a wrapper to make it easy to talk to Kin’s blockchain.

In the last tutorial, we got a message from our phone:

Display from your Android device

In order to use the wrapper, it is important to understand what is happening inside it. The wrapper has used the SDK to perform the following steps:

  1. Checked to see if a Kin address exists on the device (no)
  2. Created a Kin address for the device
  3. Checked for an online server to onboard the address to the blockchain
  4. Did not find a server, and displayed the message above and stopped

To see this in action, please open up the wrapper file and see:

Initialize()

This function will cover today’s discussions. However, we will cover two high-level concepts so we can proceed with coding in the next tutorial.

1. What is a Kin address?

An address on Kin’s blockchain has two parts: A public key (56 characters), and a matching private key that is kept secret.

The public and private keys are created locally by the SDK on your device. The public key is your device’s address (like an email) that sends and receives Kin. The private key is secret and remains on your device, and is used to sign payment transactions.

You can try creating some public and private keys in the laboratory to understand what is happening in your device.

2. What is “onboarding” a Kin address?

Once an address is created on your phone, it only exists on the phone, and Kin’s blockchain is not aware of its existence. This means the address cannot send (or receive) Kin until it is onboarded/ registered on Kin’s blockchain.

Accounts cannot onboard themselves, and must be onboarded by a server online. To do this, the phone sends its public address to a server, which onboards it while funding it at the same time. Funding with a minimal amount must be done to prevent unlimited spam accounts being created.

Create accounts and onboard them.

To understand this practically:

1. Access Kin’s laboratory and click Generate keypair

2. Open a new window, copy the public key and paste it here to get the account details:

You should get an error, which means the account has not been onboarded.

3. Go back to the original window and paste your public key to the Friendbot.

Clicking “Get test network Kin” will onboard your account. If you try to get the information again on the blockchain, you will see that the address is now publicly recognized.

Conclusion

We have seen that, to get a fully operating client, we need to:
1. Create a private/public key (done!)

2. Onboard this by using a trusted server

While we can do this manually with the Friendbot, we need to create our own server to onboard our users’ accounts.

We will go through this process in the next tutorial.

--

--