Home

Stacks 3.0+ RPC API

v1.0.0
Base URL
https://stacks.nownodes.ioLocal

This is the documentation for the stacks-node RPC interface.

Authentication

api-keyAuthapiKey

API Key: api-key in header

STX

Transactions

Broadcast raw transaction

POST
https://stacks.nownodes.io/v2/transactions

Authorizations

ApiKeyAuthApiKeyAuth

api-key string

NOWNodes API key passed in the api-key header.

Broadcast raw transactions on the network. You can use the @stacks/transactions project to generate a raw transaction payload.

Body

application/octet-stream
string<binary>

Response

200OK

Transaction ID of successful post of a raw tx to the node's mempool

400Bad Request

Rejections result in a 400 error

Retrieve transaction details by TXID

GET
https://stacks.nownodes.io/v3/transaction/{txid}

Authorizations

ApiKeyAuthApiKeyAuth

api-key string

NOWNodes API key passed in the api-key header.

Get a JSON with the transaction details including the index_block_hash, the hex-encoded transaction body, and the result.

Parameters

txidstringrequiredpath

Transaction ID

Response

200OK

Transaction JSON with index_block_hash, transaction body and result

404Not Found

Transaction not found

501Not Implemented

Transaction indexing not enabled

Smart Contracts

Get contract interface

GET
https://stacks.nownodes.io/v2/contracts/interface/{contract_address}/{contract_name}

Authorizations

ApiKeyAuthApiKeyAuth

api-key string

NOWNodes API key passed in the api-key header.

Get contract interface using a contract_address and contract name

Parameters

contract_addressstringrequiredpath

Stacks address

contract_namestringrequiredpath

Contract name

tipstringquery

The Stacks chain tip to query from. If tip == latest, the query will be run from the latest known tip (includes unconfirmed state).

Response

200OK

Contract interface

Get specific data-map inside a contract

POST
https://stacks.nownodes.io/v2/map_entry/{contract_address}/{contract_name}/{map_name}

Authorizations

ApiKeyAuthApiKeyAuth

api-key string

NOWNodes API key passed in the api-key header.

Attempt to fetch data from a contract data map. The contract is identified with [Stacks Address] and [Contract Name] in the URL path. The map is identified with [Map Name].

The key to lookup in the map is supplied via the POST body. This should be supplied as the hex string serialization of the key (which should be a Clarity value). Note, this is a JSON string atom.

In the response, data is the hex serialization of the map response. Note that map responses are Clarity option types, for non-existent values, this is a serialized none, and for all other responses, it is a serialized (some ...) object.

Body

application/json

Hex string serialization of the lookup key (which should be a Clarity value)

string

Parameters

contract_addressstringrequiredpath

Stacks address

contract_namestringrequiredpath

Contract name

map_namestringrequiredpath

Map name

proofintegerquery

Returns object without the proof field when set to 0

tipstringquery

The Stacks chain tip to query from. If tip == latest, the query will be run from the latest known tip (includes unconfirmed state).

Response

200OK

Success

400Bad Request

Failed loading data map

Get contract source

GET
https://stacks.nownodes.io/v2/contracts/source/{contract_address}/{contract_name}

Authorizations

ApiKeyAuthApiKeyAuth

api-key string

NOWNodes API key passed in the api-key header.

Returns the Clarity source code of a given contract, along with the block height it was published in, and the MARF proof for the data

Parameters

contract_addressstringrequiredpath

Stacks address

contract_namestringrequiredpath

Contract name

proofintegerquery

Returns object without the proof field if set to 0

tipstringquery

The Stacks chain tip to query from. If tip == latest, the query will be run from the latest known tip (includes unconfirmed state).

Response

200OK

Success

Call read-only function

POST
https://stacks.nownodes.io/v2/contracts/call-read/{contract_address}/{contract_name}/{function_name}

Authorizations

ApiKeyAuthApiKeyAuth

api-key string

NOWNodes API key passed in the api-key header.

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:

Body

application/json

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.

senderstringrequired

The simulated tx-sender

argumentsArray<string>required

An array of hex serialized Clarity values

Parameters

contract_addressstringrequiredpath

Stacks address

contract_namestringrequiredpath

Contract name

function_namestringrequiredpath

Function name

tipstringquery

The Stacks chain tip to query from. If tip == latest, the query will be run from the latest known tip (includes unconfirmed state).

Response

200OK

Success

