getBlockHeight RPC Method
매개변수
객체
객체
로딩 중...
헌신
문자열
로딩 중...
확정됨
문자열
로딩 중...
확인됨
문자열
로딩 중...
처리된
문자열
로딩 중...
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 = 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": "getBlockHeight"16})1718답변 = https.요청(요청)19응답을 넣습니다.read_body20
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": "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 (error) {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 (error) {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
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": "getBlockHeight"16}17"#;18let 응답 = client19.게시물("https://docs-demo.solana-mainnet.quiknode.pro/")20.헤더(헤더))21.본문(json_data)22.보내기()23.await?;2425let 본문 = response.text().await?;26println!("{}", body);2728알겠습니다(())29}30
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": "getBlockHeight"16}17"#;18let 응답 = client19.게시물("https://docs-demo.solana-mainnet.quiknode.pro/")20.헤더(헤더))21.본문(json_data)22.보내기()23.await?;2425let 본문 = response.text().await?;26println!("{}", body);2728알겠습니다(())29}30
답변
1{2"jsonrpc": "2.0",3"result": 313733712,4"id": 15}
1{2"jsonrpc": "2.0",3"result": 313733712,4"id": 15}