suix_getReferenceGasPrice - Sui
Example code for the suix_getReferenceGasPrice JSON-RPC method. Complete guide on how to use suix_getReferenceGasPrice JSON-RPC in GetBlock Web3 documentation.
This method returns the reference gas price for the current epoch on the SUI network. This minimum gas price is determined by validator voting and is essential for setting appropriate transaction gas budgets.
Parameters
None
Request Example
curl --location --request POST https://go.getblock.io/<ACCESS-TOKEN>/ \
--header 'Content-Type: application/json' \
--data-raw '{
"jsonrpc": "2.0",
"method": "suix_getReferenceGasPrice",
"params": [],
"id": "getblock.io"
}'const axios = require('axios');
axios.post("https://go.getblock.io/<ACCESS-TOKEN>/", {
jsonrpc: "2.0", method: "suix_getReferenceGasPrice", params: [], id: "getblock.io"
}).then(r => console.log("Gas Price:", r.data.result));import requests
url = "https://go.getblock.io/<ACCESS-TOKEN>/"
payload = {"jsonrpc": "2.0", "method": "suix_getReferenceGasPrice", "params": [], "id": "getblock.io"}
response = requests.post(url, headers={"Content-Type": "application/json"}, json=payload)
print("Gas Price:", response.json().get("result"))use reqwest::Client;
use serde_json::json;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let client = Client::new();
let payload = json!({"jsonrpc": "2.0", "id": "getblock.io", "method": "suix_getReferenceGasPrice", "params": []});
let response = client.post("https://go.getblock.io/<ACCESS-TOKEN>/").json(&payload).send().await?;
println!("Response: {:?}", response.text().await?);
Ok(())
}Response Sample
{
"jsonrpc": "2.0",
"id": "getblock.io",
"result": "1000"
}Response Parameters
result
string
Reference gas price in MIST per gas unit
Use Cases
Transaction Construction
Set the appropriate gas price when building transactions.
Cost Estimation
Calculate expected transaction costs before submission.
Gas Price Monitoring
Track network gas prices for analytics.
Error Handling
Network Error
Description: Connection issues
Solution: Check endpoint availability
Web3 Integration
Last updated
Was this helpful?