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
문자열
로딩 중...
객체
객체
로딩 중...
헌신
문자열
로딩 중...
확정됨
문자열
로딩 중...
확인됨
문자열
로딩 중...
반품
결과
로딩 중...
요청
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 = Net::HTTP.new(url.호스트, url.포트)8https.use_ssl = true910요청 = 순::HTTP::POST.새(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 = Net::HTTP.new(url.호스트, url.포트)8https.use_ssl = true910요청 = 순::HTTP::POST.새(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 (error) {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 (error) {10console.error("Error fetching blocks:", error);11}12})();
1const web3 = require("@solana/web3.js");2(async () => {3const 솔라나 = new web3.연결("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 솔라나 = new web3.연결("https://docs-demo.solana-mainnet.quiknode.pro/");4console.log(await solana.getBlocks(5, 10));5})();6
1출처: 솔라나.rpc.api import Client2solana_client = 클라이언트("https://docs-demo.solana-mainnet.quiknode.pro/")3print(solana_client.get_blocks(5, 10))
1출처: 솔라나.rpc.api import Client2solana_client = 클라이언트("https://docs-demo.solana-mainnet.quiknode.pro/")3print(solana_client.get_blocks(5, 10))
1사용 reqwest::헤더;2사용 reqwest::클라이언트;3사용 std::error::오류;45#[tokio::main]6async fn main() -> Result<(), Box<dyn Error>> {7let mut 헤더 = header::헤더맵::새();8헤더.삽입("Content-Type", "application/json".parse().unwrap());910let 클라이언트 client = Client::new();11let json_data = r#"12{13"jsonrpc": "2.0",14"id": 1,15"method": "getBlocks",16"params": [175,181019]20}21"#;22let 응답 = client23.게시물("https://docs-demo.solana-mainnet.quiknode.pro/")24.헤더(헤더))25.본문(json_data)26.보내기()27.await?;2829let 본문 = response.text().await?;30println!("{}", body);3132알겠습니다(())33}34
1사용 reqwest::헤더;2사용 reqwest::클라이언트;3사용 std::error::오류;45#[tokio::main]6async fn main() -> Result<(), Box<dyn Error>> {7let mut 헤더 = header::헤더맵::새();8헤더.삽입("Content-Type", "application/json".parse().unwrap());910let 클라이언트 client = Client::new();11let json_data = r#"12{13"jsonrpc": "2.0",14"id": 1,15"method": "getBlocks",16"params": [175,181019]20}21"#;22let 응답 = client23.게시물("https://docs-demo.solana-mainnet.quiknode.pro/")24.헤더(헤더))25.본문(json_data)26.보내기()27.await?;2829let 본문 = response.text().await?;30println!("{}", body);3132알겠습니다(())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}