SDK Guide
The example above is querying details of a transaction using RPC methods directly. If you are using the Stellar SDK to build applications, you can use the native functions to get the same information.
- Python
- JavaScript
- Java
# pip install --upgrade stellar-sdk
from stellar_sdk import SorobanServer, soroban_rpc
def get_transaction(hash: str) -> soroban_rpc.GetTransactionResponse:
server = SorobanServer(server_url='https://soroban-testnet.stellar.org', client=None)
tx = server.get_transaction(hash)
return tx
tx = get_transaction("6bc97bddc21811c626839baf4ab574f4f9f7ddbebb44d286ae504396d4e752da")
print("result", tx.status)
// yarn add @stellar/stellar-sdk
import { Server } from "@stellar/stellar-sdk/rpc";
const server = new Server("https://soroban-testnet.stellar.org");
// Fetch transaction details
async function getTransactionDetails(hash) {
try {
server.getTransaction(hash).then((tx) => {
console.log({ result: tx });
});
} catch (error) {
console.error("Error fetching transaction:", error);
}
}
getTransactionDetails(
"6bc97bddc21811c626839baf4ab574f4f9f7ddbebb44d286ae504396d4e752da",
);
// implementation 'network.lightsail:stellar-sdk:0.44.0'
import org.stellar.sdk.SorobanServer;
import org.stellar.sdk.responses.sorobanrpc.GetTransactionResponse;
public class GetTransactionExample {
public static void main(String[] args) {
SorobanServer server = new SorobanServer("https://soroban-testnet.stellar.org");
try {
GetTransactionResponse tx = server.getTransaction("6bc97bddc21811c626839baf4ab574f4f9f7ddbebb44d286ae504396d4e752da");
System.out.println("result: " + tx);
} catch (Exception e) {
System.err.println("An error has occurred:");
e.printStackTrace();
}
}
}
Using the Lab
You can use the getTransaction method in the Stellar Laboratory to retrieve details about a specific transaction. This is especially useful for checking the status of a transaction to determine whether it has been successfully recorded on the blockchain.
The default transaction history retention window in stellar-rpc is 24 hours, but this can be adjusted (up to 7 days) for private Soroban RPC instances using the transaction-retention-window configuration setting. For transaction debugging beyond that window, consider indexing the data yourself, using a third-party indexer, or querying Hubble—Stellar’s public BigQuery dataset.
👉 View getTransaction on the Lab

(random image transaction hash)