- APIs
- Stacks Blockchain API
- Constants
Get constant value
RPC node
Get the value of a constant inside a contract.
GET
Parameters
Path Parameters
contract_address
REQUIRED
string Standard Stacks address (e.g. `SP31DA6FTSJX2WGTZ69SFY11BH51NZMB0ZW97B5P0`).
Must be 28-41 characters long using Stacks base58check format.
contract_name
REQUIRED
string Contract name. Must start with a letter and can contain letters, numbers,
hyphens, and underscores. Maximum length is 40 characters for new contracts.
Legacy contracts may have names up to 128 characters.
constant_name
REQUIRED
string
Query Parameters
tip
string Stacks chain tip to query from. Options:
- (empty/omitted): Use latest anchored tip (canonical confirmed state)
- `latest`: Use latest known tip including unconfirmed microblocks
- `{block_id}`: Use specific block ID (64 hex characters)
Status code | Description |
---|---|
200 | Success |
400 | Bad request |
404 | Not found |
500 | Internal Server Error |
cURL
curl -L \"https://api.hiro.so/v2/constant_val/{contract_address}/{contract_name}/{constant_name}?tip={tip}" \-H 'Accept: application/json'
Response
{"data": "0x01ce0123456789abcdef"}