For the complete documentation index, see llms.txt. This page is also available as Markdown.

Smart Contracts

Read-only endpoints to obtain Clarity smart contract details

Get smart contracts status

get

Retrieves the deployment status of multiple smart contracts.

Query parameters
contract_idany ofRequired
string[]Optional

Smart Contract ID

or
stringOptional

Smart Contract ID

Example: SP000000000000000000002Q6VF78.pox-3Pattern: ^[0123456789ABCDEFGHJKMNPQRSTVWXYZ]{28,41}.[a-zA-Z]([a-zA-Z0-9]|[-_]){0,39}$
Responses
200

Default Response

application/json
Other propertiesany ofOptional
or
get/extended/v2/smart-contracts/status
GET /extended/v2/smart-contracts/status?contract_id=SP000000000000000000002Q6VF78.pox-3 HTTP/1.1
Host: api.hiro.so/
Accept: */*
{
  "ANY_ADDITIONAL_PROPERTY": {
    "found": true,
    "result": {
      "status": "text",
      "tx_id": "text",
      "contract_id": "text",
      "block_height": 1
    }
  }
}

Get smart contract logs

get

Retrieves contract log events for a given smart contract.

Path parameters
contract_idstringRequired

Contract identifier formatted as <contract_address>.<contract_name>

Example: SP000000000000000000002Q6VF78.pox-3
Query parameters
limitinteger · max: 100Optional

Results per page

Default: 20
offsetinteger · min: -1000 · max: 1000Optional

Result offset

Default: 0
cursorstringOptional

Cursor for transaction event pagination (block_height:microblock_sequence:tx_index:event_index)

Pattern: ^[0-9]+:[0-9]+:[0-9]+:[0-9]+$
Responses
200

Default Response

application/json
limitintegerRequiredExample: 20
offsetintegerRequiredExample: 0
totalintegerRequiredExample: 1
next_cursorstring · nullableRequired

Next page cursor

prev_cursorstring · nullableRequired

Previous page cursor

cursorstring · nullableRequired

Current page cursor

get/extended/v2/smart-contracts/{contract_id}/logs
GET /extended/v2/smart-contracts/{contract_id}/logs HTTP/1.1
Host: api.hiro.so/
Accept: */*
{
  "limit": 20,
  "offset": 0,
  "total": 1,
  "next_cursor": "text",
  "prev_cursor": "text",
  "cursor": "text",
  "results": [
    {
      "event_index": 1,
      "event_type": "smart_contract_log",
      "tx_id": "text",
      "contract_log": {
        "contract_id": "text",
        "topic": "text",
        "value": {
          "hex": "text",
          "repr": "text"
        }
      }
    }
  ]
}

Get smart contract

get

Retrieves a deployed smart contract, along with the transaction that deployed it. Only successfully deployed contracts are returned; a contract id whose deploy transaction failed is not found.

Path parameters
contract_idstringRequired

Smart Contract ID

Example: SP000000000000000000002Q6VF78.pox-3Pattern: ^[0123456789ABCDEFGHJKMNPQRSTVWXYZ]{28,41}.[a-zA-Z]([a-zA-Z0-9]|[-_]){0,39}$
Query parameters
Responses
200

Default Response

application/json
contract_idstringRequired

Smart Contract ID

Example: SP000000000000000000002Q6VF78.pox-3Pattern: ^[0123456789ABCDEFGHJKMNPQRSTVWXYZ]{28,41}.[a-zA-Z]([a-zA-Z0-9]|[-_]){0,39}$
clarity_versioninteger · nullableRequired

The Clarity version the contract runs under. Contracts deployed with a versioned payload declare their own version; for the rest it is the version the node resolved from the epoch they were deployed in. Null when it could not be determined, which only happens for contracts indexed from a chainstate predating the point where the Stacks node began reporting it.

Example: 3
tx_idstringRequired

ID of the transaction that deployed this contract

Example: 0xf6bd5f4a7b26184a3466340b2e99fd003b4962c0e382a7e4b6a13df3dd7a91c6Pattern: ^(0x)?[a-fA-F0-9]{64}$
source_codestringOptional

The Clarity source code of the contract. Only present when requested via the include=source_code query param.

get/extended/v3/smart-contracts/{contract_id}
GET /extended/v3/smart-contracts/{contract_id} HTTP/1.1
Host: api.hiro.so/
Accept: */*
{
  "contract_id": "SP000000000000000000002Q6VF78.pox-3",
  "clarity_version": 3,
  "tx_id": "0xf6bd5f4a7b26184a3466340b2e99fd003b4962c0e382a7e4b6a13df3dd7a91c6",
  "block": {
    "height": 1,
    "hash": "text",
    "index_hash": "text",
    "time": 1,
    "tx_index": 1
  },
  "bitcoin_block": {
    "height": 1,
    "time": 1
  },
  "source_code": "text"
}

Last updated

Was this helpful?