getBlockHeight RPC Method
パラメータ
オブジェクト
オブジェクト
読み込み中...
commitment
文字列
読み込み中...
finalized
文字列
読み込み中...
confirmed
文字列
読み込み中...
processed
文字列
読み込み中...
minContextSlot
整数
読み込み中...
返品
結果
読み込み中...
リクエスト
1curl https://docs-demo.solana-mainnet.quiknode.pro/ \2-X POST \3-H "Content-Type: application/json" \4--data '{"jsonrpc":"2.0","id":1, "method":"getBlockHeight"}'
1curl https://docs-demo.solana-mainnet.quiknode.pro/ \2-X POST \3-H "Content-Type: application/json" \4--data '{"jsonrpc":"2.0","id":1, "method":"getBlockHeight"}'
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": "getBlockHeight"16})1718回答 = https.リクエスト(リクエスト)19レスポンスを格納する.read_body20
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": "getBlockHeight"16})1718回答 = https.リクエスト(リクエスト)19レスポンスを格納する.read_body20
1import { createSolanaRpc } from "@solana/kit";23(async () => {4const solanaRpc = createSolanaRpc("https://docs-demo.solana-mainnet.quiknode.pro/");56試す {7const blockHeight = await solanaRpc.getBlockHeight().send();8console.log(blockHeight);9} catch (エラー) {10console.error("Error fetching block height:", error);11}12})();
1import { createSolanaRpc } from "@solana/kit";23(async () => {4const solanaRpc = createSolanaRpc("https://docs-demo.solana-mainnet.quiknode.pro/");56試す {7const blockHeight = await solanaRpc.getBlockHeight().send();8console.log(blockHeight);9} catch (エラー) {10console.error("Error fetching block height:", error);11}12})();
1const web3 = require("@solana/web3.js");2(async () => {3const SOLANA_CONNECTION = new web3.Connection("https://docs-demo.solana-mainnet.quiknode.pro/");4console.log(5await SOLANA_CONNECTION.getBlockHeight(94101948)6);7})();
1const web3 = require("@solana/web3.js");2(async () => {3const SOLANA_CONNECTION = new web3.Connection("https://docs-demo.solana-mainnet.quiknode.pro/");4console.log(5await SOLANA_CONNECTION.getBlockHeight(94101948)6);7})();
1from jsonrpcclient import request, parse, Ok2import logging3import リクエスト4response = requests.post("https://docs-demo.solana-mainnet.quiknode.pro/", json=request("getBlockHeight"))5parsed = parse(response.json())6if isinstance(parsed, Ok):7print(parsed.result)8else:9logging.error(parsed.message)10
1from jsonrpcclient import request, parse, Ok2import logging3import リクエスト4response = requests.post("https://docs-demo.solana-mainnet.quiknode.pro/", json=request("getBlockHeight"))5parsed = parse(response.json())6if isinstance(parsed, Ok):7print(parsed.result)8else:9logging.error(parsed.message)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": "getBlockHeight"16}17"#;18let レスポンス レスポンス= クライアント19.投稿(「https://docs-demo.solana-mainnet.quiknode.pro/」)20.ヘッダー(ヘッダー)21.本文(json_data)22.送信()23.await?;2425let body = レスポンス.text().await?;26println!("{}", body);2728OK(())29}30
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": "getBlockHeight"16}17"#;18let レスポンス レスポンス= クライアント19.投稿(「https://docs-demo.solana-mainnet.quiknode.pro/」)20.ヘッダー(ヘッダー)21.本文(json_data)22.送信()23.await?;2425let body = レスポンス.text().await?;26println!("{}", body);2728OK(())29}30
回答
1{2"jsonrpc": "2.0",3"result": 313733712,4"id": 15}
1{2"jsonrpc": "2.0",3"result": 313733712,4"id": 15}