Skip to main content
This tutorial shows you how to set up your own referral code that you can share with users to earn commission from their borrowing activity.

How Referral Codes Work

Kamino’s referral system allows referrers to earn commission from the borrowing activity of referred users. Each referrer creates a unique referral code that can be shared publicly without revealing a wallet address, providing a user-friendly way to distribute referral codes.
In the SDK, the shortUrl field represents the referral code.
1

Import Dependencies

2

Initialize RPC

3

Create Referrer State with Short URL

Check the referral code is free, then create the referrer state and short URL.
The short URL must be unique, at most 32 characters, and use only ASCII letters, digits, underscore and hyphen. isShortUrlAvailable checks both. Each wallet gets one code.
4

Build the Transaction

5

Sign and Send

6

Verify Short URL Resolution

Referrer setup complete. The short URL is active and can be shared with users to establish referral relationships.