Get trait implementation details

GET
https://stacks.nownodes.io/v2/traits/{contract_address}/{contract_name}/{trait_contract_address}/{trait_contract_name}/{trait_name}

Authorizations

ApiKeyAuthApiKeyAuth

api-key string

NOWNodes API key passed in the api-key header.

Determine whether or not a specified trait is implemented (either explicitly or implicitly) within a given contract.

Parameters

contract_addressstringrequiredpath

Stacks address

contract_namestringrequiredpath

Contract name

trait_contract_addressstringrequiredpath

Trait Stacks address

trait_contract_namestringrequiredpath

Trait contract name

trait_namestringrequiredpath

Trait name

tipstringquery

The Stacks chain tip to query from. If tip == "latest", the query will be run from the latest known tip (includes unconfirmed state). If the tip is left unspecified, the stacks chain tip will be selected (only includes confirmed state).

Response

200OK

Success

Get the MARF value for a given key

POST
https://stacks.nownodes.io/v2/clarity/marf/{clarity_marf_key}

Authorizations

ApiKeyAuthApiKeyAuth

api-key string

NOWNodes API key passed in the api-key header.

Attempt to fetch the value of a MARF key.

In the response, data is the hex serialization of the value.

Parameters

clarity_marf_keystringrequiredpath

MARF key

proofintegerquery

Returns object without the proof field when set to 0

tipstringquery

The Stacks chain tip to query from. If tip == latest, the query will be run from the latest known tip (includes unconfirmed state).

Response

200OK

Success

400Bad Request

Failed to retrieve MARF key

Get the contract metadata for the metadata key

POST
https://stacks.nownodes.io/v2/clarity/metadata/{contract_address}/{contract_name}/{clarity_metadata_key}

Authorizations

ApiKeyAuthApiKeyAuth

api-key string

NOWNodes API key passed in the api-key header.

Attempt to fetch the metadata of a contract. The contract is identified with [Contract Address] and [Contract Name] in the URL path. The metadata key is identified with [Clarity Metadata Key].

In the response, data is formatted as JSON.

Parameters

contract_addressstringrequiredpath

Stacks address

contract_namestringrequiredpath

Contract name

clarity_metadata_keystringrequiredpath

Metadata key

tipstringquery

The Stacks chain tip to query from. If tip == latest, the query will be run from the latest known tip (includes unconfirmed state).

Response

200OK

Success

400Bad Request

Failed to retrieve constant value from contract

Get the value of a constant inside a contract

POST
https://stacks.nownodes.io/v2/constant_val/{contract_address}/{contract_name}/{constant_name}

Authorizations

ApiKeyAuthApiKeyAuth

api-key string

NOWNodes API key passed in the api-key header.

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.

Parameters

contract_addressstringrequiredpath

Stacks address

contract_namestringrequiredpath

Contract name

constant_namestringrequiredpath

Constant name

tipstringquery

The Stacks chain tip to query from. If tip == latest, the query will be run from the latest known tip (includes unconfirmed state).

Response

200OK

Success

400Bad Request

Failed to retrieve constant value from contract

Accounts

Get account info

GET
https://stacks.nownodes.io/v2/accounts/{principal}

Authorizations

ApiKeyAuthApiKeyAuth

api-key string

NOWNodes API key passed in the api-key header.

Get the account data for the provided principal

Where balance is the hex encoding of a unsigned 128-bit integer (big-endian), nonce is a unsigned 64-bit integer, and the proofs are provided as hex strings.

For non-existent accounts, this does not 404, rather it returns an object with balance and nonce of 0.

Parameters

principalstringrequiredpath

Stacks address or a Contract identifier (e.g. SP31DA6FTSJX2WGTZ69SFY11BH51NZMB0ZW97B5P0.get-info)

proofintegerquery

Returns object without the proof field if set to 0

tipstringquery

The Stacks chain tip to query from. If tip == latest, the query will be run from the latest known tip (includes unconfirmed state).

Response

200OK

Success

Fees

Get approximate fees for the given transaction

POST
https://stacks.nownodes.io/v2/fees/transaction

Authorizations

ApiKeyAuthApiKeyAuth

api-key string

NOWNodes API key passed in the api-key header.

Get an estimated fee for the supplied transaction. This estimates the execution cost of the transaction, the current fee rate of the network, and returns estimates for fee amounts.

  • transaction_payload is a hex-encoded serialization of the TransactionPayload for the transaction.
  • estimated_len is an optional argument that provides the endpoint with an estimation of the final length (in bytes) of the transaction, including any post-conditions and signatures

