Get constant value

RPC node

Get the value of a constant inside a contract.


POST
/v2/constant_val/{contract_address}/{contract_name}/{constant_name}

Path Parameters

contract_addressstring

Stacks address

contract_namestring

Contract name

constant_namestring

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).

Response Body

curl -X POST "http://localhost:20443/v2/constant_val/string/string/string?tip=string"
fetch("http://localhost:20443/v2/constant_val/string/string/string?tip=string")
package main

import (
  "fmt"
  "net/http"
  "io/ioutil"
)

func main() {
  url := "http://localhost:20443/v2/constant_val/string/string/string?tip=string"

  req, _ := http.NewRequest("POST", url, nil)
  
  res, _ := http.DefaultClient.Do(req)
  defer res.Body.Close()
  body, _ := ioutil.ReadAll(res.Body)

  fmt.Println(res)
  fmt.Println(string(body))
}
import requests

url = "http://localhost:20443/v2/constant_val/string/string/string?tip=string"

response = requests.request("POST", url)

print(response.text)
{
  "data": "0x01ce..."
}
Empty