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_address
Requiredstring
Stacks address
contract_name
Requiredstring
Contract name
constant_name
Requiredstring
Constant name
Query Parameters
tip
string
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"}