If the node cannot provide an estimate for the transaction (e.g., if the node has never seen a contract-call for the given contract and function) or if estimation is not configured on this node, a 400 response is returned. The 400 response will be a JSON error containing a reason field which can be one of the following:

  • DatabaseError - this Stacks node has had an internal database error while trying to estimate the costs of the supplied transaction.
  • NoEstimateAvailable - this Stacks node has not seen this kind of contract-call before, and it cannot provide an estimate yet.
  • CostEstimationDisabled - this Stacks node does not perform fee or cost estimation, and it cannot respond on this endpoint.

The 200 response contains the following data:

  • estimated_cost - the estimated multi-dimensional cost of executing the Clarity VM on the provided transaction.
  • estimated_cost_scalar - a unitless integer that the Stacks node uses to compare how much of the block limit is consumed by different transactions. This value incorporates the estimated length of the transaction and the estimated execution cost of the transaction. The range of this integer may vary between different Stacks nodes. In order to compute an estimate of total fee amount for the transaction, this value is multiplied by the same Stacks node's estimated fee rate.
  • cost_scalar_change_by_byte - a float value that indicates how much the estimated_cost_scalar value would increase for every additional byte in the final transaction.
  • estimations - an array of estimated fee rates and total fees to pay in microSTX for the transaction. This array provides a range of estimates (default: 3) that may be used. Each element of the array contains the following fields:
    • fee_rate - the estimated value for the current fee rates in the network
    • fee - the estimated value for the total fee in microSTX that the given transaction should pay. These values are the result of computing: fee_rate x estimated_cost_scalar. If the estimated fees are less than the minimum relay fee (1 ustx x estimated_len), then that minimum relay fee will be returned here instead.

Note: If the final transaction's byte size is larger than supplied to estimated_len, then applications should increase this fee amount by:

fee_rate x cost_scalar_change_by_byte x (final_size - estimated_size)

Body

application/json

POST request for estimated fee

transaction_payloadstringrequired
estimated_leninteger

Response

200OK

Estimated fees for the transaction

Get estimated fee

GET
https://stacks.nownodes.io/v2/fees/transfer

Authorizations

ApiKeyAuthApiKeyAuth

api-key string

NOWNodes API key passed in the api-key header.

Get an estimated fee rate for STX transfer transactions. This a a fee rate / byte, and is returned as a JSON integer

Response

200OK

Success

Info

Get Core API info

GET
https://stacks.nownodes.io/v2/info

Authorizations

ApiKeyAuthApiKeyAuth

api-key string

NOWNodes API key passed in the api-key header.

Get Core API information

Response

200OK

Success

Get PoX details

GET
https://stacks.nownodes.io/v2/pox

Authorizations

ApiKeyAuthApiKeyAuth

api-key string

NOWNodes API key passed in the api-key header.

Get Proof of Transfer (PoX) information. Can be used for Stacking.

Parameters

tipstringquery

The Stacks chain tip to query from. If tip == latest, the query will be run from the latest known tip (includes unconfirmed state).

Response

200OK

Success

Mining

Validate a proposed Stacks block

POST
https://stacks.nownodes.io/v3/block_proposal

Authorizations

ApiKeyAuthApiKeyAuth

api-key string

NOWNodes API key passed in the api-key header.

Used by stackers to validate a proposed Stacks block from a miner.

This API endpoint requires a basic Authorization header.

Body

application/json

Response

202Accepted

Block proposal has been accepted for processing. The result will be returned via the event observer.

400Bad Request

Endpoint not enabled.

401Unauthorized

Unauthorized.

429Too Many Requests

There is an ongoing proposal validation being processed, the new request cannot be accepted until the prior request has been processed.

Fetch the stacker and signer set information for a given cycle.

GET
https://stacks.nownodes.io/v3/stacker_set/{cycle_number}

Authorizations

ApiKeyAuthApiKeyAuth

api-key string

NOWNodes API key passed in the api-key header.

Used to get stacker and signer set information for a given cycle.

This will only return information for cycles started in Epoch-2.5 where PoX-4 was active and subsequent cycles.

Parameters

cycle_numberintegerrequiredpath

reward cycle number

Response

200OK

Information for the given reward cycle

400Bad Request

