> ## Documentation Index
> Fetch the complete documentation index at: https://docs.solanatracker.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Solana RPC: SNS Domains

> Resolve Solana Name Service .sol domains with Ridge custom RPC methods for primary domains, batch wallet identity, all owned domains, and forward resolution.

Solana Name Service (SNS) domains give wallets a human-readable `.sol` identity. Instead of showing only a base58 wallet address, you can display names like `solanatracker.sol`, resolve a domain back to its owner, or fetch every `.sol` name a wallet owns.

The Ridge custom RPC SNS methods resolve this data in one RPC call. You do not need to manually chain account lookups, decode name registry accounts, or maintain a client-side cache just to show wallet identity.

<Info>
  Each SNS RPC method costs **1 credit** per call. Twitter/X handles (`.twitter`) are not supported.
</Info>

## What you can build

Use the SNS methods for:

* Wallet labels in dashboards, leaderboards, and portfolio views.
* Batch identity enrichment for lists of traders or holders.
* Profile pages that show every `.sol` domain owned by a wallet.
* Search boxes that accept `name.sol` and resolve it to a wallet.

| Goal                                      | Method                                                                    |
| ----------------------------------------- | ------------------------------------------------------------------------- |
| Get one wallet's primary `.sol` domain    | [`getPrimaryDomain`](/solana-rpc/http/getprimarydomain)                   |
| Resolve primary domains for many wallets  | [`getMultiplePrimaryDomains`](/solana-rpc/http/getmultipleprimarydomains) |
| List all `.sol` domains owned by a wallet | [`getAllDomains`](/solana-rpc/http/getalldomains)                         |
| Resolve `name.sol` to an owner wallet     | [`resolveSolDomain`](/solana-rpc/http/resolvesoldomain)                   |

## RPC endpoint

All examples use JSON-RPC 2.0 over HTTP:

```bash theme={null}
https://rpc-mainnet.solanatracker.io/?api_key=YOUR_API_KEY
```

## Get a wallet's primary domain

Use `getPrimaryDomain` when you want the display label most users expect: the wallet's primary or favourite `.sol` domain.

<CodeGroup>
  ```bash cURL theme={null}
  curl "https://rpc-mainnet.solanatracker.io/?api_key=YOUR_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{
      "jsonrpc": "2.0",
      "id": 1,
      "method": "getPrimaryDomain",
      "params": ["9aoUCn5J4sxhvYERCVwVnakPQxyXTHQVXe86CUJYxY8p"]
    }'
  ```

  ```javascript JavaScript theme={null}
  const rpcUrl = "https://rpc-mainnet.solanatracker.io/?api_key=YOUR_API_KEY";

  const { result } = await fetch(rpcUrl, {
    method: "POST",
    headers: { "Content-Type": "application/json" },
    body: JSON.stringify({
      jsonrpc: "2.0",
      id: 1,
      method: "getPrimaryDomain",
      params: ["9aoUCn5J4sxhvYERCVwVnakPQxyXTHQVXe86CUJYxY8p"]
    })
  }).then(r => r.json());

  const label = result.value.domain ?? result.value.wallet;
  console.log(label);
  ```

  ```python Python theme={null}
  import requests

  res = requests.post(
      "https://rpc-mainnet.solanatracker.io/?api_key=YOUR_API_KEY",
      json={
          "jsonrpc": "2.0",
          "id": 1,
          "method": "getPrimaryDomain",
          "params": ["9aoUCn5J4sxhvYERCVwVnakPQxyXTHQVXe86CUJYxY8p"]
      }
  )

  result = res.json()["result"]["value"]
  print(result["domain"] or result["wallet"])
  ```
</CodeGroup>

When a domain exists:

```json theme={null}
{
  "context": { "slot": 423867852, "apiVersion": "3.0.0" },
  "value": {
    "wallet": "9aoUCn5J4sxhvYERCVwVnakPQxyXTHQVXe86CUJYxY8p",
    "domain": "solanatracker.sol"
  }
}
```

When no primary domain exists, `domain` is `null`:

```json theme={null}
{
  "context": { "slot": 423867852, "apiVersion": "3.0.0" },
  "value": {
    "wallet": "FMmaHPDL47V1gXsfh9WjgAT7Er3dfDvarQubTU1Jxc1r",
    "domain": null
  }
}
```

<Tip>
  In UI, use the domain as the label when present, and fall back to a shortened wallet address when `domain` is `null`.
</Tip>

## Batch primary domains

Use `getMultiplePrimaryDomains` when rendering lists of wallets: holders, traders, leaderboard rows, copy-trading candidates, or activity feeds.

The method accepts up to **100 wallets** and returns results in the same order as the input list.

```json theme={null}
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "getMultiplePrimaryDomains",
  "params": [
    [
      "9aoUCn5J4sxhvYERCVwVnakPQxyXTHQVXe86CUJYxY8p",
      "FMmaHPDL47V1gXsfh9WjgAT7Er3dfDvarQubTU1Jxc1r"
    ]
  ]
}
```

Example response:

