Get Started or Add to an Existing Project
Getting started with Kin is incredibly straightforward. Just follow the steps below to start transacting with Kin in your app.
Installation
Open Unity Package Manager window.
Click the +
button in the status bar. Select Add package from git URL
from the add menu. A text box and an Add button appear.
Enter the https://github.com/kin-labs/kinetic-unity-sdk.git
Git URL in the text box and click Add
.
Once the package is installed, in the Package Manager inspector you will have Samples. Click on Import
Instantiate the Kinetic Client
The Kinetic Client will give you access to all the methods you need to work with Kin on the blockchain.
We recommend starting with Devnet before moving on to Mainnet.
sdk = await KineticSdk.Setup(
new KineticSdkConfig(
index: 1, // Add your own App Index here
endpoint: "https://sandbox.kinetic.host",
environment: "devnet",
)
);
Don't have an App Index? Register your app on our Developer Portal so you can get your App Index that allows you to transact with our SDKs and earn via the KRE.
Register Your App
Learn how to register your app on the Kin Developer Portal
Kin Dev Portal
Go straight to the Kin Developer Portal and get started
While you're waiting for confirmation of your App Index, use 1
on devnet so you can get started.
Create Account
You can create accounts randomly or from existing mnemonics or secret keys. Below, we'll make a keypair and use that for creating an account on the blockchain.
You can also generate keypairs and create accounts on devnet via the Kin Laboratory.
var mnemonic = Keypair.GenerateMnemonic();
var keypair = Keypair.FromMnemonic(mnemonic);
await sdk.CreateAccount(keypair);
Close Account
It's good practice to close unneeded accounts. You can only close accounts that you have created and are currently empty.
await sdk.CloseAccount(keypair.PublicKey);
Check Balance
Check a user balance by passing in the public key of the account you want to check.
The response object includes your total Kin balance as well as detailing all of the Mints and Tokens held by that Public Key.
var balance = await sdk.GetBalance(keypair.PublicKey);
Airdrop Funds (devnet)
Send some test funds to a specific Public Key on Devnet.
Or visit the Kin Laboratory to do it with a click!
await sdk.RequestAirdrop( account: keypair.PublicKey, amount: "1000" );
Transfer Kin
Transfer Kin from a Keypair to any Public Key.
Make sure to include your Transaction Type if you want it to count towards the KRE.
await sdk.MakeTransfer(
amount: "5000",
destination: "BQJi5K2s4SDDbed1ArpXjb6n7yVUfM34ym9a179MAqVo",
owner: keypair,
type: TransactionType.P2P // Can be Unknown, None, Earn, Spend or P2P
);
Get Transaction Details
Get the details of any transaction by passing in the transaction signature.
await sdk.GetTransaction(signature: transactionSignature);
Get Account History
Get the full transaction history of any account by passing in the account's Public Key.
await sdk.GetHistory(account: keypair.PublicKey);
Get Account Info
Easily get the main info of any account by passing in the account's Public Key.
await sdk.GetAccountInfo(account: keypair.PublicKey);
Get Token Accounts
Get the full list of Token Accounts held by a Keypair on Solana.
await sdk.GetTokenAccounts(account: keypair.PublicKey);
Webhooks
Whether you are using Kinetic As A Service or Self-Hosting to connect to Kinetic, once you're up and running, you'll be able to access Kinetic Manager to manage your app's settings.
This includes allowing you to configure your app to use a number of webhooks.
Balance Webhook
The balance webhook allows you to receive an alert when your app's hotwallet is running low on Sol so you can top it up and ensure your app can continue to keep transacting.
E.g. In a node express server:
app.use('/balance', async (req, res) => {
const data = req.body
// DO STUFF WITH THE BALANCE ALERT
res.sendStatus(200)
})
Event Webhook
The event webhook allows you to receive alerts when actions have been confirmed on the Solana blockchain.
E.g. In a node express server:
app.use('/events', async (req, res) => {
const event = req.body
// DO STUFF WITH THE EVENT DATA
res.sendStatus(200)
})
Verify Webhook
The verify webhook allows you to have fine-grained control over transactions, making sure they meet your own criteria before allowing them to proceed.
E.g. In a node express server return a 200
status code to approve the transaction or a 400
to reject it:
app.use('/verify', async (req, res) => {
const transaction = req.body
// CHECK THAT YOU WANT THIS TRANSACTION TO PROCEED
// e.g.
if (transaction.amount < 1000000) {
res.sendStatus(200)
}
res.sendStatus(400)
})
Demos and Starter Kits
Created to help get you up and running as quickly as possible, these projects can be a great reference point when you get stuck or even a starter for your own project. Happy coding!
Kinetic Unity Starter
Ready for Production?
If your app is ready for production, this is the place for you!
Production
Get your app ready and running on the Solana Mainnet so you can earn Kin via the KRE
Earn Kin via the KRE
Kin Rewards Engine
Earn Kin by using it in your App
Contribute
Kinetic Unity SDK
Want to contribute to the Kinetic Unity SDK?
What If I Get Stuck?
Getting Help
Stuck? No problem, we have an amazing community waiting to help out.
Developer Discord
Join our fantastic developer community.
Developer Best Practices
Once you're ready to code, have a quick look at our Developer Best Practices where we cover some useful topics that you'll want to keep in mind as you build out your Kin application.
Best Practices
Some key information you'll want to keep in mind as you develop your App
Was this page helpful to you?
Provide feedback