/pallets/{palletId}/consts - Polkadot

This endpoint returns the constants defined by a pallet, such as bonding durations or deposit amounts.

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/pallets/{palletId}/consts).

Endpoint

httpGET /pallets/{palletId}/consts

Path Parameters

ParameterTypeDescription
palletIdstringPallet name or index

Query Parameters

ParameterTypeRequiredDescription
atstringNoBlock height or hash to query at

Request

bashcurl --location 'https://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/pallets/staking/consts'

example.js

javascriptconst response = await fetch('https://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/pallets/staking/consts');
const data = await response.json();
console.log(data);

example.py

pythonimport requests

response = requests.get('https://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/pallets/staking/consts')
print(response.json())

Response

json{
  "at": {
    "hash": "0x255bc00927df8d33d561792635cbc6bde480a0a505eef5ff28630ece3fc15b32",
    "height": "6754362"
  },
  "pallet": "staking",
  "palletIndex": "7",
  "items": [
    {
      "name": "BondingDuration",
      "type": "u32",
      "value": "28"
    },
    {
      "name": "MaxNominations",
      "type": "u32",
      "value": "16"
    }
  ]
}

Response Fields

FieldTypeDescription
palletstringPallet name
itemsarrayConstants defined by the pallet
items[].namestringConstant name
items[].valuestringConstant value

Use Cases

  • Parameter Reads: Read a pallet's on-chain constants
  • Staking UX: Show the bonding duration to users
  • Governance Tools: Read deposit and threshold constants
  • Documentation: Surface runtime parameters