Docs

setReferrer - Set Referral Code

Set a referrer for a Hyperliquid account. Enables fee sharing through the referral program.

Set a referrer for the account using a referral code. This enables the account to participate in Hyperliquid's referral program, where the referrer earns a portion of trading fees.

Sample Data

JSON
{
  "signature": {
    "r": "0xf1d1526d59598ab867931fa78f9eedf4a76bada17a90cb2a8b804222774019cb",
    "s": "0x1eafd4a61d38331a80841682309b981f49e777094c2affe123f5cfd59293d047",
    "v": 28
  },
  "action": {
    "type": "setReferrer",
    "code": "PLACEHOLDER"
  },
  "nonce": 1768146913883
}

View this transaction on Hypurrscan

Field Reference

Action Fields

FieldTypeDescription
typestringAlways "setReferrer"
codestringReferral code to associate with the account

Referral Program

Hyperliquid's referral system allows:

  • Referrers to earn a percentage of referred users' trading fees
  • New users to potentially receive fee discounts
  • Both parties to benefit from the relationship

Use Cases

Referral Analytics

Track referral code adoption and distribution:

Python
referral_counts = {}

def process_setReferrer_action(action):
    code = action.get('code')
    referral_counts[code] = referral_counts.get(code, 0) + 1
    print(f"Referral code used: {code} (total: {referral_counts[code]})")

Influencer Tracking

Monitor which referral codes are most popular to identify influential promoters.

Onboarding Analysis

Track referral usage patterns to understand user acquisition channels.