Skip to main content
The Server SDK is currently experimental and not ready for production use.
The Phantom Server SDK enables backend applications to securely create and manage wallets, sign transactions, and interact with multiple blockchains programmatically. This enterprise-grade solution is designed for server-side applications that require secure, scalable wallet infrastructure.
Access Required: Please reach out to partnerships@phantom.com to get access to the Server SDK.

What is the Server SDK?

The Server SDK is a Node.js library that provides programmatic access to Phantom’s wallet infrastructure from your backend services. Unlike browser-based wallet interactions, the Server SDK allows you to:
  • Create and manage wallets on behalf of your users
  • Sign transactions and messages programmatically
  • Submit transactions to multiple blockchains

Key Features

  • Works seamlessly with Solana, Ethereum, Polygon, Sui, Bitcoin, Base, and other major blockchains
  • Enterprise-grade security with cryptographic authentication and secure key management
  • Full API access for wallet creation, transaction signing, and blockchain interactions
  • Built to handle high-volume applications with efficient wallet management and pagination

Use Cases

The Server SDK is ideal for:
  • Gaming Platforms: Create seamless blockchain gaming experiences without requiring users to manage wallets
  • DeFi Applications: Automate complex DeFi interactions and transaction flows
  • NFT Marketplaces: Enable smooth NFT minting and trading experiences
  • Enterprise Solutions: Build blockchain applications for businesses with compliance requirements

Documentation Overview

1

Getting Started

Learn the basics of the Server SDK, installation, and initial setup.Read Getting Started →
2

Integration Guide

Follow our comprehensive guide to integrate the SDK into your backend application.Read Integration Guide →
3

Creating Wallets

Learn how to programmatically create and manage wallets for your users.Read Creating Wallets →
4

Signing Transactions

Understand how to sign and submit transactions across different blockchains.Read Signing Transactions →
5

Signing Messages

Learn how to sign arbitrary messages for authentication and verification.Read Signing Messages →
6

API Reference

Complete reference documentation for all SDK methods and types.Read API Reference →

Prerequisites

  • Register your application
    Sign up or log in to the Phantom Portal and register your application.
  • Obtain your App ID
    • In the Portal, go to your app and open URL Config (left-hand menu).
    • This page shows your allowed origins and redirect URLs.
    • Scroll down to the App ID section at the bottom of the page — your App ID is listed there, below the URL configurations.
    • Copy the App ID for use in your integration.

Quick Start

1. Set up Environment Variables

Create a .env file in your project root:
APP_ID=your-app-id
ORGANIZATION_ID=your-organization-id
PRIVATE_KEY=your-base58-encoded-private-key

2. Initialize the SDK

import { ServerSDK, NetworkId } from "@phantom/server-sdk";
import dotenv from "dotenv";

// Load environment variables
dotenv.config();

// Initialize the SDK
const sdk = new ServerSDK({
  organizationId: process.env.ORGANIZATION_ID!,
  apiPrivateKey: process.env.PRIVATE_KEY!,
  appId: process.env.APP_ID!,
});

// Create a wallet
const wallet = await sdk.createWallet("My First Wallet");
console.log("Wallet ID:", wallet.walletId);
console.log("Addresses:", wallet.addresses);

// Sign a message
const signature = await sdk.signMessage({
  walletId: wallet.walletId,
  message: "Hello, Phantom!",
  networkId: NetworkId.SOLANA_MAINNET,
});
console.log("Signature:", signature);

Usage Examples

Creating a Wallet

// Create a wallet with a custom name
const wallet = await sdk.createWallet("User Wallet 123");

// Access addresses for different chains
const solanaAddress = wallet.addresses.find(addr => addr.addressType === "Solana")?.address;
const ethereumAddress = wallet.addresses.find(addr => addr.addressType === "Ethereum")?.address;

console.log("Solana address:", solanaAddress);
console.log("Ethereum address:", ethereumAddress);

Signing and Sending Transactions

Solana - Native Web3.js Transaction Objects

import { Transaction, SystemProgram, PublicKey } from "@solana/web3.js";

// Create a Solana transaction
const transaction = new Transaction().add(
  SystemProgram.transfer({
    fromPubkey: new PublicKey(solanaAddress),
    toPubkey: new PublicKey(recipientAddress),
    lamports: 1000000, // 0.001 SOL
  }),
);

// Set transaction parameters
transaction.recentBlockhash = blockhash;
transaction.feePayer = new PublicKey(solanaAddress);

// Sign and send the transaction
const signedTx = await sdk.signAndSendTransaction({
  walletId: wallet.walletId,
  transaction,
  networkId: NetworkId.SOLANA_MAINNET,
});

console.log("Signed transaction:", signedTx.rawTransaction);

Ethereum/EVM - Transaction Objects

// Viem transaction object
const evmTransaction = {
  to: "0x742d35Cc6634C0532925a3b8D4C8db86fB5C4A7E",
  value: 1000000000000000000n, // 1 ETH in wei
  data: "0x",
  gasLimit: 21000n,
};

const signedEvmTx = await sdk.signAndSendTransaction({
  walletId: wallet.walletId,
  transaction: evmTransaction, // Native EVM transaction object
  networkId: NetworkId.ETHEREUM_MAINNET,
});

Raw Formats - Hex Strings and Bytes

// Hex string transaction
await sdk.signAndSendTransaction({
  walletId: wallet.walletId,
  transaction: "0x02f8710182013685012a05f2008301388094742d35cc...", // Raw hex
  networkId: NetworkId.ETHEREUM_MAINNET,
});

// Raw bytes
const transactionBytes = new Uint8Array([1, 2, 3, 4, 5 /* ... */]);
await sdk.signAndSendTransaction({
  walletId: wallet.walletId,
  transaction: transactionBytes,
  networkId: NetworkId.SOLANA_MAINNET,
});

Signing Messages

const solanaSignature = await sdk.signMessage({
  walletId: wallet.walletId,
  message: "Please sign this message to authenticate",
  networkId: NetworkId.SOLANA_MAINNET,
});

// Unicode messages work too
const unicodeSignature = await sdk.signMessage({
  walletId: wallet.walletId,
  message: "🚀 Welcome to Web3! 你好世界", // Unicode text
  networkId: NetworkId.SOLANA_MAINNET,
});

const ethSignature = await sdk.signMessage({
  walletId: wallet.walletId,
  message: "Sign in to our dApp",
  networkId: NetworkId.ETHEREUM_MAINNET,
});

Managing Wallets

// Get all wallets for your organization with pagination
const result = await sdk.getWallets(20, 0); // limit: 20, offset: 0

console.log(`Total wallets: ${result.totalCount}`);
console.log("Wallets:", result.wallets);

// Get addresses for a specific wallet
const addresses = await sdk.getWalletAddresses(walletId);

// Get specific addresses by derivation path
const customAddresses = await sdk.getWalletAddresses(
  walletId,
  ["m/44'/501'/0'/0'", "m/44'/60'/0'/0/0"], // Solana and Ethereum
);

Network Support

The SDK supports multiple blockchain networks through the NetworkId enum

Support


Ready to get started? Check out our Getting Started guide to begin building with the Phantom Server SDK.

Disclaimers

The Server SDK is a beta version, and Phantom will not be liable for any losses or damages suffered by you or your end users. Any suggestions, enhancement requests, recommendations, or other feedback provided by you regarding the Server SDK will be the exclusive property of Phantom. By using this beta version and providing feedback, you agree to assign any rights in that feedback to Phantom.
I