Source
get_transaction_countParameters
config
Configuration object containing the following fields:
Result
result
The current Transaction count from the ledger
Documentation Index
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
RPC methods
CLI reference
Network constants
curl https://api.devnet.solana.com -s -X POST \
-H "Content-Type: application/json" \
-d '
{
"jsonrpc": "2.0",
"id": 1,
"method": "getTransactionCount",
"params": [
{
"commitment": "finalized"
}
]
}
'
import { createSolanaRpc } from "@solana/kit";
const rpc_url = "https://api.devnet.solana.com";
const rpc = createSolanaRpc(rpc_url);
let txCount = await rpc.getTransactionCount().send();
console.log(txCount);
import { Connection, clusterApiUrl } from "@solana/web3.js";
const connection = new Connection(clusterApiUrl("devnet"), "confirmed");
let txCount = await connection.getTransactionCount();
console.log(txCount);
use anyhow::Result;
use solana_client::nonblocking::rpc_client::RpcClient;
use solana_commitment_config::CommitmentConfig;
#[tokio::main]
async fn main() -> Result<()> {
let client = RpcClient::new_with_commitment(
String::from("https://api.devnet.solana.com"),
CommitmentConfig::confirmed(),
);
let tx_count = client.get_transaction_count().await?;
println!("{:#?}", tx_count);
Ok(())
}
{
"jsonrpc": "2.0",
"result": 268,
"id": 1
}
Returns the total number of transactions processed at the requested commitment.
curl https://api.devnet.solana.com -s -X POST \
-H "Content-Type: application/json" \
-d '
{
"jsonrpc": "2.0",
"id": 1,
"method": "getTransactionCount",
"params": [
{
"commitment": "finalized"
}
]
}
'
import { createSolanaRpc } from "@solana/kit";
const rpc_url = "https://api.devnet.solana.com";
const rpc = createSolanaRpc(rpc_url);
let txCount = await rpc.getTransactionCount().send();
console.log(txCount);
import { Connection, clusterApiUrl } from "@solana/web3.js";
const connection = new Connection(clusterApiUrl("devnet"), "confirmed");
let txCount = await connection.getTransactionCount();
console.log(txCount);
use anyhow::Result;
use solana_client::nonblocking::rpc_client::RpcClient;
use solana_commitment_config::CommitmentConfig;
#[tokio::main]
async fn main() -> Result<()> {
let client = RpcClient::new_with_commitment(
String::from("https://api.devnet.solana.com"),
CommitmentConfig::confirmed(),
);
let tx_count = client.get_transaction_count().await?;
println!("{:#?}", tx_count);
Ok(())
}
{
"jsonrpc": "2.0",
"result": 268,
"id": 1
}
get_transaction_countShow propertiesHide properties
processed, confirmed, finalizedSolana RPC uses the following commitment levels:| Value | Description |
|---|---|
processed | Return data from the highest slot this node has processed. This is the newest view, but the block can still be skipped. |
confirmed | Return data from the same slot as finalized. Kept for compatibility and planned for removal in a later release. |
finalized | Return data from the highest slot with a finalization certificate, from votes by 80% of stake in one round or 60% of stake in each of two rounds. This is the strongest commitment level. |
{ "minContextSlot": 341197000 }