getRecentPerformanceSamples RPC Method
Parameters
limit
string
Loading...
Returns
result
Loading...
numNonVoteTransactions
Loading...
numSlots
Loading...
numTransactions
Loading...
samplePeriodSecs
Loading...
slot
Loading...
Request
curl https://docs-demo.solana-mainnet.quiknode.pro/ \ -X POST \ -H "Content-Type: application/json" \ --data '{"jsonrpc":"2.0", "id":1, "method":"getRecentPerformanceSamples", "params": [4]}'
require "uri" require "json" require "net/http" url = URI("https://docs-demo.solana-mainnet.quiknode.pro/") https = Net::HTTP.new(url.host, url.port) https.use_ssl = true request = Net::HTTP::Post.new(url) request["Content-Type"] = "application/json" request.body = JSON.dump({ "jsonrpc": "2.0", "id": 1, "method": "getRecentPerformanceSamples", "params": [ 4 ] }) response = https.request(request) puts response.read_body
import { createSolanaRpc } from "@solana/kit"; (async () => { const solanaRpc = createSolanaRpc("https://docs-demo.solana-mainnet.quiknode.pro/"); try { const performanceSamples = await solanaRpc.getRecentPerformanceSamples(4).send(); console.log(performanceSamples); } catch (error) { console.error("Error fetching recent performance samples:", error); } })();
const web3 = require("@solana/web3.js"); (async () => { const solana = new web3.Connection("https://docs-demo.solana-mainnet.quiknode.pro/"); console.log(await solana.getRecentPerformanceSamples(4)); })();
from jsonrpcclient import request, parse, Ok import logging import requests response = requests.post("https://docs-demo.solana-mainnet.quiknode.pro/", json=request("getRecentPerformanceSamples", params=(4))) parsed = parse(response.json()) if isinstance(parsed, Ok): print(parsed.result) else: logging.error(parsed.message)
use reqwest::header; use reqwest::Client; use std::error::Error; #[tokio::main] async fn main() -> Result<(), Box<dyn Error>> { let mut headers = header::HeaderMap::new(); headers.insert("Content-Type", "application/json".parse().unwrap()); let client = Client::new(); let json_data = r#" { "jsonrpc": "2.0", "id": 1, "method": "getRecentPerformanceSamples", "params": [ 4 ] } "#; let response = client .post("https://docs-demo.solana-mainnet.quiknode.pro/") .headers(headers) .body(json_data) .send() .await?; let body = response.text().await?; println!("{}", body); Ok(()) }
Response
{ "jsonrpc": "2.0", "result": [ { "numNonVoteTransactions": 69449, "numSlots": 149, "numTransactions": 263299, "samplePeriodSecs": 60, "slot": 335501725 }, { "numNonVoteTransactions": 70649, "numSlots": 155, "numTransactions": 272267, "samplePeriodSecs": 60, "slot": 335501576 }, { "numNonVoteTransactions": 68091, "numSlots": 148, "numTransactions": 260843, "samplePeriodSecs": 60, "slot": 335501421 }, { "numNonVoteTransactions": 76046, "numSlots": 153, "numTransactions": 274847, "samplePeriodSecs": 60, "slot": 335501273 } ], "id": 1 }
Don't have an account yet?
Create your QuickNode endpoint in seconds and start building
Get started for free