Overview
Phantom is a popular non-custodial crypto wallet that enables users to manage digital assets and interact with decentralized applications across multiple chains (including Solana, Ethereum-compatible chains, and others). Developers integrate Phantom to request account access, sign messages/transactions, and enable smooth dApp user flows.
Purpose of this document
This introduction provides a compact, practical orientation for engineering teams: what APIs and SDKs are available, recommended integration patterns, and where to find authoritative documentation and examples.
SDKs & Integration Options
Browser / Web SDK
Phantom typically injects a provider into the browser (`window.phantom` / `window.ethereum`) so dApps can request connections and send transaction requests following EIP-1193-style provider semantics.
React & Frontend
There are community and official SDKs and UI components (React hooks and modal components) that simplify connecting, requesting signatures, and handling account changes.
Mobile & Deeplinks
The Phantom mobile app supports deep links that let mobile dApps open Phantom for authentication, signing, and transaction flows — an essential pattern for native mobile dApp experiences.
Provider API
Core capabilities
The provider API exposes methods for connecting accounts, reading public addresses, signing messages, and requesting transactions. It also supports chain-specific signing methods (e.g., for Bitcoin PSBT signing on supported networks).
Common flows
- Initialize provider check (is Phantom available).
- Request user connection/permission.
- Read account(s) and chain details.
- Create a transaction payload; request signature and submission.
Error handling & UX
Always surface clear user prompts for approvals and gracefully handle declines, timeouts, and unsupported chain errors. Provide fallback messaging when Phantom is not installed or the user is on an unsupported device.
Deeplinks & Mobile Integration
Why deeplinks matter
Deeplinks allow a mobile website or app to redirect the user into the Phantom mobile client to complete authentication/signing. The user returns to the originating app once the action completes, enabling frictionless mobile flows.
Best practices
- Always include state or a nonce to prevent replay and ensure the flow can be validated when control returns.
- Provide fallback instructions if the device lacks Phantom (deep link fallbacks to install page or universal link).
Security, permissions, and privacy
Principles
Limit requested permissions to the minimum required; never request access or signing for actions the user did not explicitly initiate. Use clear language in UX about what signing entails.
Testing & developer settings
Phantom's developer settings (extension & mobile) provide tools for debugging and simulated flows. Use testnets and canonical examples when validating integration behavior.
Examples & Code Patterns
Typical connection snippet (vanilla JS)
// Example: detect Phantom and request connection
if (window.phantom && window.phantom.ethereum) {
try {
const resp = await window.phantom.ethereum.request({ method: 'eth_requestAccounts' });
console.log('Connected accounts', resp);
} catch (err) {
console.error('User rejected or error', err);
}
} else {
console.log('Phantom provider not found; show install instructions.');
}
React usage (conceptual)
Use a context/provider to hold wallet state, expose connect/disconnect methods, and centralize error handling and UI fallbacks.
Resources & Official Links
Below are authoritative documentation resources, SDKs, and reference pages you should bookmark while developing with Phantom.
- Phantom Developer Docs (main)
- Provider API Reference (Bitcoin & PSBT examples)
- Phantom — Developers hub
- Phantom Wallet SDK (GitHub)
- Deeplinks guide
- Provider details & EIP-1193 notes
- Legacy / app docs & API index
- Phantom status page
- Developer settings & troubleshooting (help center)
- API summary / reference portal
Contact & community
Support channels
For integration issues, consult the official docs first, then use Phantom’s community channels or GitHub repos for developer-specific questions and bug reports.
Final notes
Start with small read-only integrations, validate user flows on testnets, and progressively add signing and transaction flows. Clear UX for permissions and helpful fallback messaging dramatically improves adoption and reduces support requests.