confirmTransaction
Note: This is a client-side helper method, not a standard Solana JSON-RPC endpoint. It is provided by client libraries such as
@solana/web3.jsand internally usesgetSignatureStatusesto poll for transaction confirmation.
This is a client-side helper method, not a standard Solana JSON-RPC endpoint. It is commonly provided by Solana client libraries (such as @solana/web3.js) to poll for transaction confirmation. Under the hood, it typically calls getSignatureStatuses repeatedly until the transaction reaches the desired commitment level or times out. It simplifies the common pattern of waiting for transaction confirmation after submission.
Parameters
| # | Type | Required | Description |
|---|---|---|---|
| 1 | string | Yes | Transaction signature (base-58 encoded) |
| 2 | object | No | Configuration object |
Configuration object fields:
| Field | Type | Description |
|---|---|---|
commitment | string | Target commitment level: processed, confirmed, or finalized |
Response
Returns an RpcResponse containing the signature status:
| Field | Type | Description |
|---|---|---|
context.slot | u64 | The slot at which the status was evaluated |
value.err | `object | null` |
Code Examples
cURL
curl http://88.216.36.108:7999 -X POST -H "Content-Type: application/json" -d '{
"jsonrpc": "2.0",
"id": 1,
"method": "confirmTransaction",
"params": [
"5VERv8NMvzbJMEkV8xnrLkEaWRtSz9CosKDYjCJjBRnbJLgp8uirBgmQpjKhoR4tjF3ZpRzrFmBV6UjKdiSZkQUW",
{ "commitment": "confirmed" }
]
}'TypeScript
const response = await fetch("http://88.216.36.108:7999", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({
jsonrpc: "2.0",
id: 1,
method: "confirmTransaction",
params: [
"5VERv8NMvzbJMEkV8xnrLkEaWRtSz9CosKDYjCJjBRnbJLgp8uirBgmQpjKhoR4tjF3ZpRzrFmBV6UjKdiSZkQUW",
{ commitment: "confirmed" }
]
}),
});
const { result } = await response.json();
console.log("Transaction confirmed:", result.value.err === null ? "Success" : "Failed");Python
import requests
response = requests.post("http://88.216.36.108:7999", json={
"jsonrpc": "2.0",
"id": 1,
"method": "confirmTransaction",
"params": [
"5VERv8NMvzbJMEkV8xnrLkEaWRtSz9CosKDYjCJjBRnbJLgp8uirBgmQpjKhoR4tjF3ZpRzrFmBV6UjKdiSZkQUW",
{"commitment": "confirmed"}
]
})
result = response.json()["result"]
print(f"Transaction confirmed: {'Success' if result['value']['err'] is None else 'Failed'}")Rust
use reqwest::Client;
use serde_json::json;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let client = Client::new();
let res = client.post("http://88.216.36.108:7999")
.json(&json!({
"jsonrpc": "2.0",
"id": 1,
"method": "confirmTransaction",
"params": [
"5VERv8NMvzbJMEkV8xnrLkEaWRtSz9CosKDYjCJjBRnbJLgp8uirBgmQpjKhoR4tjF3ZpRzrFmBV6UjKdiSZkQUW",
{"commitment": "confirmed"}
]
}))
.send().await?
.text().await?;
println!("{}", res);
Ok(())
}Example Response
{
"jsonrpc": "2.0",
"result": {
"context": { "slot": 166974442 },
"value": {
"err": null
}
},
"id": 1
}