Call read-only function

Calls a read-only public function on a given smart contract.

POST
/v2/contracts/call-read/{contract_address}/{contract_name}/{function_name}

Call read-only function

Call a read-only public function on a given smart contract.

The smart contract and function are specified using the URL path. The arguments and the simulated tx-sender are supplied via the POST body in the following JSON format:

Request Body

map of arguments and the simulated tx-sender where sender is either a Contract identifier or a normal Stacks address, and arguments is an array of hex serialized Clarity values.

sender
Required
string

The simulated tx-sender

arguments
Required
array<string>

An array of hex serialized Clarity values

Path Parameters

contract_address
Required
string

Stacks address

contract_name
Required
string

Contract name

function_name
Required
string

Function 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 codeDescription
200Success
/v2/contracts/call-read/{contract_address}/{contract_name}/{function_name}

curl -X POST "http://localhost:20443/v2/contracts/call-read/string/string/string?tip=string" \
  -d '{
  "sender": "SP31DA6FTSJX2WGTZ69SFY11BH51NZMB0ZW97B5P0.get-info",
  "arguments": [
    "0x0011...",
    "0x00231..."
  ]
}'

GET request to get contract source

{
  "okay": true,
  "result": "string",
  "cause": "string"
}