The Server SDK is currently experimental and not ready for production use. Reach out to partnerships@phantom.com for access.
Critical security information
Installation
Install the Server SDK using your preferred package manager:Prerequisites
Before using the SDK, you need:- Phantom organization credentials, provided when you create an organization with Phantom:
- Organization ID
- Organization private key (base58 encoded)
- App ID
- Node.js version 16 or higher.
Quick start
Step 1: Set up environment variables
Create an.env file in your project root:
Step 2: Initialize the SDK
Network support
The SDK supports multiple blockchain networks through theNetworkId enum:
| Network | NetworkId | Description |
|---|---|---|
| Solana | NetworkId.SOLANA_MAINNET | Solana Mainnet-Beta |
NetworkId.SOLANA_DEVNET | Solana Devnet | |
NetworkId.SOLANA_TESTNET | Solana Testnet | |
| Ethereum | NetworkId.ETHEREUM_MAINNET | Ethereum Mainnet |
NetworkId.ETHEREUM_GOERLI | Goerli Testnet | |
NetworkId.ETHEREUM_SEPOLIA | Sepolia Testnet | |
| Polygon | NetworkId.POLYGON_MAINNET | Polygon Mainnet |
NetworkId.POLYGON_MUMBAI | Mumbai Testnet | |
| Optimism | NetworkId.OPTIMISM_MAINNET | Optimism Mainnet |
| Arbitrum | NetworkId.ARBITRUM_ONE | Arbitrum One |
| Base | NetworkId.BASE_MAINNET | Base Mainnet |
| Bitcoin | NetworkId.BITCOIN_MAINNET | Bitcoin Mainnet |
| Sui | NetworkId.SUI_MAINNET | Sui Mainnet |
Usage examples
Creating a wallet
Signing and sending transactions
Solana-native Web3.js transaction objects
Ethereum/EVM-transaction objects
Raw formats-hex strings and bytes
Signing messages
Managing wallets
Next steps
- Create and manage wallets
- Sign and send transactions
- Sign messages for authentication
- Explore the complete API reference
Troubleshooting
”organizationId and appId are required” error
Solutions:- Ensure all required config parameters are provided.
- Check for typos in parameter names.
”Failed to create wallet” error
Solutions:- Verify your organization credentials are correct.
- Check network connectivity to the API endpoint.
- Ensure your organization has wallet creation permissions.
Transaction signing fails
Solutions:- Verify the wallet ID exists and belongs to your organization.
- Check that the transaction is properly formatted.
- Ensure you’re using the correct network ID.
”Unsupported network ID” error
Solutions:- Use one of the predefined
NetworkIdenum values. - Check that the network is supported for your operation.
Need help?
Support
Get help from developer support team
Example apps
Review the example apps