cURL
curl --request POST \
--url https://api.example.com/gas_price \
--header 'Content-Type: application/json' \
--data '
{
"method": "gas_price",
"params": {
"block_id": 1
},
"id": "dontcare",
"jsonrpc": "2.0"
}
'const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({method: 'gas_price', params: {block_id: 1}, id: 'dontcare', jsonrpc: '2.0'})
};
fetch('https://api.example.com/gas_price', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.example.com/gas_price"
payload = {
"method": "gas_price",
"params": { "block_id": 1 },
"id": "dontcare",
"jsonrpc": "2.0"
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text){
"result": {
"gas_price": "<string>"
},
"id": "<string>",
"jsonrpc": "<string>"
}Post gas price
Returns gas price for a specific block_height or block_hash. Using [null] will return the most recent block’s gas price.
POST
/
gas_price
cURL
curl --request POST \
--url https://api.example.com/gas_price \
--header 'Content-Type: application/json' \
--data '
{
"method": "gas_price",
"params": {
"block_id": 1
},
"id": "dontcare",
"jsonrpc": "2.0"
}
'const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({method: 'gas_price', params: {block_id: 1}, id: 'dontcare', jsonrpc: '2.0'})
};
fetch('https://api.example.com/gas_price', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.example.com/gas_price"
payload = {
"method": "gas_price",
"params": { "block_id": 1 },
"id": "dontcare",
"jsonrpc": "2.0"
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text){
"result": {
"gas_price": "<string>"
},
"id": "<string>",
"jsonrpc": "<string>"
}Body
application/json
Was this page helpful?