getBlocks RPC Method
Please note: For this RPC method, the block range defined by the start and end slots is limited to a maximum of 5 slots for a free trial account and 1,005 slots for paid accounts.
パラメータ
start_slot
文字列
必須
読み込み中...
end_slot
文字列
読み込み中...
オブジェクト
オブジェクト
読み込み中...
commitment
文字列
読み込み中...
finalized
文字列
読み込み中...
confirmed
文字列
読み込み中...
返品
結果
読み込み中...
リクエスト
1curl https://docs-demo.solana-mainnet.quiknode.pro/ \2-X POST \3-H "Content-Type: application/json" \4-d '{5"jsonrpc": "2.0",6"id":1,7"method":"getBlocks",8"params":[335819351, 335819361]9}'
1curl https://docs-demo.solana-mainnet.quiknode.pro/ \2-X POST \3-H "Content-Type: application/json" \4-d '{5"jsonrpc": "2.0",6"id":1,7"method":"getBlocks",8"params":[335819351, 335819361]9}'
1require "uri"2require "json"3require "net/http"45url = URI("https://docs-demo.solana-mainnet.quiknode.pro/")67https = ネット::HTTP.new(url.ホスト, url.ポート)8https.use_ssl = true910リクエスト = ネット::HTTP::POST.new(URL)11リクエスト["Content-Type"] = "application/json"12リクエスト.本文 = JSON.dump({13"jsonrpc": "2.0",14"id": 1,15"method": "getBlocks",16"params": [175,181019]20})2122回答 = https.リクエスト(リクエスト)23レスポンスを格納する.read_body24
1require "uri"2require "json"3require "net/http"45url = URI("https://docs-demo.solana-mainnet.quiknode.pro/")67https = ネット::HTTP.new(url.ホスト, url.ポート)8https.use_ssl = true910リクエスト = ネット::HTTP::POST.new(URL)11リクエスト["Content-Type"] = "application/json"12リクエスト.本文 = JSON.dump({13"jsonrpc": "2.0",14"id": 1,15"method": "getBlocks",16"params": [175,181019]20})2122回答 = https.リクエスト(リクエスト)23レスポンスを格納する.read_body24
1import { createSolanaRpc } from "@solana/kit";23(async () => {4const solanaRpc = createSolanaRpc("https://docs-demo.solana-mainnet.quiknode.pro/");56試す {7const blocks = await solanaRpc.getBlocks(BigInt(5), BigInt(10)).send();8console.log("Blocks:", blocks);9} catch (エラー) {10console.error("Error fetching blocks:", error);11}12})();
1import { createSolanaRpc } from "@solana/kit";23(async () => {4const solanaRpc = createSolanaRpc("https://docs-demo.solana-mainnet.quiknode.pro/");56試す {7const blocks = await solanaRpc.getBlocks(BigInt(5), BigInt(10)).send();8console.log("Blocks:", blocks);9} catch (エラー) {10console.error("Error fetching blocks:", error);11}12})();
1const web3 = require("@solana/web3.js");2(async () => {3const solana = new web3.Connection("https://docs-demo.solana-mainnet.quiknode.pro/");4console.log(await solana.getBlocks(5, 10));5})();6
1const web3 = require("@solana/web3.js");2(async () => {3const solana = new web3.Connection("https://docs-demo.solana-mainnet.quiknode.pro/");4console.log(await solana.getBlocks(5, 10));5})();6
1from solana.rpc.api import Client2solana_client = Client("https://docs-demo.solana-mainnet.quiknode.pro/")3print(solana_client.get_blocks(5, 10))
1from solana.rpc.api import Client2solana_client = Client("https://docs-demo.solana-mainnet.quiknode.pro/")3print(solana_client.get_blocks(5, 10))
1use reqwest::ヘッダー;2use reqwest::クライアント;3use std::error::エラー;45#[tokio::main]6async fn main() -> Result<(), Box<dyn Error>> {7let mut ヘッダー = header::ヘッダーマップ::new();8ヘッダー.挿入("Content-Type", "application/json".parse().unwrap());910let クライアント client= クライアント::new();11let json_data = r#"12{13"jsonrpc": "2.0",14"id": 1,15"method": "getBlocks",16"params": [175,181019]20}21"#;22let レスポンス レスポンス= クライアント23.投稿(「https://docs-demo.solana-mainnet.quiknode.pro/」)24.ヘッダー(ヘッダー)25.本文(json_data)26.送信()27.await?;2829let body = レスポンス.text().await?;30println!("{}", body);3132OK(())33}34
1use reqwest::ヘッダー;2use reqwest::クライアント;3use std::error::エラー;45#[tokio::main]6async fn main() -> Result<(), Box<dyn Error>> {7let mut ヘッダー = header::ヘッダーマップ::new();8ヘッダー.挿入("Content-Type", "application/json".parse().unwrap());910let クライアント client= クライアント::new();11let json_data = r#"12{13"jsonrpc": "2.0",14"id": 1,15"method": "getBlocks",16"params": [175,181019]20}21"#;22let レスポンス レスポンス= クライアント23.投稿(「https://docs-demo.solana-mainnet.quiknode.pro/」)24.ヘッダー(ヘッダー)25.本文(json_data)26.送信()27.await?;2829let body = レスポンス.text().await?;30println!("{}", body);3132OK(())33}34
回答
1{2"jsonrpc": "2.0",3"結果": [45,56,67,78,89,91010],11"id": 112}
1{2"jsonrpc": "2.0",3"結果": [45,56,67,78,89,91010],11"id": 112}