suix_getReferenceGasPrice{deprecated} - Sui

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

This method is deprecated

Request Example

curl

bashcurl --location --request POST https://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/ \
--header 'Content-Type: application/json' \
--data-raw '{
  "jsonrpc": "2.0",
  "method": "suix_getReferenceGasPrice",
  "params": [],
  "id": "getblock.io"
}'

example.js

javascriptconst axios = require('axios');
axios.post("https://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/", {
  jsonrpc: "2.0", method: "suix_getReferenceGasPrice", params: [], id: "getblock.io"
}).then(r => console.log("Gas Price:", r.data.result));

example.py

pythonimport requests
url = "https://shared.eu-central-1.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"))

example.rs

rustuse 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://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/").json(&payload).send().await?;
    println!("Response: {:?}", response.text().await?);
    Ok(())
}

Response Sample

response.json

json{
  "jsonrpc": "2.0",
  "id": "getblock.io",
  "result": "1000"
}

Response Parameters

ParameterTypeDescription
resultstringReference gas price in MIST per gas unit

Use Cases

  1. Transaction Construction

    Set the appropriate gas price when building transactions.

  2. Cost Estimation

    Calculate expected transaction costs before submission.

  3. Gas Price Monitoring

    Track network gas prices for analytics.

Error Handling

Network Error

  • Description: Connection issues
  • Solution: Check endpoint availability

Web3 Integration

Sui Typescript SDK

jsximport { SuiClient } from '@mysten/sui/client';
const client = new SuiClient({ url: 'https://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/' });
const gasPrice = await client.getReferenceGasPrice();
console.log(gasPrice);