Stacks

Stacks is a Bitcoin Layer-2 that brings smart contracts and decentralized apps to Bitcoin: its Clarity contracts can read Bitcoin state, and through the Nakamoto release and sBTC, Stacks transactions settle with Bitcoin finality. The native token is STX, denominated in microSTX (1 STX = 1,000,000 microSTX). GetBlock exposes Stacks through its node RPC API: a path-addressed HTTP + JSON interface under /v2 where reads use GET and transaction broadcast, read-only contract calls, and fee estimation use POST.

Key Features

  • Bitcoin Layer-2: Clarity smart contracts that can read Bitcoin state; transactions anchor to Bitcoin
  • Node RPC API: A path-addressed /v2 HTTP + JSON interface — not a JSON-RPC envelope and not eth_*; the resource is chosen by the URL path
  • STX / microSTX: Balances and fees are denominated in microSTX (1 STX = 1,000,000 microSTX); account balances are returned hex-encoded
  • Clarity Contracts: Read contract interfaces and source, call read-only functions, and read maps, variables, and constants
  • Decidable Language: Clarity is interpreted and decidable — no compiler, and contract source is readable on-chain
  • Build-Sign-Broadcast: Estimate fees, sign client-side, then broadcast the serialized transaction

TECHNICAL DISCLAIMER: AUTHORITATIVE REST API SPECIFICATION.

GetBlock's API reference documentation is provided exclusively for informational purposes and to optimize the developer experience. Stacks' node RPC is documented by the Stacks project; the canonical specification is the stacks-core node RPC at docs.stacks.co, and developer guidance is published by Hiro at docs.hiro.so. This reference documents the node's developer-facing /v2 read and broadcast surface; internal P2P, consensus, and StackerDB routes are omitted.

Network Information

PropertyValue
Network NameStacks Mainnet
Native CurrencySTX (1 STX = 1,000,000 microSTX)
Settlement LayerBitcoin
Contract LanguageClarity
APINode RPC API (HTTP + JSON) under /v2

Base URL

https://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/
https://shared.us-east-1.getblock.io/<ACCESS-TOKEN>/
https://shared.ap-southeast-1.getblock.io/<ACCESS-TOKEN>/

Supported Networks

NetworkAPIFrankfurt, GermanyNew York, USASingapore, Singapore
MainnetREST (/v2)✅✅✅

Quickstart

  1. Setup project

    bashmkdir stacks-api-quickstart && cd stacks-api-quickstart && npm init --yes
  2. Install dependency

    bashnpm install axios
  3. Add code

    index.js

    javascriptconst axios = require('axios');
    
    let config = {
      method: 'get',
      maxBodyLength: Infinity,
      url: 'https://shared.us-east-1.getblock.io/<ACCESS_TOKEN>/v2/info',
      headers: { 
        'Accept': 'application/json'
      }
    };
    
    axios.request(config)
    .then((response) => {
      console.log(JSON.stringify(response.data));
    })
    .catch((error) => {
      console.log(error);
    });
    
  4. Run the script

    bashnode index.js
  5. Response

    bash{
        "peer_version": 402653200,
        "pox_consensus": "7501a38adfc1a5a206ae809b3dc2d494a484e6bd",
        "burn_block_height": 971693,
        "stable_pox_consensus": "b431a79173d2b5e645d3239310cf4fdc2917c9b0",
        "stable_burn_block_height": 971686,
        "server_version": "stacks-node 4.0.4 (10474cdec9, release build, linux [x86_64])",
        "network_id": 1,
        "parent_network_id": 3652501241,
        "stacks_tip_height": 9223854,
        "stacks_tip": "6b691521b70c9debdb7621fb6ce25cf87925f62d44df34fbeadf62339920254c",
        "stacks_tip_consensus_hash": "50649ccae8233f575361f3a92a253eafa7873b7b",
        "genesis_chainstate_hash": "74237aa39aa50a83de11a4f53e9d3bb7d43461d1de9873f402e5453ae60bc59b",
        "unanchored_tip": null,
        "unanchored_seq": null,
        "tenure_height": 259365,
        "exit_at_block_height": null,
        "is_fully_synced": true,
        "node_public_key": "032e39d727383db1f7f66c7060615f42d42418f3241d5332eb036938a1d4b52b2d",
        "node_public_key_hash": "8272bf1324a0e1df16e64ce32d3fa53f1ccdb984",
        "last_pox_anchor": {
            "anchor_block_hash": "cf90dccf666f393d0e45cfcc0e1dc363f48c95a357eb8030033f1b0b4b5670a6",
            "anchor_block_txid": "55268154eb7b051c17c092635de8fce769c6ca14548cd967d9b2ee74a9a3f39c"
        },
        "stackerdbs": []
    }
  1. Setup project

    bashmkdir stacks-api-quickstart && cd stacks-api-quickstart
    python -m venv venv && source venv/bin/activate
  2. Install dependency

    bashpip install requests
  3. Add code

    main.py

    pythonimport requests
    
    url = "https://shared.us-east-1.getblock.io/<ACCESS_TOKEN>/v2/info"
    
    payload = {}
    headers = {
      'Accept': 'application/json'
    }
    
    response = requests.request("GET", url, headers=headers, data=payload)
    
    print(response.text)
    
  4. Run the script

    bashpython main.py

Available REST Endpoints

Node & Network

EndpointMethodDescription
infoGETReturns core node information: peer and server version, network ID, the current burnchain (Bitcoin) block height, the Stacks chain tip height and hash, tenure height, and sync status.
poxGETReturns Proof-of-Transfer (PoX) details: the active PoX contract, cycle lengths, total liquid supply, and the current and next reward cycles with their stacking thresholds.

Accounts & Fees

EndpointMethodDescription
accountsGETReturns an account's STX balance, locked (stacked) balance, unlock height, and next nonce. Balances are hex-encoded microSTX. A principal is a standard address or a contract principal (address.contract-name).
fees-transferGETReturns the estimated fee rate for a standard STX token-transfer transaction, in microSTX per byte.
fees-transactionPOSTReturns approximate fees for a given transaction payload, as low/middle/high estimations, based on the serialized payload and its estimated length.

Transactions

EndpointMethodDescription
transactionsPOSTBroadcasts a signed, serialized transaction to the network. The body is the raw transaction bytes (hex string with application/json, or raw bytes with application/octet-stream). On acceptance the node returns the transaction ID.

Contracts

EndpointMethodDescription
contract-interfaceGETReturns the interface (ABI) of a deployed Clarity contract: its public and read-only functions, data variables, maps, fungible and non-fungible tokens, and the Clarity version.
contract-sourceGETReturns the Clarity source code of a deployed contract, the block height at which it was published, and (optionally) a MARF proof.
call-readPOSTCalls a read-only Clarity function and returns its result, without creating a transaction. Arguments are hex-encoded Clarity values; the result is a hex-encoded Clarity value.

Contract State

EndpointMethodDescription
map-entryPOSTReturns the value stored at a key in a contract's data map. The request body is the hex-encoded Clarity value of the key; the response is the hex-encoded Clarity value and an optional MARF proof.
constant-valGETReturns the value of a constant defined in a contract, as a hex-encoded Clarity value.
data-varGETReturns the current value of a contract data variable, as a hex-encoded Clarity value, with an optional MARF proof.
traitsGETReports whether a contract implements a given trait, identified by the trait's deployer, contract, and trait name.

Support

For technical support and questions:

See Also