```json theme={null}
{
  "context": { "slot": 423867852, "apiVersion": "3.0.0" },
  "value": {
    "results": [
      {
        "wallet": "9aoUCn5J4sxhvYERCVwVnakPQxyXTHQVXe86CUJYxY8p",
        "domain": "solanatracker.sol"
      },
      {
        "wallet": "FMmaHPDL47V1gXsfh9WjgAT7Er3dfDvarQubTU1Jxc1r",
        "domain": null
      }
    ]
  }
}
```

Because the response preserves input order, you can merge it back into a wallet list by array index:

```javascript theme={null}
const wallets = [
  "9aoUCn5J4sxhvYERCVwVnakPQxyXTHQVXe86CUJYxY8p",
  "FMmaHPDL47V1gXsfh9WjgAT7Er3dfDvarQubTU1Jxc1r"
];

const { result } = await fetch(rpcUrl, {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({
    jsonrpc: "2.0",
    id: 1,
    method: "getMultiplePrimaryDomains",
    params: [wallets]
  })
}).then(r => r.json());

const rows = wallets.map((wallet, i) => ({
  wallet,
  displayName: result.value.results[i].domain ?? `${wallet.slice(0, 4)}...${wallet.slice(-4)}`
}));
```

## Get all domains owned by a wallet

Use `getAllDomains` for wallet profile pages, domain portfolios, or account settings screens where the user expects to see every `.sol` name they own.

```json theme={null}
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "getAllDomains",
  "params": ["9aoUCn5J4sxhvYERCVwVnakPQxyXTHQVXe86CUJYxY8p"]
}
```

Response:

```json theme={null}
{
  "context": { "slot": 423867852, "apiVersion": "3.0.0" },
  "value": {
    "wallet": "9aoUCn5J4sxhvYERCVwVnakPQxyXTHQVXe86CUJYxY8p",
    "domains": ["solanatracker.sol", "othername.sol"]
  }
}
```

If the wallet has no domains, `domains` is an empty array.

## Resolve a domain to an owner

Use `resolveSolDomain` when a user types a `.sol` name and you need the owner wallet.

```json theme={null}
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "resolveSolDomain",
  "params": ["solanatracker.sol"]
}
```

Response:

```json theme={null}
{
  "context": { "slot": 423867852, "apiVersion": "3.0.0" },
  "value": {
    "domain": "solanatracker.sol",
    "owner": "9aoUCn5J4sxhvYERCVwVnakPQxyXTHQVXe86CUJYxY8p",
    "nameAccount": "7xKXtg2CW87d97TXJSDpbD5jBkheTqA83TZRuJosgAsU"
  }
}
```

If the domain is not found, `value` is `null`.

`resolveSolDomain` supports root `.sol` domains like `name.sol` and one-level subdomains like `sub.parent.sol`.

## Example: wallet identity helper

This helper uses primary domains for display and keeps the wallet address available for linking, copying, or transaction actions.

```javascript theme={null}
function shortWallet(wallet) {
  return `${wallet.slice(0, 4)}...${wallet.slice(-4)}`;
}

async function getWalletIdentity(wallet) {
  const { result } = await fetch(
    "https://rpc-mainnet.solanatracker.io/?api_key=YOUR_API_KEY",
    {
      method: "POST",
      headers: { "Content-Type": "application/json" },
      body: JSON.stringify({
        jsonrpc: "2.0",
        id: 1,
        method: "getPrimaryDomain",
        params: [wallet]
      })
    }
  ).then(r => r.json());

  return {
    wallet,
    label: result.value.domain ?? shortWallet(wallet),
    domain: result.value.domain
  };
}
```

## Choosing the right SNS method

| Situation                                       | Recommendation                         |
| ----------------------------------------------- | -------------------------------------- |
| Single wallet profile header                    | `getPrimaryDomain`                     |
| Leaderboard or holder table                     | `getMultiplePrimaryDomains`            |
| Domain portfolio page                           | `getAllDomains`                        |
| Search input accepts `.sol` names               | `resolveSolDomain`                     |
| PnL V2 response already includes `identity.sns` | Use the included PnL V2 identity field |

<Note>
  PnL V2 already includes SNS identity in supported wallet and token analytics responses. Use these RPC methods when you need SNS resolution directly from the Solana RPC surface.
</Note>

## UI and product tips

* Always keep the wallet address available, even when showing a domain.
* Treat `domain: null` as a normal result, not an error.
* Use batch resolution for tables and feeds instead of calling `getPrimaryDomain` in a loop.
* Show `.sol` names as labels, but copy and link the underlying wallet address.
* For user search, resolve `.sol` names first, then continue with the returned owner wallet.

<CardGroup cols={2}>
  <Card title="getMultiplePrimaryDomains" href="/solana-rpc/http/getmultipleprimarydomains">
    Batch primary `.sol` domains for up to 100 wallets.
  </Card>

  <Card title="PnL V2 SNS Identity" href="/guides/pnl-v2/sns-identity">
    See where SNS identity appears in PnL V2 responses.
  </Card>
</CardGroup>
