Get constant value
Get the value of a constant inside a contract.
GET
/v2/constant_val/{contract_address}/{contract_name}/{constant_name}
Get the value of a constant inside a contract
Attempt to fetch the value of a constant inside a contract. The contract is identified with [Stacks Address] and [Contract Name] in the URL path. The constant is identified with [Constant Name].
In the response, data is the hex serialization of the constant value.
Path Parameters
contract_addressRequiredstring
Stacks address
contract_nameRequiredstring
Contract name
constant_nameRequiredstring
Constant name
Query Parameters
tipstring
The Stacks chain tip to query from. If tip == latest, the query will be run from the latest known tip (includes unconfirmed state).
| Status code | Description |
|---|---|
| Success |
| Failed to retrieve constant value from contract |
Terminal
$curl -X POST "http://localhost:20443/v2/constant_val/string/string/string?tip=string"
Response of get constant val request
{"data": "string"}