Could not fetch the given reward set

Blocks

Fetch a Nakamoto block

GET
https://stacks.nownodes.io/v3/blocks/{block_id}

Authorizations

ApiKeyAuthApiKeyAuth

api-key string

NOWNodes API key passed in the api-key header.

Fetch a Nakamoto block by its index block hash.

Parameters

block_idstringrequiredpath

The block's ID hash

Response

200OK

The raw SIP-003-encoded block will be returned.

404Not Found

The block could not be found

Fetch a Nakamoto block by its height and optional tip

GET
https://stacks.nownodes.io/v3/blocks/height/{block_height}

Authorizations

ApiKeyAuthApiKeyAuth

api-key string

NOWNodes API key passed in the api-key header.

Fetch a Nakamoto block by its height and optional tip.

Parameters

block_heightintegerrequiredpath

The block's height

tipstringquery

The Stacks chain tip to query from. If tip == latest or empty, the query will be run from the latest known tip.

Response

200OK

The raw SIP-003-encoded block will be returned.

404Not Found

The block could not be found

Fetch metadata about the ongoing Nakamoto tenure

GET
https://stacks.nownodes.io/v3/tenures/info

Authorizations

ApiKeyAuthApiKeyAuth

api-key string

NOWNodes API key passed in the api-key header.

Fetch metadata about the ongoing Nakamoto tenure. This information is sufficient to obtain and authenticate the highest complete tenure, as well as obtain new tenure blocks.

Response

200OK

Metadata about the ongoing tenure

Fetch a sequence of Nakamoto blocks in a tenure

GET
https://stacks.nownodes.io/v3/tenures/{block_id}

Authorizations

ApiKeyAuthApiKeyAuth

api-key string

NOWNodes API key passed in the api-key header.

Fetch a sequence of Nakamoto blocks in a tenure. The blocks will be served in order from highest to lowest. The blocks will be encoded in their SIP-003 wire format, and concatenated together.

Parameters

block_idstringrequiredpath

The tenure-start block ID of the tenure to query

stopstringquery

The block ID hash of the highest block in this tenure that is already known to the caller. Neither the corresponding block nor any of its ancestors will be served. This is used to fetch tenure blocks that the caller does not have.

Response

200OK

SIP-003-encoded Nakamoto blocks, concatenated together

Fetch information about evaluated burnchain blocks (i.e., sortitions).

GET
https://stacks.nownodes.io/v3/sortitions/{lookup_kind}/{lookup}

Authorizations

ApiKeyAuthApiKeyAuth

api-key string

NOWNodes API key passed in the api-key header.

Fetch sortition information about a burnchain block. If the lookup_kind and lookup parameters are empty, it will return information about the latest burn block.

Parameters

lookup_kindstringpath

The style of lookup that should be performed. If not given, the most recent burn block processed will be returned. Otherwise, the lookup_kind should be one of the following strings:

  • consensus - find the burn block using the consensus hash supplied in the lookup field.
  • burn_height - find the burn block using the burn block height supplied in the lookup field.
  • burn - find the burn block using the burn block hash supplied in the lookup field.
  • latest_and_last - return information about the latest burn block with a winning miner and the previous such burn block
lookupstringpath

The value to use for the lookup if lookup_kind is consensus, burn_height, or burn

Response

200OK

Information for the burn block or in the case of latest_and_last, multiple burn blocks

Get number of blocks signed by signer during a given reward cycle

GET
https://stacks.nownodes.io/v3/signer/{signer}/{cycle_number}

Authorizations

ApiKeyAuthApiKeyAuth

api-key string

NOWNodes API key passed in the api-key header.

Get number of blocks signed by signer during a given reward cycle

Parameters

signerstringrequiredpath

Hex-encoded compressed Secp256k1 public key of signer

cycle_numberintegerrequiredpath

Reward cycle number

Response

200OK

Number of blocks signed

Signers

Get number of blocks signed by signer during a given reward cycle

GET
https://stacks.nownodes.io/v3/signer/{signer}/{cycle_number}

Authorizations

ApiKeyAuthApiKeyAuth

api-key string

NOWNodes API key passed in the api-key header.

Get number of blocks signed by signer during a given reward cycle

Parameters

signerstringrequiredpath

Hex-encoded compressed Secp256k1 public key of signer

cycle_numberintegerrequiredpath

Reward cycle number

Response

200OK

Number of blocks signed