Transactions & Fees
getTransaction
Returns transaction details for a given signature
Parameters
Transaction signature (base-58 encoded)
Response
Object containing:
The slot the transaction was processed in
Array of account public keys (base-58 encoded)
Recent blockhash used for transaction
Array of transaction signatures (base-58 encoded)
Error object if transaction failed
Fee paid for the transaction
Array of account balances before the transaction
Array of account balances after the transaction
Array of inner instruction objects
Array of log messages
Array of token balances before the transaction
Array of token balances after the transaction
Array of reward objects
Code Examples
Basic Request
Using web3.js
Notes
- Returns transaction details for a given signature
- The transaction must be confirmed to be returned
- The response includes detailed information about the transaction
- The transaction can be parsed in different encodings
- The transaction must be a valid signature
Best Practices
- Use appropriate commitment level based on your needs
- Cache results when appropriate to reduce RPC load
- Monitor for transaction status changes
- Consider using websocket subscription for real-time updates
- Handle network errors and retry when appropriate
Common Errors
Code | Message | Solution |
---|---|---|
-32601 | Method not found | Verify you’re connected to a Solana RPC node |
-32602 | Invalid params | Check signature and configuration |
-32007 | Transaction not found | Verify the transaction exists |
-32008 | Invalid encoding | Ensure encoding is valid |
Use Cases
-
Transaction Analysis
-
Transaction Monitoring
-
Transaction Planning