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 apps 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 apps: Automate complex DeFi interactions and transaction flows
  • NFT marketplaces: Enable smooth NFT minting and trading experiences
  • Enterprise solutions: Build blockchain apps for businesses with compliance requirements

Documentation overview

1

Get started

Learn the basics of the Server SDK, installation, and initial setup.Get started →
2

Integration guide

Follow our comprehensive guide to integrate the SDK into your backend app.Integration guide →
3

Create wallets

Learn how to programmatically create and manage wallets for your users.Create wallets →
4

Sign transactions

Understand how to sign and submit transactions across different blockchains.Sign transactions →
5

Sign messages

Learn how to sign arbitrary messages for authentication and verification.Sign messages →
6

API reference

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

Prerequisites

  • Register your app: Sign up or log in to the Phantom Portal and register your app.
  • Get your App ID:
    • In the portal, expand your app in the left navigation, then select Set Up.
    • Your App ID appears at the top of the page.

Quick start

Step 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

Step 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 Server SDK uses the NetworkId enum to identify blockchain networks for signing transactions and messages.

Solana Networks

  • NetworkId.SOLANA_MAINNET - Solana Mainnet-Beta
  • NetworkId.SOLANA_DEVNET - Solana Devnet
  • NetworkId.SOLANA_TESTNET - Solana Testnet

Ethereum Networks

  • NetworkId.ETHEREUM_MAINNET - Ethereum Mainnet
  • NetworkId.ETHEREUM_SEPOLIA - Sepolia Testnet

Polygon Networks

  • NetworkId.POLYGON_MAINNET - Polygon Mainnet (Chain ID: 137)
  • NetworkId.POLYGON_AMOY - Polygon Amoy Testnet (Chain ID: 80002)

Base Networks

  • NetworkId.BASE_MAINNET - Base Mainnet (Chain ID: 8453)
  • NetworkId.BASE_SEPOLIA - Base Sepolia Testnet (Chain ID: 84532)

Arbitrum Networks

  • NetworkId.ARBITRUM_ONE - Arbitrum One (Chain ID: 42161)
  • NetworkId.ARBITRUM_SEPOLIA - Arbitrum Sepolia Testnet (Chain ID: 421614)

Monad Networks

  • NetworkId.MONAD_MAINNET - Monad Mainnet (Chain ID: 143)
  • NetworkId.MONAD_TESTNET - Monad Testnet (Chain ID: 10143)

Future Support

  • NetworkId.BITCOIN_MAINNET - Bitcoin Mainnet
  • NetworkId.BITCOIN_TESTNET - Bitcoin Testnet
  • NetworkId.SUI_MAINNET - Sui Mainnet
  • NetworkId.SUI_TESTNET - Sui Testnet
  • NetworkId.SUI_DEVNET - Sui Devnet

Support


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

What you can do

Additional resources

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.