Solana Sign & Broadcast Transaction APIs
We've added two new endpoints to give you fine-grained control over Solana transaction signing and broadcasting.
New Endpoints
🔐 Sign Transaction (POST /v1/solana/sign-transaction)
Sign a Solana transaction without broadcasting it. Perfect for workflows where you need to inspect, store, or conditionally broadcast transactions.
Features:
- Sign serialized transactions or assemble from instructions
- Configure priority fees and compute limits
- Returns both signature and signed transaction payload
Example - Sign from instructions:
curl -X POST https://api.thirdweb.com/v1/solana/sign-transaction \
-H "Content-Type: application/json" \
-H "x-secret-key: YOUR_SECRET_KEY" \
-d '{
"from": "8JBLmveV4YF5AQ7EVnKJgyj6etGgVkPp3tYqQMTu3p5B",
"chainId": "solana:devnet",
"instructions": [
{
"programId": "11111111111111111111111111111111",
"accounts": [
{
"address": "8JBLmveV4YF5AQ7EVnKJgyj6etGgVkPp3tYqQMTu3p5B",
"isSigner": true,
"isWritable": true
},
{
"address": "FhtwVYF1wKAm7fWmE2N5P2eCv13wt2aT8W4Q9NQ9YcJH",
"isSigner": false,
"isWritable": true
}
],
"data": "02000000e803000000000000",
"encoding": "hex"
}
],
"priorityFee": {
"type": "manual",
"microLamportsPerUnit": 1000
}
}'
Response:
{
"result": {
"signature": "3TZx4Ev7fWN7jk7CHTrxmsf9cXB1LQjs44aYGuC9kPYcyJ8D1V8efFgAfL9QGmxZXZMpDnwhzUbBeAf7dByoDwyx",
"signedTransaction": "AQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAgIAAQIDBAUGBwgJ..."
}
}
📡 Broadcast Transaction (POST /v1/solana/broadcast-transaction)
Broadcast a previously signed transaction and wait for confirmation. The endpoint polls the network until the transaction is confirmed or times out after 30 seconds.
Features:
- Broadcasts signed transactions to Solana
- Waits for confirmation before returning
- Detailed error messages for failed transactions
- Returns signature (Solana's equivalent of transaction hash)
Example:
curl -X POST https://api.thirdweb.com/v1/solana/broadcast-transaction \
-H "Content-Type: application/json" \
-H "x-secret-key: YOUR_SECRET_KEY" \
-d '{
"chainId": "solana:devnet",
"signedTransaction": "AQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAgIAAQIDBAUGBwgJ..."
}'
Success Response:
{
"result": {
"signature": "5ttCNobho7nk5F1Hh4pU4d9T2o1yAFn3p1w8z8jk2jKd9KWCKN6dzyuT5xP1ny4wz9f5xCLjAF6Y9s9EoTW4aE1X"
}
}
Error Response (Transaction Failed):
{
"message": "Transaction failed at instruction 0",
"error": {
"transactionError": {
"InstructionError": [0, "InsufficientFunds"]
},
"instructionIndex": 0,
"instructionError": "InsufficientFunds",
"signature": "5ttCNobho7nk5F1Hh4pU4d9T2o1yAFn3p1w8z8jk2jKd9KWCKN6dzyuT5xP1ny4wz9f5xCLjAF6Y9s9EoTW4aE1X"
}
}
Complete Workflow Example
Sign a transaction, then broadcast it:
# Step 1: Sign the transaction
SIGNED_TX=$(curl -X POST https://api.thirdweb.com/v1/solana/sign-transaction \
-H "Content-Type: application/json" \
-H "x-secret-key: YOUR_SECRET_KEY" \
-d '{
"from": "8JBLmveV4YF5AQ7EVnKJgyj6etGgVkPp3tYqQMTu3p5B",
"chainId": "solana:devnet",
"instructions": [...]
}' | jq -r '.result.signedTransaction')
# Step 2: Broadcast the signed transaction
curl -X POST https://api.thirdweb.com/v1/solana/broadcast-transaction \
-H "Content-Type: application/json" \
-H "x-secret-key: YOUR_SECRET_KEY" \
-d "{
\"chainId\": \"solana:devnet\",
\"signedTransaction\": \"$SIGNED_TX\"
}"
Error Handling
The broadcast endpoint provides detailed error information:
- 400: Transaction failed (simulation or on-chain) - includes error details, instruction index, and signature
- 504: Transaction timeout - not confirmed within 30 seconds
- 500: Server error during broadcast
All errors include the transaction signature when available, allowing you to look up the transaction on Solana explorers for debugging.
Notes
- Signature = Transaction Hash: In Solana, the "signature" is equivalent to an EVM transaction hash - use it to look up transactions on explorers
- Confirmation: The broadcast endpoint waits for "confirmed" status before returning (typically 1-2 seconds on Solana)
- Timeout: 30-second maximum wait time for confirmation
- Preflight Checks: Failed transactions are caught during simulation before being sent to the network when possible