The Server SDK is currently experimental and not ready for production use. Reach out to partnerships@phantom.com for access.
Overview
The SDK provides two methods for handling transactions:signAndSendTransactionsigns the transaction and submits it to the network in one step.signTransactionsigns the transaction and returns it without submitting. Use this when you need to broadcast the transaction yourself or inspect the signed payload before sending.
Sign without sending
UsesignTransaction when you want to sign a transaction without broadcasting it. This is useful when:
- You want to broadcast via your own RPC endpoint or a relay service.
- You need to inspect the signed transaction before sending.
- You are collecting multiple signatures before submission.
Solana example
Ethereum example
Sign and send
UsesignAndSendTransaction when you want the SDK to handle both signing and network submission.
Basic Solana transfer
The following is a complete example of sending SOL from one address to another:Complete example with priority fees
Based on the SDK demo, the following example shows how to send a transaction with priority fees:Best practices
- The SDK handles both signing AND sending: You don’t need to manually submit transactions.
- Always use fresh blockhashes: Get a new blockhash right before creating the transaction.
- Extract signatures from the result: The SDK returns the signed transaction, not the signature directly.
- Handle confirmations separately: The SDK sends the transaction but doesn’t wait for confirmation.
- Use proper error handling: Network issues and blockchain errors can occur.