Resolve and display .skr domain names in Solana mobile apps, in both directions between names and wallet addresses. Use when showing .skr names instead of…
.skr domain resolution
.skr domains are AllDomains names on Solana mainnet. Seeker users get one by default, which
makes them a good substitute for truncated addresses in a UI.
Two directions:
Forward — alice.skr to a wallet address
Reverse — a wallet address to a .skr name: its primary name, or else one it owns
Both live on mainnet, regardless of which cluster the rest of the app targets. An app on
devnet still resolves names against mainnet.
Decide where resolution runs
Resolution reads public on-chain data, so a client can do it directly. Proxy it through a
backend when you want:
RPC key protection. A key in EXPO_PUBLIC_* is readable by anyone with the APK. If you
use a paid RPC, it has to be server-side.
Shared caching. Names change rarely. One server-side cache beats every client
re-resolving the same addresses.
Batch lookups. Resolving a whole friend list in one request beats N round trips from a
phone.
getProgramAccounts access. Reverse lookup needs it, and plenty of providers disable or
heavily rate-limit the method. One server-side endpoint against a provider you have checked
beats discovering the restriction on user devices.
Direct client-side resolution against a public RPC is reasonable for a prototype or a
low-traffic app. Public endpoints are rate-limited, so it will not survive a list view that
resolves dozens of addresses.
Ask which the user wants if it is not obvious from the project. Default to the proxy for
anything heading to production.
Integrating with an existing backend
Check what exists before writing a new server. Adding an Express app beside someone's
NestJS service is a mess to maintain.
Look for backend dependencies in every package.json — express, fastify, hono,
@nestjs/core, koa, or a Next.js app with API routes.
Look for entry points: server.ts, app.ts, main.ts, index.ts.
Look for route organisation: routes/, api/, controllers/.
Ask if it is still ambiguous — "I see a Fastify server in apps/api; should the .skr
endpoints go there?"
Add routes to what exists, matching its conventions for routing, validation, and error
handling. Only scaffold a minimal server when there is genuinely no backend.
Core resolution logic
Use @solana-mobile/skr-domain. Do
not copy a resolver into the project or reach for another SDK: the package is maintained by
Solana Mobile, built on @solana/kit, and covers both directions. Resolution is
framework-agnostic; only the routing around it changes.
npm install @solana-mobile/skr-domain @solana/kit
import { getPrimarySkrDomain, getSkrDomains, normalizeSkrName, resolveSkrDomain } from '@solana-mobile/skr-domain'
import { address, createSolanaRpc } from '@solana/kit'
// Always mainnet, whatever cluster the rest of the app targets.
const rpc = createSolanaRpc(process.env.SOLANA_MAINNET_RPC_URL!)
// Forward: { owner, nameAccount, expiresAt }, or null when unregistered or expired.
const domain = await resolveSkrDomain(rpc, 'alice.skr')
// Reverse: the name the wallet chose, else the first name it owns (sorted), else null.
const wallet = address('5FHw...')
const name = (await getPrimarySkrDomain(rpc, wallet)) ?? (await getSkrDomains(rpc, wallet))[0] ?? null
What the package does, so you do not re-implement it:
Not-found is null (or []), never a throw. A rejection means the RPC failed, so the two
map cleanly onto a 404 and a 503.
Invalid input throws a plain Error. normalizeSkrName accepts alice, Alice.skr and
' alice ', and throws for subdomains, other TLDs, or an empty label. Call it inside a
try/catch to turn bad input into a 400 before spending RPC quota.
Expired names resolve as unregistered, in both directions, with no grace period.
getPrimarySkrDomain re-checks ownership. A MainDomain account is not updated on
transfer, so the package resolves the name forward and only returns it if the wallet still owns
it.
getSkrDomains uses getProgramAccounts, which many providers disable or rate-limit. It
reads labels in batches of 100, one request at a time, so a wallet stuffed with names cannot
set the size of a burst against your quota.
NFT-wrapped names are out of scope. None exist under .skr today; resolveSkrDomain
throws if one appears.
React Native needs a WebCrypto polyfill. Deriving a name address calls
crypto.subtle.digest, which Hermes lacks. Install react-native-quick-crypto and call its
install() at startup, before the package is imported. Node 20.18+, Bun and browsers need nothing.
The package is ESM-only. A CommonJS server needs "type": "module" (or Node 22.12+, which can
require() ES modules).
For ANS records or avatars, which the package does not cover, use the AllDomains SDK — see the
links below.
API shape
Two endpoints, adapted to whatever framework is in use:
Route
Body
Success
Not found
POST /api/resolve-domain
{ domain: "alice.skr" }
{ address }
404
POST /api/resolve-address
{ address: "5FHw..." }
{ domain }
404
Validate input before touching RPC: reject a malformed base58 address or a name that
normalizeSkrName rejects with a 400, so bad input does not consume RPC quota.
Distinguish "no domain registered" (404) from "RPC failed" (503). Collapsing both into 404
makes an outage look like every user having no name.
A proxy that exists to protect an RPC key has to not be an open relay in front of it. The
reverse route costs up to two getAccountInfo calls, a getProgramAccounts, and a batched read
of every name the address owns, so the endpoint needs an origin allowlist, a per-IP rate limit, a
body limit, and a cache that also stores negative results. Require the RPC URL and the origin
list at startup rather than falling back to the public endpoint or to open CORS.
Full Express and Hono implementations, plus notes for Fastify, NestJS, Koa, and Next.js
route handlers: references/server.md.
Client integration
const { data: domain } = useResolveAddress(account?.address)
const label = domain ?? ellipsify(account?.address)
Always fall back to a truncated address. A name that fails to resolve should degrade to
something usable, never to a blank space or a spinner that never resolves.
For an Android emulator, localhost is the emulator itself. Reach the host machine at
http://10.0.2.2:3000. On a physical device use the host's LAN IP. Hard-coding either into
source is what breaks the app for the next person — read it from EXPO_PUBLIC_API_URL, and
gate any emulator fallback on __DEV__: EXPO_PUBLIC_* is inlined at build time, so an
ungated default ships a dead cleartext URL in the release APK, which Android blocks by default
anyway. Nothing with an RPC key belongs in an EXPO_PUBLIC_* variable at all — that is what
the proxy is for.
The snippet above assumes the proxy. If you resolve directly from the app instead, the package
runs under Hermes once the WebCrypto polyfill is installed — call it from the same hook in place
of fetch.
Hook, components, and the truncation helper: references/client.md.
Trusting a reverse-resolved name
The primary name is one the wallet chose. A name from getSkrDomains is not: a .skr transfer
needs nothing from the recipient, so anyone can push a name onto any wallet, and a stranger can
decide what your UI calls a user without a primary name by sending one that sorts early.
Prefer getPrimarySkrDomain, and fall back to getSkrDomains only for display.
Show the name beside the truncated address, not instead of it. The address is the part
a user can actually check.
Where the label stands in for identity — a payee, a counterparty, a moderation surface —
use the primary name only, and fall back to the address.
Cache by direction
Direction
Feeds
Cache
Forward (name → address)
Payment destinations
None. Re-resolve at send time.
Reverse (address → name)
Display labels
Long staleTime; an hour is fine.
Names change rarely, so caching reverse results is nearly free. Forward results are different:
.skr names are transferable and re-registrable, so a forward result cached for an hour and
then used to build a transfer pays whoever owned the name an hour ago, with nothing in the UI
looking wrong. Re-resolve immediately before signing, and put the resolved address in the
confirmation step so the user sees where the funds are actually going.
That has to hold on both sides. A client that re-resolves at send time gets nothing if the
proxy answers from its own forward cache, so the server caches forward misses only and never a
resolved address.
Reference material
references/server.md — Express and Hono implementations, other
frameworks, validation and error handling
references/client.md — resolution hook, display components,
emulator networking
Related skills
solana-mobile-wallet — the wallet connection supplying the address to resolve
seeker-genesis-token — verifying Seeker ownership
Links
@solana-mobile/skr-domain: https://www.npmjs.com/package/@solana-mobile/skr-domain
@solana-mobile/skr-domain source and README: https://github.com/solana-mobile/skr-js/tree/main/packages/skr-domain
AllDomains developer guide: https://docs.alldomains.id/protocol/developer-guide/ad-sdks/svm-sdks/solana-mainnet-sdk
@solana/kit: https://www.npmjs.com/package/@solana/kitdon't have the plugin yet? install it then click "run inline in claude" again.
extracted implicit decision logic into explicit decision points section, documented all external connections with setup guidance, added edge cases (rate limits, auth expiry, cache strategy for transfer security, emulator networking), clarified error response codes and mapping to 400/404/503, and preserved all original procedure steps without invention.
resolve .skr domain names on solana mainnet in both directions: forward from domain names to wallet addresses, and reverse from addresses to domain names. use this skill when you need to show human-readable .skr names instead of truncated wallet addresses in a solana mobile app UI, or when you need to verify domain ownership before initiating transfers. .skr names are alldomains registrations on mainnet; every seeker user gets one by default. resolution always hits mainnet, regardless of which cluster your app targets elsewhere.
npm packages:
@solana-mobile/skr-domain (maintains both forward and reverse resolution; maintained by solana mobile, built on @solana/kit)@solana/kit (rpc client and address utilities)react-native-quick-crypto (required for react native only; installs webCrypto polyfill for hermes)environment variables:
SOLANA_MAINNET_RPC_URL: endpoint for mainnet rpc calls. use a private rpc key if you proxy through a backend; never expose a paid rpc key in expo_public_* variables (readable from apk).EXPO_PUBLIC_API_URL (client-side only): url to your backend proxy, or your emulator's host machine on android. for android emulator use http://10.0.2.2:3000; on physical device use lan ip. do not hardcode; read from env var.optional external connections:
context:
setup (once per project):
install dependencies:
npm install @solana-mobile/skr-domain @solana/kit
if targeting react native, also install and initialize the webCrypto polyfill:
npm install react-native-quick-crypto
call install() at app startup, before importing @solana-mobile/skr-domain.
decide resolution location: client-side (direct against public rpc) or server-side proxy. default to server-side proxy for production apps. choose client-side only for prototypes or low-traffic apps.
if choosing server-side proxy: check your project's existing backend (look for express, fastify, hono, @nestjs/core, koa, next.js in package.json and entry points like server.ts, app.ts, main.ts, routes/, api/, controllers/). add .skr routes to what exists, matching its conventions. scaffold a minimal server only if no backend exists.
set SOLANA_MAINNET_RPC_URL to your mainnet endpoint. if proxying, keep the key server-side. if client-side, use a public endpoint.
forward resolution (domain name to wallet address):
input: domain name string (e.g., "alice.skr" or "alice" or "ALICE").
normalize the input: call normalizeSkrName(domain). this accepts variations like "alice", "alice.skr", "Alice.skr", or " alice " (with whitespace). throws a plain Error for invalid input (subdomains, other tlds, empty labels). catch the error and return a 400 response (client) or validation error (server) before spending rpc quota.
create rpc client pointing to mainnet:
const rpc = createSolanaRpc(process.env.SOLANA_MAINNET_RPC_URL!)
call resolveSkrDomain(rpc, normalizedName). returns { owner, nameAccount, expiresAt } on success, or null if unregistered or expired. never throws on not-found; a throw means rpc failure.
output: wallet address (from the owner field) or null. map null to 404 response; map any rpc throw to 503.
reverse resolution (wallet address to domain name):
input: wallet address string (base58-encoded solana address).
validate address format: call address(walletString) from @solana/kit. throws if malformed. catch and return 400 (bad input) before rpc calls.
create rpc client pointing to mainnet (same as step 7).
attempt primary name: call getPrimarySkrDomain(rpc, wallet). returns the name the wallet chose, or null if none. this re-checks ownership (mainDomain accounts are not updated on transfer). never throws on not-found.
if primary name is null, attempt owned names: call getSkrDomains(rpc, wallet). returns an array of names the wallet owns, sorted alphabetically. take the first entry [0] or null if the array is empty. never throws on not-found.
output: domain name string (from primary name, or first owned name, or null). map null to 404; map any rpc throw to 503.
server-side proxy (if chosen):
expose two http endpoints with these signatures:
POST /api/resolve-domain: body { domain: "alice.skr" }, response { address: "5FHw..." } on success (200), 404 if not registered, 400 if input invalid, 503 if rpc fails.
POST /api/resolve-address: body { address: "5FHw..." }, response { domain: "alice.skr" } on success (200), 404 if no name, 400 if input invalid, 503 if rpc fails.
validate inputs before rpc calls to avoid quota waste on malformed requests. use normalizeSkrName for forward route and address() for reverse route.
implement caching: cache reverse results (address to name) with long staletime (1 hour is safe; names change rarely). cache forward misses only (failed lookups); never cache successful forward results (addresses are transferable and re-registrable; a stale cache pays the wrong recipient).
add origin allowlist, per-ip rate limiting, body size limit, and require the rpc url and origin list at startup (do not fall back to public endpoint or open cors).
client-side resolution (if chosen):
in a react hook or equivalent, import and call the resolution functions directly against the rpc:
import { getPrimarySkrDomain, getSkrDomains, resolveSkrDomain } from '@solana-mobile/skr-domain'
import { address, createSolanaRpc } from '@solana/kit'
const rpc = createSolanaRpc(process.env.SOLANA_MAINNET_RPC_URL!)
const domain = await resolveSkrDomain(rpc, 'alice.skr')
const name = (await getPrimarySkrDomain(rpc, wallet)) ?? (await getSkrDomains(rpc, wallet))[0] ?? null
handle null and error responses: null means not-found (404), throw means rpc failure (503). always fall back to a truncated address in the ui; never show a blank space or spinner.
client-side display:
show the resolved name or truncated address. always pair the name with the truncated address when it matters for identity (payees, counterparties, moderation surfaces). use primary name only for identity; fall back to getSkrDomains for display only.
re-resolve immediately before signing a transaction (forward direction only). put the resolved address in the confirmation step so the user sees where funds are actually going.
set long staletime for reverse caches (address to name display labels). do not cache forward results for use in transfers.
where to run resolution:
existing backend check:
primary vs. owned names (reverse direction):
getPrimarySkrDomain returns a name, use it. the wallet chose it, and it is the only name you should trust for identity.getSkrDomains and take the first entry. this name is owned but not chosen; a stranger may have sent it. use it for display only, never for identity or moderation.input validation failure:
normalizeSkrName throws, return 400 (bad input), do not call rpc.address() throws on a malformed base58 string, return 400, do not call rpc.rpc failure:
forward caching:
emulator vs. physical device:
EXPO_PUBLIC_API_URL env var and gate any emulator fallback on __DEV__. do not hardcode either into source.forward resolution success:
{ "address": "5FHwkk...base58string" }reverse resolution success:
{ "domain": "alice.skr" }not found (name or address not registered):
{ "error": "not found" } or empty bodybad input (malformed domain or address):
{ "error": "invalid input" }normalizeSkrName validation (subdomains, other tlds, empty label, whitespace-only), or the address failed base58 parsing.rpc failure:
{ "error": "service unavailable" }client-side (direct resolution):
forward resolution: you can show the wallet address that owns a domain in a payment destination field or address book, without asking the user to paste a base58 string.
reverse resolution: you can display a human-readable .skr name next to a wallet address in a transaction confirmation, in a user profile, or in a friend list, so the user sees who they are transacting with. the name appears only if it exists; truncated address appears as fallback.
primary name trust: if the name is a primary name (from getPrimarySkrDomain), you can use it for identity checks and security decisions (payee verification, moderation, counterparty trust). if it is a secondary name (from getSkrDomains after primary is null), you show it for display only and always pair it with the address.
cache behavior: reverse (address to name) results are cached for up to an hour, so repeated lookups of the same address return instantly. forward (domain to address) results are never cached, so a transfer always resolves the domain fresh at signing time, paying the current owner.
no ui blocking: if resolution fails, the ui falls back to a truncated address and does not block or show a spinner. a network outage or rpc failure does not freeze the user experience.
error clarity: a 404 tells you the name or address does not exist on mainnet. a 503 tells you the rpc is down or rate-limited. a 400 tells you the input was malformed before you spent quota. this lets you route errors to the right surface (user-facing message, retry logic, monitoring alert).