/transaction/fee-estimate - Polkadot
This endpoint estimates the fee and weight for a submitted transaction without broadcasting it.
On GetBlock's unified endpoint, Asset Hub is the default network. To call this endpoint against the Relaychain, add an /rc prefix to the path (for example, /rc/transaction/fee-estimate).
Endpoint
POST /transaction/fee-estimateBody Parameters
| Field | Type | Required | Description |
|---|---|---|---|
| tx | string | Yes | A SCALE-encoded transaction, hex-encoded |
Request
bashcurl --location --request POST 'https://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/transaction/fee-estimate' \
--header 'Content-Type: application/json' \
--data-raw '{"tx": "0x4d028400d43593c715fdd31c61141abd04a99fd6822c8558854ccde39a5684e7a56da27d01..."}'example.js
javascriptconst response = await fetch('https://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/transaction/fee-estimate', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
"tx": "0x4d028400d43593c715fdd31c61141abd04a99fd6822c8558854ccde39a5684e7a56da27d01..."
})
});
const data = await response.json();
console.log(data);example.py
pythonimport requests
response = requests.post(
'https://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/transaction/fee-estimate',
json={
"tx": "0x4d028400d43593c715fdd31c61141abd04a99fd6822c8558854ccde39a5684e7a56da27d01..."
}
)
print(response.json())Response
json{
"weight": {
"refTime": "133700000",
"proofSize": "3593"
},
"class": "Normal",
"partialFee": "15960000000"
}Response Fields
| Field | Type | Description |
|---|---|---|
| weight | object | Dispatch weight (refTime and proofSize) |
| class | string | Dispatch class |
| partialFee | string | Estimated fee in Planck, excluding tip |
Use Cases
- Fee Preview: Show the estimated fee before signing
- Budgeting: Estimate fees for batches of transactions
- Wallet UX: Display expected costs to users
- Automation: Gate submissions on fee thresholds