NAV
Shell Go

Tezos API

Current Version

v010-2021-09-04

API Endpoints

Mainnet: https://api.tzstats.com
Mainnet Staging: https://api.staging.tzstats.com
Florencenet: https://api.florence.tzstats.com
Granadanet: https://api.granada.tzstats.com

RPC Endpoints

Mainnet: https://rpc.tzstats.com
Florencenet: https://rpc.florence.tzstats.com
Granadanet: https://rpc.granada.tzstats.com

TzStats provides a powerful Tezos API to access fully indexed on-chain data and statistics collected from the Tezos blockchain. Supported by Blockwatch Data and ready to use without permission for non-commercial projects. To inquire about commercial use send an email to license@blockwatch.cc.

This API reference provides information on all public API endpoints and how to call them. Access does not require authentication and we do not enforce rate limits right now, but we monitor usage and may apply individual limits to guarantee fair use for everybody.

The TzStats Tezos API supports different kinds of endpoints:

TzStats SDKs

Official client libraries for TzStats are currently available for

Calling the API

Our Tezos API is read-only at the moment, i.e. the only supported HTTP methods are GET, HEAD and OPTIONS. Query parameters must be properly URL encoded and appended as query arguments.

For high-speed high-volume access, always use the table API endpoints. Table and time-series endpoints stream data and have higher limits, that is, they immediately return response headers after accepting and validating a request and then stream rows or aggregated data points as they are fetched from the underlying database.

Transport Security

All our certificates are signed by LetsEncrypt Authority X3 certificate.

Available ciphers are

ECDHE-ECDSA-AES256-GCM-SHA384
ECDHE-ECDSA-CHACHA20-POLY1305
ECDHE-ECDSA-AES128-GCM-SHA256
ECDHE-ECDSA-AES256-SHA384
ECDHE-ECDSA-AES128-SHA256
ECDHE-RSA-AES256-GCM-SHA384
ECDHE-RSA-CHACHA20-POLY1305
ECDHE-RSA-AES128-GCM-SHA256
ECDHE-RSA-AES256-SHA384
ECDHE-RSA-AES128-SHA256

The API supports secure connections via TLS v1.3, v1.2 and v1.1 with Perfect Forward Secrecy based on Elliptic Curves and Diffie-Hellman key exchange. Insecure HTTP requests to port 80 are automatically redirected to HTTPS on port 443.

Tezos API Response Headers

All our API responses are tagged with an API version that’s included in the X-Api-Version HTTP header field as well as the Tezos network id and protocol.

Current TzStats Mainnet Response Headers

# API version
X-Api-Version:   v010-2021-09-04

# Tezos Network (chain id)
X-Network-Id:    NetXdQprcVkpaWU

# Tezos Protocol (protocol hash)
X-Protocol-Hash: PtGRANADsDU8R9daYKAgWnQYAJ64omN1o3KMGVCykShA97vQbvV

CORS

TzStats Data API supports cross-origin HTTP requests, commonly referred as CORS. This means that you can call the API using Javascript from any browser. Right now CORS support is limited to localhost and the tzstats.com domain. Send a request to tzstats@blockwatch.cc if you have an interesting use case and like to get whitelisted.

Rate Limits

We do not enforce limits on the number of calls or the amount of data you can query from the API. We do, however, use SPAM protection measures that limit the number of connection attempts and HTTP calls over short time-frames. Try to slow down your call rate if you start seeing 429 status codes. Be responsible with calls and retries, this API is a shared resource for everybody.

Data Formats

Regular JSON Objects

{
  "hash": "BLPUNqkikFAbNDekUhiqJrCaao86o6sPNq5YrcGobHMzSPi4XWr",
  "predecessor": "BM6xrDirVQLYf5KkU7ZFbTdhzxe8Hn9k2K1rR7bmByfcv75dzcu",
  "baker": "tz1XfAjZyaLdceHnZxbMYop7g7kWKPut4PR7",
  "height": 626158,
  "cycle": 152
}

JSON Bulk Arrays

[
  [
    "BMRdcMqU63QiXmU8vLE7a2qBES1kRX46mTDEGYEUsFV8uL4PDkd",
    "tz1isXamBXpTUgbByQ6gXgZQg4GWNW7r6rKE",
    626160,
    152
  ],[
    "BLhhgCSR8Avhbc7hrqQ9uSsB9Adfts2NwqZbzrGS5VCjxQdLX5N",
    "tz1coHzgoQYRu1Ezn5QChfFEjwTrBzGNQT6U",
    626159,
    152
  ],[
    "BLPUNqkikFAbNDekUhiqJrCaao86o6sPNq5YrcGobHMzSPi4XWr",
    "tz1XfAjZyaLdceHnZxbMYop7g7kWKPut4PR7",
    626158,
    152
  ]
]

Results are returned as Content-Type JSON (RFC 7159) or CSV (RFC 4180). Select either format by appending .json or .csv to the query path.

CSV files always include a header containing the requested column names in the requested order. Columns are separated by comma (ASCII 44, UTF-8 0x2C).

When downloading a CSV file you may add an optional filename query argument (ASCII only, 128 characters max, no path separators) which will be used in the Content-Disposition header. Suffix .csv is automatically appended if missing.

JSON Bulk Arrays

Large JSON results such as lists and time-series use a more optimized (less verbose) formatting. Instead of regular JSON objects with named key/value pairs we use bulk arrays, i.e. two levels of nested JSON arrays without keys. An outer array contains result rows or data points. The inner arrays contain lists of columns. To control which columns are returned and their order use the columns query parameter.

Note: As we keep adding new fields to tables and time-series the default order of JSON bulk arrays may change over time. To ensure that our API always returns the field order you expect, use the columns query argument. The order of columns you specify is exactly the order that’s returned.

JSON Data Types

We use the following data types and encoding conventions throughout the API:

string unstructured ASCII/UTF-8 text
bytes binary data encoded
datetime UTC timestamps as UNIX milliseconds, e.g. 1536246000000 or ISO 8601/RFC3339 strings 2018-09-06T15:00:00Z
duration signed 64bit integers with second precision
boolean a binary value, either as string or number true (1) or false (0)
float64 an IEEE-754 64-bit floating-point number
int64 a signed 64-bit integer (Range: -9,223,372,036,854,775,807 through 9,223,372,036,854,775,807)
uint64 an unsigned 64-bit integer (Range: 0 through 18,446,744,073,709,551,615)
enum enumerable values expressed as strings, usually used for types
hash on-chain hashes encoded as base58-check strings
money monetary quantities are expressed as float64 with 6 decimal points (the Tezos coin unit precision); market endpoints use 5 or more decimal points depending on the fiat or crypto pairs

For efficiency reasons, timestamps in JSON bulk arrays are encoded as UNIX time at millisecond resolution. That is, value 0 represents Jan 1, 1970 00:00:00 UTC. Timestamps in explorer responses and CSV output are encoded according to RFC 3339 (2018-09-06T08:07:38Z) for convenience and human readability.

Timestamps in queries can be expressed in multiple ways:

Status Codes

The TzStats Data API responds with regular HTTP status codes in the 2xx range to indicate success, in the 4xx range to indicate client-side errors and in the 5xx range to indicate backend errors. The response body contains additional information encoded as JSON object.

Error Responses

API Error Response

{
  "errors": [
    {
      "code": 1007,
      "status": 400,
      "message": "incorrect request syntax",
      "scope": "StreamTable",
      "detail": "unknown column 'cycles'",
      "request_id": "BW-a935b7fedf6beefcedc94e539cfe320cc551c5b3",
    }
  ]
}

All error messages are JSON encoded. They contain fields numeric and human readable fields to help developers easily debug and map errors.

Fields Description
status int The HTTP status code, duplicated for convenience.
message string A textual representation of the error status.
scope string The name of the API call that has failed.
detail string A detailed text description of the error.
code int An internal error code.
request_id string Unique call id that helps us trace failed requests.

Explorer Endpoints

Explorer endpoints serve individual large JSON objects and a few related lists. JSON objects use the typical JSON key/value structure and you cannot limit the contents of objects (i.e. they are always sent in full). CSV format is not supported here.

Most explorer endpoints take different kinds of path arguments to define the object to return. This can be:

Endpoint Overview

Endpoint Is Paged Filter Comment
GET /explorer/status indexer status
GET /explorer/config/{id} blockchain config at head or height
GET /explorer/tip blockchain tip info
GET /explorer/protocols list of deployed protocols
GET /explorer/bakers baker list
GET /explorer/block/{id} block info at head, hash, of height
GET /explorer/block/{id}/operations x type list block operations at head, hash, or height
GET /explorer/op/{hash} operation info
GET /explorer/account/{hash} account info
GET /explorer/account/{hash}/contracts x list of contracts managed by this account
GET /explorer/account/{hash}/operations x type account info with embedded list of related operations
GET /explorer/account/{hash}/ballots x list proposals and ballots
GET /explorer/contract/{hash} smart contract metadata
GET /explorer/contract/{hash}/calls x entrypoint list contract calls
GET /explorer/contract/{hash}/creator contract creator (a.k.a. manager)
GET /explorer/contract/{hash}/script smart contract code, storage and parameter spec
GET /explorer/contract/{hash}/storage smart contract storage
GET /explorer/bigmap/{id} bigmap metadata
GET /explorer/bigmap/{id}/keys x list of bigmap keys
GET /explorer/bigmap/{id}/values x list of bigmap key/value pairs
GET /explorer/bigmap/{id}/{key} single bigmap value
GET /explorer/bigmap/{id}/updates x list of bigmap updates
GET /explorer/bigmap/{id}/updates/{key} x list of bigmap updates related to a key
GET /explorer/cycle/{id} cycle info for head or cycle
GET /explorer/election/{id} election metadata and results at head, num or protocol hash
GET /explorer/election/{id}/{stage}/voters x election voter lists
GET /explorer/election/{id}/{stage}/ballots x election ballots lists
GET /explorer/rank/balances x accounts ranked by balance
GET /explorer/rank/volume x accounts ranked by 1D transaction volume
GET /explorer/rank/traffic x accounts ranked by 1D traffic
GET /metadata/{hash}[/{id}] structured account & token metadata
GET /metadata/schemas list of supported JSON schema names
GET /metadata/schemas/{schema} JSON schema definition
GET /markets list of known exchanges and markets
GET /markets/tickers list of 1D market tickers
GET /markets/{exchange} exchange status
GET /markets/{exchange}/{market} market status
GET /markets/{exchange}/{market}/ticker single market ticker

Pagination and Sorting

List endpoints support pagination (e.g. to list historic transactions, contract calls, voters, etc). Two pagination methods are supported:

Default value for limit is 20 results on explorer endpoints and 500 results on tables, maximum is 500 and 50,000. Results are always sorted by row_id of the underlying table. Sort direction can be controlled by order (asc, or desc). If you require sorting by a different field, you have to do this client-side.

Indexer Status

Example request.

curl "https://api.tzstats.com/explorer/status"
import (
  "context"
  "blockwatch.cc/tzstats-go"
)

// use default Mainnet client
client := tzstats.DefaultClient
status, err := client.GetStatus(context.Background())

Example response.

{
  "mode": "sync",
  "status": "synced",
  "blocks": 626399,
  "indexed": 626399,
  "progress": 1
}

Returns the current indexer status, useful to check of the indexer is in sync with the blockchain.

HTTP Request

GET /explorer/status

HTTP Response

Field Description
mode enum Chain crawling mode (sync = live monitoring).
status enum Indexer status (connecting, syncing, synced, failed).
blocks int64 Most recent block height seen by the connected Tezos node.
indexed int64 Most recent block height indexed.
progress float Percentage of blocks indexed.

Blockchain Config

Example request.

curl "https://api.tzstats.com/explorer/config/head"
import (
  "context"
  "blockwatch.cc/tzstats-go"
)

// use default Mainnet client
client := tzstats.DefaultClient
config, err := client.GetConfig(context.Background())

Example response.

{
  "name": "Tezos",
  "network": "Mainnet",
  "symbol": "XTZ",
  "chain_id": "NetXdQprcVkpaWU",
  "deployment": 7,
  "version": 7,
  "protocol": "PsDELPH1Kxsxt8f9eWbxQeRxkjfbxoqM52jvs5Y5fBxWWh4ifpo",
  "start_height": 1212417,
  "end_height": -1,
  "no_reward_cycles": 0,
  "security_deposit_ramp_up_cycles": 0,
  "decimals": 6,
  "units": 1000000,
  "block_reward": 40,
  "block_security_deposit": 512,
  "blocks_per_commitment": 32,
  "blocks_per_cycle": 4096,
  "blocks_per_roll_snapshot": 256,
  "blocks_per_voting_period": 32768,
  "cost_per_byte": 250,
  "endorsement_reward": 1.25,
  "endorsement_security_deposit": 64,
  "endorsers_per_block": 32,
  "hard_gas_limit_per_block": 10400000,
  "hard_gas_limit_per_operation": 1040000,
  "hard_storage_limit_per_operation": 60000,
  "max_operation_data_length": 16384,
  "max_proposals_per_delegate": 20,
  "max_revelations_per_block": 0,
  "michelson_maximum_type_size": 1000,
  "nonce_length": 32,
  "origination_burn": 0,
  "origination_size": 257,
  "preserved_cycles": 5,
  "proof_of_work_nonce_size": 8,
  "proof_of_work_threshold": 70368744177663,
  "seed_nonce_revelation_tip": 0.125,
  "time_between_blocks": [
    60,
    40
  ],
  "tokens_per_roll": 8000,
  "test_chain_duration": 1966080,
  "min_proposal_quorum": 500,
  "quorum_min": 2000,
  "quorum_max": 7000,
  "block_rewards_v6": [
    1.25,
    0.1875
  ],
  "endorsement_rewards_v6": [
    1.25,
    0.833333
  ],
  "max_anon_ops_per_block": 132,
  "num_voting_periods": 4
}

Fetches blockchain configuration parameters. This endpoint accepts head and a block height as path parameters, so you can access configurations of past protocols as well.

HTTP Request

GET /explorer/config/head

HTTP Response

The response contains most of the configuration fields of a regular Tezos blockchain node, enriched with some additional contextual data.

Field Description
name string Blockchain name (Tezos).
symbol string Ticker symbol (XTZ).
network string Network name (e.g. Mainnet, Zeronet, Babylonnet, Labnet, Sandbox).
chain_id hash Chain hash.
version int64 Protocol version number.
deployment int64 Number of deployed protocols on this network.
protocol hash Protocol hash.
start_height int64 Activation height of the protocol.
end_height int64 Deactivation height of the protocol (0 if undefined).
no_reward_cycles int64 Number of initial cycles that pay no block rewards.
security_deposit_ramp_up_cycles int64 Number of initial cycles before full deposits are required.
decimals int64 Decimal points of one coin unit.
units int64 Number of atomic units in one coin (i.e. mutez).
block_reward money Block baking reward in tez.
block_security_deposit money Baker security deposit in tez.
blocks_per_commitment int64 Number of blocks between seed nonce commitments.
blocks_per_cycle int64 Number of blocks per consensus cycle.
blocks_per_roll_snapshot int64 Number of blocks between roll snapshots.
blocks_per_voting_period int64 Number of blocks per voting period.
cost_per_byte int64 Gas costs per data byte.
endorsement_reward money Block endorsing reward per slot in tez.
endorsement_security_deposit money Endorser security deposit per slot in tez.
endorsers_per_block int64 Max number of endorsing slots.
hard_gas_limit_per_block int64 Max gas limit per block.
hard_gas_limit_per_operation int64 Max gas limit per single operation.
hard_storage_limit_per_operation int64 Max gas limit for storage spent be an operation.
max_operation_data_length int64 Max data bytes per operation.
max_proposals_per_delegate int64 Max proposals per single delegate and proposals operation.
max_revelations_per_block int64 Maximum number of seed nonce revelation operations per block.
michelson_maximum_type_size int64 Maximum type size Michelson type definition.
nonce_length int64 Nonce length
origination_burn money Amount of Tezos burned per origination.
origination_size int64 Origination storage requirement in bytes.
preserved_cycles int64 Number of cycles for freezing security deposits and rewards.
proof_of_work_nonce_size int64 Nonce size for P2P messages.
proof_of_work_threshold int64 Threshold for message nonce complexity.
seed_nonce_revelation_tip money Rewards for publishing a seed nonce.
time_between_blocks array[int64] Target time between blocks in seconds.
tokens_per_roll int64 Amount of Tezos per roll.
test_chain_duration int64 Test chain lifetime in seconds.
min_proposal_quorum int64 (Babylon, v005) Minimum quorum to accept proposals in centile (i.e. 5% = 500).
quorum_min int64 (Babylon, v005) Minimum threshold for voting period quorum in centile.
quorum_max int64 (Babylon, v005) Maximum threshold for voting period quorum in centile.
block_reward_v6 [2]money (Carthage, v006) Block reward per included endorsement for prio 0 blocks [0] or >prio 0 blocks [1].
endorsement_reward_v6 [2]money (Carthage, v006) Reward per endorsement for a prio 0 block [0] or >prio 0 block [1].
max_anon_ops_per_block int64 (Delphi, v007) Max number of anonymous ops like seed nonces.
num_voting_periodsint64 (Edo, v008) Number of voting epochs, Edo introduced a 5th adoption period.
liquidity_baking_escape_ema_threshold int64 (Granada, v010) Threshold to disable liquidity baking.
liquidity_baking_subsidy int64 (Granada, v010) Subsidy amount.
liquidity_baking_sunset_level int64 (Granada, v010) Block at which liquidity baking stops.
minimal_block_delay int (Granada, v010) Actual expected time between blocks, time_between_blocks stays unchanged.

Blockchain Tip

Example request.

curl "https://api.tzstats.com/explorer/tip"
import (
  "context"
  "blockwatch.cc/tzstats-go"
)

// use default Mainnet client
client := tzstats.DefaultClient
tip, err := client.GetTip(context.Background())

Example response.

{
  "name": "Tezos",
  "network": "Mainnet",
  "symbol": "XTZ",
  "chain_id": "NetXdQprcVkpaWU",
  "genesis_time": "2018-06-30T16:07:32Z",
  "block_hash": "BLWxEruWC23hx6EvBFxr8SYCE36H2Xq3hFA3kDFEhSjBhQx7QRj",
  "timestamp": "2021-02-13T10:27:55Z",
  "height": 1342864,
  "cycle": 327,
  "total_accounts": 1101579,
  "funded_accounts": 999143,
  "total_ops": 39596837,
  "delegators": 93314,
  "delegates": 426,
  "rolls": 84949,
  "roll_owners": 404,
  "new_accounts_30d": 103666,
  "cleared_accounts_30d": 15709,
  "funded_accounts_30d": 112848,
  "inflation_1y": 40335052.002298,
  "inflation_rate_1y": 4.884188578147172,
  "health": 98,
  "deployments": [
    {
      "protocol": "PrihK96nBAFSxVL1GLJTVhu9YnzkMFiBeuJRPA8NwuZVZCE1L6i",
      "version": -1,
      "deployment": -1,
      "start_height": 0,
      "end_height": 0
    },
    {
      "protocol": "Ps9mPmXaRzmzk35gbAYNCAw6UXdE2qoABTHbN2oEEc1qM7CwT9P",
      "version": 0,
      "deployment": 0,
      "start_height": 1,
      "end_height": 1
    },
    {
      "protocol": "PtCJ7pwoxe8JasnHY8YonnLYjcVHmhiARPJvqcC6VfHT5s8k8sY",
      "version": 1,
      "deployment": 1,
      "start_height": 2,
      "end_height": 28082
    },
    {
      "protocol": "PsYLVpVvgbLhAhoqAkMFUo6gudkJ9weNXhUYCiLDzcUpFpkk8Wt",
      "version": 2,
      "deployment": 2,
      "start_height": 28083,
      "end_height": 204761
    },
    {
      "protocol": "PsddFKi32cMJ2qPjf43Qv5GDWLDPZb3T3bF6fLKiF5HtvHNU7aP",
      "version": 3,
      "deployment": 3,
      "start_height": 204762,
      "end_height": 458752
    },
    {
      "protocol": "Pt24m4xiPbLDhVgVfABUjirbmda3yohdN82Sp9FeuAXJ4eV9otd",
      "version": 4,
      "deployment": 4,
      "start_height": 458753,
      "end_height": 655360
    },
    {
      "protocol": "PsBabyM1eUXZseaJdmXFApDSBqj8YBfwELoxZHHW77EMcAbbwAS",
      "version": 5,
      "deployment": 5,
      "start_height": 655361,
      "end_height": 851968
    },
    {
      "protocol": "PsCARTHAGazKbHtnKfLzQg3kms52kSRpgnDY982a9oYsSXRLQEb",
      "version": 6,
      "deployment": 6,
      "start_height": 851969,
      "end_height": 1212416
    },
    {
      "protocol": "PsDELPH1Kxsxt8f9eWbxQeRxkjfbxoqM52jvs5Y5fBxWWh4ifpo",
      "version": 7,
      "deployment": 7,
      "start_height": 1212417,
      "end_height": -1
    }
  ],
  "supply": {
    "row_id": 1342865,
    "height": 1342864,
    "cycle": 327,
    "time": "2021-02-13T10:27:55Z",
    "total": 866164181.179763,
    "activated": 576359477.929109,
    "unclaimed": 35095400.481071,
    "liquid": 759883213.005411,
    "circulating": 769208476.09957,
    "delegated": 533114195.249729,
    "staking": 684588680.629035,
    "shielded": 0,
    "active_delegated": 530853021.716629,
    "active_staking": 680814744.486729,
    "inactive_delegated": 2261173.5331,
    "inactive_staking": 3773936.142306,
    "minted": 102201165.989543,
    "minted_baking": 32078464.975639,
    "minted_endorsing": 70116902.006583,
    "minted_seeding": 5199,
    "minted_airdrop": 600.007321,
    "minted_subsidy": 0,
    "burned": 355582.82248,
    "burned_double_baking": 132029.815883,
    "burned_double_endorse": 31838.219485,
    "burned_origination": 9211.19225,
    "burned_implicit": 177021.9575,
    "burned_seed_miss": 5481.637362,
    "frozen": 61860304.599122,
    "frozen_deposits": 60057024,
    "frozen_rewards": 1801805.068634,
    "frozen_fees": 1475.530488
  },
  "status": {
    "mode": "sync",
    "status": "synced",
    "blocks": 1342864,
    "indexed": 1342864,
    "progress": 1
  }
}

Returns info about the most recent block, indexer status, protocol deployments and supply statistics.

HTTP Request

GET /explorer/tip

HTTP Response

Field Description
name string Blockchain name (Tezos).
symbol string Ticker symbol (XTZ).
network string Network name (e.g. Mainnet, Granadanet, Sandbox).
chain_id hash Chain hash.
genesis_time datetime Genesis block timestamp.
block_hash hash Current block hash.
timestamp datetime Current block timestamp.
height int64 Current block height (level).
cycle int64 Current cycle.
total_accounts int64 Total number of on-chain accounts in existence.
funded_accounts int64 Total number on funded (non-zero) accounts.
total_ops int64 Total number of on-chain operations.
delegators int64 Current number of delegators (updated each block).
delegates int64 Current number of active delegates (updated each block).
rolls int64 Current number of network-wide rolls (updated each block).
roll_owners int64 Current number of network-wide roll owners (updated each block).
new_accounts_30d int64 Accounts created during the past 30 days.
cleared_accounts_30d int64 Accounts emptied during the past 30 days.
funded_accounts_30d int64 Accounts (re)funded (new and previously empty) during the past 30 days.
inflation_1y money Absolute inflation in tez.
inflation_rate_1y float Relative annualized inflation in percent.
health int64 Blockchain and consensus health indicator with range [0..100] based on recent 128 blocks (priority, endorsements, reorgs).
supply object Coin supply statistics at current block height.
status object Indexer status, embedded for efficiency.
deployments object Protocol deployment information such as protocol hash, protocol version id, deployment order, start and end blocks. The most recent protocol deployment has -1 as end height.

Accounts

Example request for baker accounts.

curl "https://api.tzstats.com/explorer/account/tz3RDC3Jdn4j15J7bBHZd29EUee9gVB1CxD9"
import (
  "context"
  "blockwatch.cc/tzstats-go"
  "blockwatch.cc/tzgo/tezos"
)

// use default Mainnet client
client := tzstats.DefaultClient

// get account data and embed metadata if available
a, err := client.GetAccount(
  context.Background(),
  tezos.MustParseAddress("tz3RDC3Jdn4j15J7bBHZd29EUee9gVB1CxD9"),
  tzstats.NewAccountParams().WithMeta(),
)

Example response for baker accounts.

{
  "address": "tz3RDC3Jdn4j15J7bBHZd29EUee9gVB1CxD9",
  "address_type": "p256",
  "delegate": "tz3RDC3Jdn4j15J7bBHZd29EUee9gVB1CxD9",
  "pubkey": "p2pk67wVncLFS1DQDm2gVR45sYCzQSXTtqn3bviNYXVCq6WRoqtxHXL",
  "first_in": 30,
  "first_out": 4097,
  "last_in": 1342841,
  "last_out": 1342841,
  "first_seen": 1,
  "last_seen": 1342841,
  "delegate_since": 1,
  "first_in_time": "2018-06-30T18:11:27Z",
  "first_out_time": "2018-07-03T14:17:12Z",
  "last_in_time": "2021-02-13T10:02:55Z",
  "last_out_time": "2021-02-13T10:02:55Z",
  "first_seen_time": "2018-06-30T17:39:57Z",
  "last_seen_time": "2021-02-13T10:02:55Z",
  "delegate_since_time": "2018-06-30T17:39:57Z",
  "total_received": 3199080.326956,
  "total_sent": 3000000,
  "total_burned": 0,
  "total_fees_paid": 0.044374,
  "total_rewards_earned": 3983406.864835,
  "total_fees_earned": 1034.319477,
  "total_lost": 0,
  "frozen_deposits": 2060800,
  "frozen_rewards": 61046.916177,
  "frozen_fees": 47.928321,
  "spendable_balance": 2061626.622397,
  "total_balance": 4122474.550718,
  "delegated_balance": 18921017.973163,
  "total_delegations": 14,
  "active_delegations": 9,
  "is_funded": true,
  "is_activated": true,
  "is_delegated": false,
  "is_revealed": true,
  "is_delegate": true,
  "is_active_delegate": true,
  "is_contract": false,
  "blocks_baked": 54686,
  "blocks_missed": 590,
  "blocks_stolen": 1349,
  "blocks_endorsed": 937695,
  "slots_endorsed": 1660562,
  "slots_missed": 60304,
  "n_ops": 940181,
  "n_ops_failed": 0,
  "n_tx": 69,
  "n_delegation": 0,
  "n_origination": 0,
  "n_proposal": 0,
  "n_ballot": 11,
  "token_gen_min": 1,
  "token_gen_max": 43238,
  "grace_period": 333,
  "staking_balance": 23043492.523881,
  "staking_capacity": 44530768.468665,
  "rolls": 2880,
  "last_bake_height": 1342802,
  "last_bake_block": "BLyPLQZ19VpVrAKfYd7fBfucjUFxbH8cPEKsudyBM1uJByMt315",
  "last_bake_time": "2021-02-13T09:23:55Z",
  "last_endorse_height": 1342841,
  "last_endorse_block": "BLnw18a8buAJFFNtxkizMm4Bg7oRst3eaUebYBAEeUSRRDZdfLg",
  "last_endorse_time": "2021-02-13T10:02:55Z",
  "next_bake_height": 1342857,
  "next_bake_priority": 0,
  "next_bake_time": "2021-02-13T10:18:55Z",
  "next_endorse_height": 1342843,
  "next_endorse_time": "2021-02-13T10:04:55Z",
  "avg_luck_64": 10055,
  "avg_performance_64": 9889,
  "avg_contribution_64": 9970,
  "baker_version": "08c80261"
}

Example request for non-baker accounts and contracts.

curl "https://api.tzstats.com/explorer/account/KT1QuofAgnsWffHzLA7D78rxytJruGHDe7XG"
import (
  "context"
  "blockwatch.cc/tzstats-go"
  "blockwatch.cc/tzgo/tezos"
)

// use default Mainnet client
client := tzstats.DefaultClient

// get account data and embed metadata of available
a, err := client.GetAccount(
  context.Background(),
  tezos.MustParseAddress("KT1QuofAgnsWffHzLA7D78rxytJruGHDe7XG"),
  tzstats.NewAccountParams().WithMeta(),
)

Example response for non-baker accounts and contracts.

{
  "address": "KT1QuofAgnsWffHzLA7D78rxytJruGHDe7XG",
  "address_type": "contract",
  "delegate": "tz3RDC3Jdn4j15J7bBHZd29EUee9gVB1CxD9",
  "creator": "KT1QuofAgnsWffHzLA7D78rxytJruGHDe7XG",
  "pubkey": "",
  "first_in": 30,
  "first_out": 30,
  "last_in": 984007,
  "last_out": 984007,
  "first_seen": 1,
  "last_seen": 984056,
  "delegated_since": 1,
  "first_in_time": "2018-06-30T18:11:27Z",
  "first_out_time": "2018-06-30T18:11:27Z",
  "last_in_time": "2020-06-05T19:25:32Z",
  "last_out_time": "2020-06-05T19:25:32Z",
  "first_seen_time": "2018-06-30T17:39:57Z",
  "last_seen_time": "2020-06-05T20:14:32Z",
  "delegated_since_time": "2018-06-30T17:39:57Z",
  "total_received": 0,
  "total_sent": 2822843.928521,
  "total_burned": 0,
  "total_fees_paid": 0,
  "unclaimed_balance": 6731138.546637,
  "spendable_balance": 0,
  "total_balance": 0,
  "is_funded": true,
  "is_activated": false,
  "is_delegated": true,
  "is_revealed": false,
  "is_delegate": false,
  "is_active_delegate": false,
  "is_contract": true,
  "n_ops": 31,
  "n_ops_failed": 0,
  "n_tx": 31,
  "n_delegation": 0,
  "n_origination": 0,
  "token_gen_min": 1,
  "token_gen_max": 1
}

Provides information about the most recent state of accounts and smart contracts. Baker accounts and delegator accounts contain additional state information. Use meta (boolean) to embed optional metadata. See the table below for details.

HTTP Request

GET /explorer/account/{hash}

HTTP Response

Field Description
address hash Account address as base58-check encoded string.
address_type enum Account address type ed25519 (tz1), secp256k1 (tz2), p256 (tz3), contract (KT1) or blinded (btz1).
delegate hash Current delegate (may be self when registered as delegate).
creator hash Contract creator account.
pubkey hash Revealed public key.
first_in int64 Block height of first incoming transaction.
first_out int64 Block height of first outgoing transaction.
last_in int64 Block height of latest incoming transaction.
last_out int64 Block height of latest outgoing transaction.
first_seen int64 Block height of account creation.
last_seen int64 Block height of last activity.
delegated_since int64 delegator-only Block height of most recent delegation.
delegate_since int64 baker-only Block height of most recent baker registration.
delegate_until int64 baker-only Block height of most recent baker deactivation.
first_in_time datetime Block time of first incoming transaction.
first_out_time datetime Block time of first outgoing transaction.
last_in_time datetime Block time of latest incoming transaction.
last_out_time datetime Block time of latest outgoing transaction.
first_seen_time datetime Block time of account creation.
last_seen_time datetime Block time of last activity.
delegated_since_time datetime delegator-only Block time of most recent delegation.
delegate_since_time datetime baker-only Block time of most recent baker registration.
delegate_until_time datetime baker-only Block time of most recent baker deactivation.
total_received money Lifetime total tokens received in transactions.
total_sent money Lifetime total tokens sent in transactions.
total_burned money Lifetime total tokens burned in tez.
total_fees_paid money Lifetime fees paid in tez.
total_rewards_earned money baker-only Lifetime rewards earned in tez.
total_fees_earned money baker-only Lifetime fees earned in tez.
total_lost money baker-only Lifetime total tokens lost in tez.
frozen_deposits money baker-only Currently frozen deposits
frozen_rewards money baker-only Currently frozen rewards.
frozen_fees money baker-only Currently frozen fees.
unclaimed_balance money Currently unclaimed balance (for vesting contracts and commitments).
spendable_balance money Currently spendable balance.
total_balance money Currently spendable and frozen balances (except frozen rewards).
delegated_balance money baker-only (delegate only) Current incoming delegations.
staking_balance money baker-only (delegate only) Current delegated and own total balance.
total_delegations int64 baker-only (delegate only) Lifetime count of delegations.
active_delegations int64 baker-only (delegate only) Currently active and non-zero delegations.
is_funded bool Flag indicating the account is funded.
is_activated bool Flag indicating the account was activated from a commitment.
is_delegated bool Flag indicating the account is currently delegated.
is_revealed bool Flag indicating the account has a revealed public key .
is_delegate bool Flag indicating the account is a registered delegate.
is_active_delegate bool Flag indicating the account is a registered and active delegate.
is_contract bool Flag indicating the account is a smart contract.
blocks_baked int64 baker-only Lifetime total blocks baked.
blocks_missed int64 baker-only Lifetime total block baking missed.
blocks_stolen int64 baker-only Lifetime total block baked at priority > 0.
blocks_endorsed int64 baker-only Lifetime total blocks endorsed.
slots_endorsed int64 baker-only Lifetime total endorsement slots endorsed.
slots_missed int64 baker-only Lifetime total endorsement slots missed.
n_ops int64 Lifetime total number of operations sent and received.
n_ops_failed int64 Lifetime total number of operations sent that failed.
n_tx int64 Lifetime total number of transactions sent and received.
n_delegation int64 Lifetime total number of delegations sent.
n_origination int64 Lifetime total number of originations sent.
n_proposal int64 baker-only Lifetime total number of proposals (operations) sent.
n_ballot int64 baker-only Lifetime total number of ballots sent.
token_gen_min int64 Minimum generation number of all tokens owned.
token_gen_max int64 Maximum generation number of all tokens owned.
grace_period int64 baker-only (delegate only) Current grace period before deactivation.
rolls int64 baker-only (delegate only) Currently owned rolls.
rich_rank int64 meta-arg Global rank on rich list by total balance. Requires meta=1 argument.
traffic_rank int64 meta-arg Global rank on 1D most active accounts by transactions sent/received. Requires meta=1 argument.
volume_rank int64 meta-arg Global rank on 1D most active accounts by volume sent/received. Requires meta=1 argument.
last_bake_height int64 baker-only Height of most recent block baked.
last_bake_block hash baker-only Hash of most recent block baked.
last_bake_time datetime baker-only Timestamp of most recent block baked.
last_endorse_height int64 baker-only Height of most recent block endorsed.
last_endorse_block hash baker-only Hash of most recent block endorsed.
last_endorse_time datetime baker-only Timestamp of most recent block endorsed.
next_bake_height int64 baker-only Height of next block baking right.
next_bake_priority int64 baker-only Priority of next baking right (fixed at zero currently).
next_bake_time datetime baker-only Approximate time of next block baking right.
next_endorse_height int64 baker-only Height of next block endorsing right.
next_endorse_time datetime baker-only Approximate time of next block endorsing right.
avg_luck_64 float baker-only Average luck to get random priority zero baking/endorsing rights for the past 64 cycles (182 days, 6 months).
avg_performance_64 float baker-only Average performance for the past 64 cycles (182 days, 6 months).
avg_contribution_64 float baker-only Average utilization of rights to bake/endorse blocks for the past 64 cycles. Since block rewards have become dynamic, a baker who fails to contribute to the consensus by utilizing 100% of their rights diminishes the income for other bakers.
baker_version hash baker-only Software version run by the baker at the last seen block. This is the first 8 hex digits of the Git repository hash.
metadata object meta-arg Embedded account metadata if available. Requires meta=1 argument.

List Account Operations

Example request for account operation list.

curl "https://api.tzstats.com/explorer/account/tz1irJKkXS2DBWkU1NnmFQx1c1L7pbGg4yhk/operations?limit=100&order=desc"
import (
  "context"
  "blockwatch.cc/tzstats-go"
  "blockwatch.cc/tzgo/tezos"
)

// use default Mainnet client
client := tzstats.DefaultClient

// list operations sent and received by this account
ops, err := client.GetAccountOps(
  context.Background(),
  tezos.MustParseAddress("tz1irJKkXS2DBWkU1NnmFQx1c1L7pbGg4yhk"),
  tzstats.NewOpParams().
    WithLimit(100).
    WithOrder(tzstats.OrderDesc),
)

GET /explorer/account/{hash}/operations

Lists operations sent from and to an account (defaults to all types and ascending order). This endpoint supports pagination with cursor or offset and limit. Use type to filter for a specific operation type (e.g. transaction).

To query for updates after a certain block use the optional argument since (int64|hash) or simply use cursor. Using block hash has the advantage that the query is reorg-aware, i.e. it throws a 409 error when the specified block has become orphan.

To change the order of returned operations use the optional order (asc|desc) parameter. Use meta (boolean) to add optional account metadata.

List Managed and Created Contracts

Example request for listing created contracts.

curl "https://api.tzstats.com/explorer/account/tz1UBZUkXpKGhYsP5KtzDNqLLchwF4uHrGjw/contracts"
import (
  "context"
  "blockwatch.cc/tzstats-go"
  "blockwatch.cc/tzgo/tezos"
)

// use default Mainnet client
client := tzstats.DefaultClient

// list deployed contracts
contracts, err := client.GetAccountContracts(
  context.Background(),
  tezos.MustParseAddress("tz1UBZUkXpKGhYsP5KtzDNqLLchwF4uHrGjw"),
  tzstats.NewAccountParams(),
)

GET /explorer/account/{hash}/contracts

Lists all contracts this account has originated. This endpoint has been renamed from ../managed.

List Account Ballots

curl "https://api.tzstats.com/explorer/account/tz1aRoaRhSpRYvFdyvgWLL6TGyRoGF51wDjM/ballots"

GET /explorer/account/{hash}/ballots

Lists all voting ballots the account has sent. This applies to bakers only.

Operations

Example request.

curl "https://api.tzstats.com/explorer/op/opSrt7oYHDTZcfGnhNt3BzGrrCQf364VuYmKo5ZQVQRfTnczjnf"
import (
  "context"
  "blockwatch.cc/tzstats-go"
  "blockwatch.cc/tzgo/tezos"
)

// use default Mainnet client
client := tzstats.DefaultClient

// get all members of the operation group identified by hash
opGroup, err := client.GetOp(
  context.Background(),
  tezos.MustParseOpHash("opSrt7oYHDTZcfGnhNt3BzGrrCQf364VuYmKo5ZQVQRfTnczjnf"),
  tzstats.NewOpParams(),
)

Example response.

[
  {
    "row_id": 28086947,
    "hash": "opSrt7oYHDTZcfGnhNt3BzGrrCQf364VuYmKo5ZQVQRfTnczjnf",
    "type": "transaction",
    "block": "BL1PGezBat3BX1N2rnk1qycTJbCXdWJwYoGBChyeFyYJABGLyZ9",
    "time": "2020-06-25T06:18:19Z",
    "height": 1011875,
    "cycle": 247,
    "counter": 2187104,
    "op_n": 22,
    "op_l": 3,
    "op_p": 3,
    "op_c": 0,
    "op_i": 0,
    "status": "applied",
    "is_success": true,
    "is_contract": false,
    "gas_limit": 15385,
    "gas_used": 10207,
    "gas_price": 0.17557,
    "storage_limit": 257,
    "storage_size": 0,
    "storage_paid": 0,
    "volume": 0.040128,
    "fee": 0.001792,
    "reward": 0,
    "deposit": 0,
    "burned": 0,
    "is_internal": false,
    "has_data": false,
    "days_destroyed": 0.016302,
    "sender": "tz1Ywgcavxq9D6hL32Q2AQWHAux9MrWqGoZC",
    "receiver": "tz1ijyJy2QncvgDKZJARDgPqEYVRk6yTE5d7",
    "branch_height": 1011874,
    "branch_depth": 1,
    "branch_hash": "BKt5Lz42YyZNaSYkqfx3m9cmZ2qRoqw1duHqvygLUrgxCewYXoS",
    "is_implicit": false,
    "entrypoint_id": 0,
    "is_orphan": false,
    "is_batch": true,
    "is_sapling": false,
    "confirmations": 466404,
    "entrypoint": ""
  },
  // ...
]

Returns info about a single operation or a list of related operations. Because Tezos supports batch operations (multiple operations sharing the same hash) and internal operations (created by smart contract calls in response to a transaction) this endpoint always returns an array of operation objects. In many cases this array contains one element only. Use the optional prim (boolean) parameter to embed Michelson primitive trees with smart contract calls. Use meta (boolean) to add optional account metadata.

HTTP Request

GET /explorer/op/{hash|id}

HTTP Response

Field Description
hash hash Operation hash.
type enum Operation type.
block hash Block hash at which the operation was included on-chain.
time datetime Block time at which the operation was included on-chain.
height int64 Block height at which the operation was included on-chain.
cycle int64 Cycle in which the operation was included on-chain.
counter int64 Unique sender account ‘nonce’ value.
op_n int64 In block operation counter.
op_l int64 Tezos RPC operation list number (0..3).
op_p int64 Tezos RPC operation list position.
op_c int64 Bulk operation list position.
op_i int64 Internal operation list position.
status enum Operation status applied, failed, backtracked, skipped.
is_success bool Flag indicating operation was successfully applied.
is_contract bool Flag indicating smart-contract calls.
gas_limit int64 Caller-defined gas limit.
gas_used int64 Gas used by the operation.
gas_price float Effective price per gas unit in mutez.
storage_limit int64 Caller-defined storage limit.
storage_size int64 Actual storage size allocated.
storage_paid int64 Part of the storage the operation paid for.
volume money Amount of tokens transferred in tz. In denunciation operations, this field contains the accuser reward, in delegation operations this field contains the initially delegated balance.
fee money Fees paid in tez. In denunciation operations, this field contains the offender loss as negative value.
reward money Rewards earned in tez. In denunciation operations, this field contains the offender loss as negative value.
deposit money Amount of deposited tokens in tez. In denunciation operations, this field contains the offender loss as negative value.
burned money Amount of burned tokens in tez.
is_internal bool Flag indicating if this operation was sent be a smart contract.
is_implicit bool Flag indicating implicit on-chain events, ie. state changes that don’t have an operation hash such as bake, unfreeze, seed_slash, airdrop, invoice, and migration.
has_data bool Flag indicating if extra data or parameters are present.
data polymorph Extra type-dependent operation data. See below.
parameters object Call parameters as embedded JSON object, contract-only.
storage object Updated contract storage as embedded JSON object, contract-only.
big_map_diff object Inserted, updated or deleted bigmap entries as embedded JSON object, contract-only.
days_destroyed float Token days destroyed by this operation (tokens transferred * token idle time).
parameters object Contract call parameters.
storage object Updated version of contract storage after call.
data object Extra operation data (see below for content encoding).
big_map_diff array List of bigmap updates.
errors array Native Tezos RPC errors.
sender hash Operation sender.
receiver hash Transaction receiver, may be empty. For activate_account the source account is referenced when the activation merged coins from a second blinded account (ie. when a fundraiser signed up twice). For delegation the previous delegate is referenced. For seed_nonce_revelation the actual seed publisher is referenced.
delegate hash New Delegate, only used by origination and delegation. When empty for a delegation the operation was a delegate withdrawal.
creator hash Contains contract creator on origination. For internal transactions, the original sender of the external transaction is referenced.
branch_height int64 meta-arg Height of the branch block this op refers to.
branch_depth int64 meta-arg Count of blocks between branch block and block including this op.
branch_hash hash meta-arg Block hash of the branch this op refers to.
entrypoint_id int64 Serial id of the called entrypoint, only relevant if the operation was a transaction, the receiver is a smart contract and call parameters are present.
is_orphan bool Flag indicating whether this operation was orphaned (not included in any block).
is_batch bool Flag indicating if this operation is part of a batch operation list.
batch_volume money Total amount transferred in a batch operation list. Only available of the first operation of a batch list and only when any transfers happened.
metadata object Use meta=1 to embed optional account metadata for sender, receiver, delegate, creator. May be empty if no account has metadata defined.
confirmations int64 Number of blocks following the inclusion of this operation. Usually 6 blocks are OK to consider an operation final (not subject to reorg).
entrypoint string Name of the contract entrypoint if op is a contract call.

List of supported operation types

Decoding Operation Data

Some operations contain extra data in the polymorphic data field. This field exists when the has_data flag is true. Decoding the data depends on the operation type.

Operation Data Type Specification
activate_account string hex(secret),blinded-address
endorsement uint 32bit big-endian bitmask identifying endorsed slots
ballot string proposal-hash,ballot (yay, nay, pass)
proposals string comma-separated list or proposal hashes
reveal string public key hash
seed_nonce_revelation string level,hex(nonce)
double_baking_evidence object JSON array of double signed block headers
double_endorsemnt_evidence object JSON array of double signed endorsements
transaction - unused, see parameters, storage and big_map_diff

Bakers

Get a list of all active bakers, their current status and affiliation metadata. Optionally filter by status and country or get a random list of suggestions for a given account. This endpoint is supposed to be a simple to use listing feature for wallets and other dapps who like to enable delegation.

Filter Options

You can filter the baker list by the following criteria

Argument Description
status enum Filter by baker status public, private, closing, closed.
country enum Filter by baker country of operation (use ISO 3166-1 Alpha-2 country codes, that’s two uppercase letters like US, DE, FR)
suggest address Return a suggested list of bakers for the given address (see below)
cursor int Last baker id after which to continue listing, use for paging.
limit int Max number of results to return (max 100).
offset int Skip first N results, use for paging instead of cursor.

Baker Metadata

Example request.

curl "https://api.tzstats.com/explorer/bakers"

Example response.

[
  {
    "id": 25,
    "address": "tz3RDC3Jdn4j15J7bBHZd29EUee9gVB1CxD9",
    "baker_since_time": "2018-06-30T17:39:57Z",
    "baker_version": "31e6641d",
    "total_balance": 3480925.146338,
    "spendable_balance": 1397389.603135,
    "frozen_deposits": 2083328,
    "frozen_rewards": 63537.333133,
    "frozen_fees": 207.543203,
    "staking_balance": 12141916.235343,
    "staking_capacity": 37791553.487076,
    "active_delegations": 8,
    "is_full": false,
    "rolls": 1517,
    "share": 0.017767418980803692,
    "avg_luck_64": 9988,
    "avg_performance_64": 9852,
    "avg_contribution_64": 9948,
    "metadata": {
      "address": "tz3RDC3Jdn4j15J7bBHZd29EUee9gVB1CxD9",
      "alias":{
        "name": "Foundation Baker 1",
        "kind": "validator",
        "logo": "tz3RDC3Jdn4j15J7bBHZd29EUee9gVB1CxD9.png"
      },
      "baker": {
        "status": "private",
        "non_delegatable": true
      },
      "location": {
        "country": "CH"
      },
      "social": {
        "twitter": "TezosFoundation"
      }
    }
  },
  // ...
]

Returns structured metadata about a baker.

HTTP Request

GET /explorer/bakers

HTTP Response

Field Description
id int64 Internal account id, use for cursor-based paging.
address hash Baker account address.
baker_since_time datetime Time when baker registered.
baker_version hex Git hash of mist recently seen baker software.
total_balance money Currently spendable and frozen balances (except frozen rewards).
spendable_balance money Currently spendable balance.
frozen_deposits money Currently frozen deposits
frozen_rewards money Currently frozen rewards.
frozen_fees money Currently frozen fees.
staking_balance money Current delegated and own total balance.
staking_capacity money Available delegation capacity (before overdelegation).
active_delegations int64 Currently active and non-zero delegations.
is_full bool Flag indicating the baker cannot accept more delegations, i.e. is overdelegated.
rolls int64 Number of rolls currently owned.
avg_luck_64 float Average luck to get random priority zero baking/endorsing rights for the past 64 cycles (182 days, 6 months).
avg_performance_64 float Average reward generation performance for the past 64 cycles (182 days, 6 months).
avg_contribution_64 float Average utilization of rights to bake/endorse blocks for the past 64 cycles.
metadata object Structured account metadata.

Bigmaps

Bigmaps are key-value stores where smart contracts keep large amounts of data. Values in bigmaps are accessed by unique keys. The TzStats bigmap index supports different keys, a hash (script expression hash) and the native typed version of a key. For convenience, both variants are present in responses as key_hash and key.

Types A bigmap is defined by a key_type and a value_type. While the key type is most often a simple type (int, string, bytes, address, etc) it can also be an object. Values are represented as unfolded (decoded) form and optionally as original Michelson primitives.

Unfolding uses Micheline type annotations from the smart contract to decompose native primitives into nested JSON objects. Annotations become JSON property names. To request the original Micheline primitives, add query parameter prim=1 (bool).

Packed Data When data is packed using the PACK instruction, an unpacked version can be obtained with the unpack=1 (bool) query argument. In this case both key and value contain the unpacked version. We also try to recursively unpack all embedded values of type bytes so that URLs, names and other packed data becomes easier to access.

Metadata Each bigmap entry comes with a set of metadata that describes its latest update time, block hash and height as well as the bigmap id and its owner contract.

Pagination The Bigmap API support paginated queries for keys, values and updates using limit and cursor or offset.

Historic Values To query a bigmap at a certain point in time add the block (int64|hash) query argument. Using block hashes is reorg-aware, i.e. in case you execute a query on a block that becomes orphaned, the API returns a 409 Conflict error.

If you like to query for updates that happened after a certain block, add a since (int64|hash) argument.

SECURITY WARNING

Unlike other on-chain data where values and ranges are predictable the contents of bigmaps is entirely user-controlled and unpredictable. IT MAY CONTAIN MALICIOUS DATA INTENDED TO ATTACK YOUR APPLICATIONS AND USERS! Be vigilant and sanitize all data before you process or display it.

Bigmap Info

Example request.

curl "https://api.tzstats.com/explorer/bigmap/523"
import (
  "context"
  "blockwatch.cc/tzstats-go"
)

// use default Mainnet client
client := tzstats.DefaultClient

bigmap, err := client.GetBigmap(
  context.Background(),
  523,
  tzstats.NewContractParams(),
)

Example response.

{
  "alloc_block": "BLmmtt7CFJagi9DWTNNjqD1JBBRmknpmcgAcpsJRhw5KQnybBoc",
  "alloc_height": 1365148,
  "alloc_time": "2021-03-01T02:04:41Z",
  "bigmap_id": 523,
  "contract": "KT1Hkg5qeNhfwpKW4fXvq7HGZB9z2EnmCCA9",
  "key_type": {
    "name": "@key",
    "type": "nat"
  },
  "n_keys": 90005,
  "n_updates": 640725,
  "update_block": "BLFiakfUmXoLuN7DGoRkykQjEHr73ShWspXKLEdDC1hwpHiENu6",
  "update_height": 1478163,
  "update_time": "2021-05-19T10:59:14Z",
  "value_type": {
    "args": [
    {
      "name": "issuer",
      "type": "address"
    },
    {
      "name": "objkt_amount",
      "type": "nat"
    },
    {
      "name": "objkt_id",
      "type": "nat"
    },
    {
      "name": "xtz_per_objkt",
      "type": "mutez"
    }
    ],
    "name": "@value",
    "type": "struct"
  }
}

Returns information about the identity and type of a bigmap. At access native Micheline type info, add prim=1 (boolean)

HTTP Request

GET /explorer/bigmap/{id}

HTTP Response

Field Description
alloc_block hash Hash of the block where the bigmap was allocated.
alloc_height int64 Height when the bigmap was allocated.
alloc_time datetime Timestamp when the bigmap was allocated.
bigmap_id int64 Unique on-chain id of this bigmap.
contract hash Contract that owns the bigmap.
key_type object Typedef describing bigmap keys.
value_type object Typedef describing bigmap values.
n_keys int64 Current number of live keys in bigmap.
n_updates int64 Total update count.
update_height int64 Last update height.
update_block hash Hash of the block containing the latest update.
update_time datetime Last update timestamp.
key_type_prim object Native Micheline type for key.
value_type_prim object Native Micheline type for value.

Bigmap Keys

Example request.

curl "https://api.tzstats.com/explorer/bigmap/523/keys?meta=1&prim=1&unpack=1"
import (
  "context"
  "blockwatch.cc/tzstats-go"
)

// use default Mainnet client
client := tzstats.DefaultClient

keys, err := client.GetBigmapKeys(
  context.Background(),
  523,
  tzstats.NewContractParams().
    WithMeta().
    WithPrim().
    WithUnpack(),
)

// access integer key
i, ok := keys[0].GetBig("")

// access pair key element
addr, ok := keys[0].GetAddress("0")

Example response.

[
  {
    "key": "29",
    "key_hash": "exprvFW5tJBbcQUhtABJ2ThMb6v5ufBaoanohBBBikEMBJDjEjKdS6",
    "meta": {
      "bigmap_id": 523,
      "block": "BLBx21J2jcSEUpFZyCkCjWf2M4SGsTyPZnQLnZYD3KpKWm7ZpYM",
      "contract": "KT1Hkg5qeNhfwpKW4fXvq7HGZB9z2EnmCCA9",
      "height": 1366105,
      "is_removed": false,
      "is_replaced": false,
      "time": "2021-03-01T18:10:47Z"
    },
    "prim": {
      "int": "29"
    }
  }
  // ...
]

Lists bigmap keys with optional metadata, native primitives and unpacking. Supports

HTTP Request

GET /explorer/bigmap/{id}/keys

HTTP Response

Field Description
key polymorph The native representation of the key. Integers are bigints wrapped in strings, other types are rendered according to type rules, e.g. addresses, keys and signatures are base58check encoded, timestamps are ISO8601, etc. Can be used for lookup.
key_hash hash The script expression hash for this key. Can be used for lookup.
meta object Metadata for the current bigmap entry (optional, use meta=1).
meta.bigmap_id int64 Unique on-chain id of this bigmap.
meta.contract hash Contract that owns the bigmap.
meta.time datetime Update timestamp for this key/value pair.
meta.height int64 Update height for this key/value pair.
meta.block hash Hash of the block containing the latest update.
meta.is_replaced bool Flag indicating if a future update has overwritten the current value. Useful in combination with the block parameter that allows to query a value at a point in history.
meta.is_removed bool Flag indicating if a future remove action has deleted the current key. Useful in combination with the block parameter that allows to query a value at a point in history.
prim object Native JSON encoded Micheline primitives (optional, use prim=1).

Bigmap Values

Example request.

curl "https://api.tzstats.com/explorer/bigmap/511/values"
import (
  "context"
  "blockwatch.cc/tzstats-go"
)

// use default Mainnet client
client := tzstats.DefaultClient

values, err := client.GetBigmapValues(
  context.Background(),
  511,
  tzstats.NewContractParams().
    WithMeta().
    WithPrim().
    WithUnpack(),
)

// access pair key element
addr, ok := values[0].Key.GetAddress("0")

// access integer value
i, ok := values[0].GetBig("")

Example response.

[
  {
    "key": {
      "0": "tz1UBZUkXpKGhYsP5KtzDNqLLchwF4uHrGjw",
      "1": "153"
    },
    "key_hash": "exprvD1v8DxXvrsCqbx7BA2ZqxYuUk9jXE1QrXuL46i3MWG6o1szUq",
    "key_prim": {
      "args": [
        {
          "bytes": "00005db799bf9b0dc319ba1cf21ab01461a9639043ca"
        },
        {
          "int": "153"
        }
      ],
      "prim": "Pair"
    },
    "meta": {
      "bigmap_id": 511,
      "block": "BL9xqjjom8B9wsp6RgMkFjKzNmYKyDqY4nH7Scqvgp9ut4FK1zJ",
      "contract": "KT1RJ6PbjHpwc3M5rw5s2Nbmefwbuwbdxton",
      "height": 1365467,
      "is_removed": false,
      "is_replaced": false,
      "time": "2021-03-01T07:27:27Z"
    },
    "value": "2",
    "value_prim": {
      "int": "2"
    }
  }
  // ...
]

Lists key/value pairs in bigmaps with optional metadata, native primitives and unpacking. Supports

HTTP Request

GET /explorer/bigmap/{id}/values

GET /explorer/bigmap/{id}/{key}

The second variant returns a single bigmap value stored at key if exists. Key can be a key hash (script expr hash) or the native key representation (i.e. an address or integer). For pair keys, separate the pair’s elements with comma.

HTTP Response

Field Description
key polymorph The native representation of the key. Integers are bigints wrapped in strings, other types are rendered according to type rules, e.g. addresses, keys and signatures are base58check encoded, timestamps are ISO8601, etc).
key_hash hash The script expression hash for this key.
value object Unfolded and optionally unpacked value, such as simple string or nested JSON objects/arrays to represent records, lists, sets, and maps.
meta object Metadata for the current bigmap entry (optional, use meta=1).
meta.contract hash Contract that owns the bigmap.
meta.bigmap_id int64 Unique on-chain id of this bigmap.
meta.time datetime Update timestamp for this key/value pair.
meta.height int64 Update height for this key/value pair.
meta.block hash Hash of the block containing the latest update.
key_prim object Native Micheline primitive for key (optional, use prim=1).
value_prim object Native Micheline primitive for value (optional, use prim=1).

Bigmap Updates

Example request.

curl "https://api.tzstats.com/explorer/bigmap/511/updates?prim=1&meta=1&unpack=1"
import (
  "context"
  "blockwatch.cc/tzstats-go"
)

// use default Mainnet client
client := tzstats.DefaultClient

upd, err := client.GetBigmapUpdates(
  context.Background(),
  511,
  tzstats.NewContractParams().
    WithMeta().
    WithPrim().
    WithUnpack(),
)

Example response.

[
  {
    "action": "update",
    "bigmap_id": 511,
    "key": {
      "0": "tz1UBZUkXpKGhYsP5KtzDNqLLchwF4uHrGjw",
      "1": "152"
    },
    "key_hash": "expru3VKqrBfsG3ZbP9eBTTpWrYWth5Ypp8qhn6JyM4BR3pTB3PGu8",
    "key_prim": {
      "args": [
        {
          "bytes": "00005db799bf9b0dc319ba1cf21ab01461a9639043ca"
        },
        {
          "int": "152"
        }
      ],
      "prim": "Pair"
    },
    "meta": {
      "bigmap_id": 511,
      "block": "BMPAfxwn8rgQdhgvHJ479aF5sLPQ3uocSTkeZLDpLapf4Wqp34J",
      "contract": "KT1RJ6PbjHpwc3M5rw5s2Nbmefwbuwbdxton",
      "height": 1365242,
      "time": "2021-03-01T03:39:21Z"
    },
    "value": "1",
    "value_prim": {
      "int": "1"
    }
  }
  // ...
]

List historic updates to a bigmap in chronological order, including keys that have been deleted. Supports

HTTP Request

GET /explorer/bigmap/{id}/updates

GET /explorer/bigmap/{id}/updates/{key}

The second variant lists updates for a specific key only.Key can be a key hash (script expr hash) or the native key representation (i.e. an address or integer). For pair keys, separate the pair’s elements with comma.

HTTP Response

Contains the same fields as the values endpoint above with one addition:

Field Description
action enum Update kind, one of alloc, update, remove, copy.
bigmap_id int64 Unique on-chain id of this bigmap.
key polymorph The native representation of the key. Integers are bigints wrapped in strings, other types are rendered according to type rules, e.g. addresses, keys and signatures are base58check encoded, timestamps are ISO8601, etc).
key_hash hash The script expression hash for this key.
value object Unfolded and optionally unpacked value, such as simple string or nested JSON objects/arrays to represent records, lists, sets, and maps.
meta object Metadata for the current bigmap entry (optional, use meta=1).
meta.contract hash Contract that owns the bigmap.
meta.bigmap_id int64 Unique on-chain id of this bigmap.
meta.time datetime Update timestamp for this key/value pair.
meta.height int64 Update height for this key/value pair.
meta.block hash Hash of the block containing the latest update.
key_prim object Native Micheline primitive for key (optional, use prim=1).
value_prim object Native Micheline primitive for value (optional, use prim=1).
source_big_map int64 Source bigmap copied (only for action=copy).
destination_big_map int64 Destination bigmap created (only for action=copy).

Blocks

Example request.

curl "https://api.tzstats.com/explorer/block/1342853?meta=1&rights=1"
import (
  "context"
  "blockwatch.cc/tzstats-go"
)

// use default Mainnet client
client := tzstats.DefaultClient

block, err := client.GetBlockHeight(
  context.Background(),
  1342853,
  tzstats.NewBlockParams().
    WithMeta().
    WithRights(),
)

Example response.

{
  "hash": "BLhRjTFhk37a8vgE2M5DU2cCbtV3qJHaBBPvTboHfyLYV74hM99",
  "predecessor": "BKjZfegUTsCD3eURHPur6L6zRmS6c6D9cdwLKoFDU9DcmJmWnaY",
  "successor": "BMKvd7HhwnhCTSWGG2YkDrsWSugcZefo1V5i9gZ2Khz87S3e98k",
  "baker": "tz1bTpviNnyx2PXsNmGpCQTMQsGoYordkUoA",
  "height": 1342853,
  "cycle": 327,
  "is_cycle_snapshot": false,
  "time": "2021-02-13T10:16:55Z",
  "solvetime": 60,
  "version": 7,
  "validation_pass": 4,
  "fitness": 687493,
  "priority": 0,
  "nonce": "6102c808a62a0100",
  "voting_period_kind": "promotion_vote",
  "slot_mask": "FFFFDFFF",
  "n_endorsed_slots": 31,
  "n_ops": 28,
  "n_ops_failed": 0,
  "n_ops_contract": 1,
  "n_tx": 7,
  "n_activation": 0,
  "n_seed_nonce_revelations": 0,
  "n_double_baking_evidences": 0,
  "n_double_endorsement_evidences": 0,
  "n_endorsement": 19,
  "n_delegation": 1,
  "n_reveal": 1,
  "n_origination": 0,
  "n_proposal": 0,
  "n_ballot": 0,
  "volume": 98233.072783,
  "fee": 0.019784,
  "reward": 38.75,
  "deposit": 512,
  "unfrozen_fees": 0,
  "unfrozen_rewards": 0,
  "unfrozen_deposits": 0,
  "activated_supply": 0,
  "burned_supply": 0.19275,
  "n_accounts": 31,
  "n_new_accounts": 1,
  "n_new_implicit": 1,
  "n_new_managed": 0,
  "n_new_contracts": 0,
  "n_cleared_accounts": 0,
  "n_funded_accounts": 3,
  "gas_limit": 113904,
  "gas_used": 15466,
  "gas_price": 1.27919,
  "storage_size": 621,
  "days_destroyed": 812.427699,
  "pct_account_reuse": 96.7741935483871,
  "n_ops_implicit": 1,
  "lb_esc_vote": false,
  "lb_esc_ema": 0,
  "metadata": {
    "tz1KfEsrtDaA1sX7vdM4qmEPWuSytuqCDp5j": {
      "alias": {
        "name": "XTZ Master",
        "kind": "validator",
        "logo": "tz1KfEsrtDaA1sX7vdM4qmEPWuSytuqCDp5j.png"
      },
      "baker": {
        "status": "public",
        "fee": 0.08,
        "payout_delay": true
      },
      "location": {
        "country": "AU"
      },
      "social": {
        "twitter": "Xtzmastercom"
      }
    },
    // ...
  },
  "rights": [
    {
      "type": "baking",
      "priority": 0,
      "address": "tz1bTpviNnyx2PXsNmGpCQTMQsGoYordkUoA",
      "is_used": true
    },
    {
      "type": "endorsing",
      "slots": [4,9],
      "address": "tz2FCNBrERXtaTtNX6iimR1UJ5JSDxvdHM93",
      "is_used": true
    },
    // ...
  ]
}

Fetches information about the specified block. Takes either a block hash, a block height or the string head as argument. Use meta (boolean) to embed optional account metadata and rights to embed information about baking and endorsing rights as well as their status.

HTTP Request

GET /explorer/block/{hash,height,head}

HTTP Response

Field Description
hash hash Block hash.
predecessor hash Parent block on canonical chain or orphan side-chain.
successor hash Child block on canonical chain or orphan side-chain.
baker hash Baker address.
height int64 Block height (a.k.a level).
cycle int64 Cycle
is_cycle_snapshot bool True if this block has been selected as snapshot.
time datetime Block creation time.
solvetime duration Time since last block in seconds.
version int64 Protocol version.
validation_pass int64 Block validation pass.
fitness int64 Block fitness used to determine longest chain.
priority int64 Baking priority.
nonce uint64 Block nonce
voting_period_kind enum Current voting period proposal, exploration, cooldown, promotion, adoption.
slot_mask string Hex string of 32bit or 256bit bitmask indicating which slots have been endorsed. (Note this field will be set from endorsements published in the subsequent block.)
n_endorsed_slots int64 Count of endorsed slots. (Note this field will be set from endorsements published in the subsequent block.)
n_ops int64 Count of operations contained in this block.
n_ops_failed int64 Count of failed operations.
n_ops_contract int64 Count of smart contract operations (transactions sent to contracts and internal operations sent by contracts).
n_ops_implicit int64 Count of implicit events, ie. operations and state changes that don’t have an operation hash such as bake, unfreeze, seed_slash, airdrop and invoice.
n_tx int64 Count of transaction operations.
n_activation int64 Count of activate_account operations.
n_seed_nonce_revelation int64 Count of seed_nonce_revelation operations.
n_double_baking_evidence int64 Count of double_baking_evidence operations.
n_double_endorsement_evidence int64 Count of double_endorsement_evidence operations.
n_endorsement int64 Count of endorsement operations.
n_delegation int64 Count of delegation operations.
n_reveal int64 Count of reveal operations.
n_origination int64 Count of origination operations.
n_proposal int64 Count of proposals operations.
n_ballot int64 Count of ballot operations.
volume money Total amount of tokens moved between accounts.
fee money Total fee paid (and frozen) by all operations.
reward money Reward earned (and frozen) by the block baker.
deposit money Deposit frozen by the block baker.
unfrozen_fees money Total unfrozen fees (at end of a cycle).
unfrozen_rewards money Total unfrozen rewards (at end of a cycle).
unfrozen_deposits money Total unfrozen deposits (at end of a cycle).
activated_supply money Total amount of commitments activated in tez.
burned_supply money Total amount of tokens burned by operations in tez.
n_accounts int64 Count of accounts seen in this block (i.e. this includes all operation senders, receivers, delegates and the block’s baker).
n_new_accounts int64 Count of new accounts created regardless of type.
n_new_implicit int64 Count of created implicit accounts (tz1/2/3).
n_new_managed int64 Count of created managed accounts (KT1 without code or manager.tz script).
n_new_contracts int64 Count of created smart contracts (KT1 with code).
n_cleared_accounts int64 Count of accounts that were emptied (final balance = 0).
n_funded_accounts int64 Count of accounts that were funded by operations (this includes all new accounts plus previously cleared accounts that were funded again).
gas_limit int64 Total gas limit defined by operations.
gas_used int64 Total gas consumed by operations.
gas_price float Average price of one gas unit in mutez.
storage_size int64 Total sum of new storage allocated by operations.
days_destroyed float Token days destroyed (tokens transferred * token idle time).
pct_account_reuse float Portion of seen accounts that existed before.
lb_esc_ema int64 Granada liquidity baking vote moving average.
lb_esc_vote bool Granada liquidity baking disable vote flag.
metadata object Optional account metadata for baker and endorsers, missing when no metadata is available. Endorser metadata is only embedded when rights arg is also set.
rights array List of endorsing (all slots) and baking rights (all priorities up to block priority) including owner and status.

List Block Operations

Example request to list block operations.

curl "https://api.tzstats.com/explorer/block/head/operations?meta=1"
import (
  "context"
  "blockwatch.cc/tzstats-go"
)

// use default Mainnet client
client := tzstats.DefaultClient

ops, err := client.GetBlockOps(
  context.Background(),
  1342853,
  tzstats.NewOpParams().
    WithMeta(),
)

Example response.

[
  {
    "row_id": 41092042,
    "hash": "",
    "type": "bake",
    "block": "BMbQcVE5Yf7MnzGwHqFWHxwGgL4o6dBK1NywSSWVDYDFHZJijHE",
    "time": "2021-02-13T10:23:55Z",
    "height": 1342860,
    "cycle": 327,
    "counter": 0,
    "op_n": 0,
    "op_l": -1,
    "op_p": 0,
    "op_c": 0,
    "op_i": 0,
    "status": "applied",
    "is_success": true,
    "is_contract": false,
    "gas_limit": 0,
    "gas_used": 0,
    "gas_price": 0,
    "storage_limit": 0,
    "storage_size": 0,
    "storage_paid": 0,
    "volume": 0,
    "fee": 0.001411,
    "reward": 40,
    "deposit": 512,
    "burned": 0,
    "is_internal": false,
    "has_data": false,
    "days_destroyed": 0,
    "sender": "tz1cYufsxHXJcvANhvS55h3aY32a9BAFB494",
    "receiver": "tz1cYufsxHXJcvANhvS55h3aY32a9BAFB494",
    "branch_height": 0,
    "branch_depth": 0,
    "branch_hash": "",
    "is_implicit": true,
    "entrypoint_id": 0,
    "is_orphan": false,
    "is_batch": false,
    "is_sapling": false,
    "confirmations": 1000,
    "metadata": {
      "tz1cYufsxHXJcvANhvS55h3aY32a9BAFB494": {
        "alias": {
          "name": "Bakery IL",
          "kind": "validator",
          "logo": "tz1cYufsxHXJcvANhvS55h3aY32a9BAFB494.png"
        },
        "baker": {
          "status": "public",
          "fee": 0.05,
          "payout_delay": true
        },
        "location": {
          "country": "IL",
          "city": "TLV"
        },
        "social": {
          "twitter": "bakery_il"
        }
      }
    }
  },
  // ...
  ]
}

Returns a list of operations in the corresponding block as well as a list of implicit events. Supports

HTTP Request

List Block Operations

GET /explorer/block/{hash,height,head}/operations

Contracts

Example request.

curl "https://api.tzstats.com/explorer/contract/KT1Puc9St8wdNoGtLiD2WXaHbWU7styaxYhD"
import (
  "context"
  "blockwatch.cc/tzgo"
  "blockwatch.cc/tzstats-go"
)

// use default Mainnet client
client := tzstats.DefaultClient

contract, err := client.GetContract(
  context.Background(),
  tezos.MustParseAddress("KT1Puc9St8wdNoGtLiD2WXaHbWU7styaxYhD"),
  tzstats.NewContractParams(),
)

Example response.

{
  "address": "KT1Puc9St8wdNoGtLiD2WXaHbWU7styaxYhD",
  "creator": "tz1P7A3YFgeSsGgopKN9vUU86W3psgTMdtcJ",
  "delegate": "tz1WCd2jm4uSt4vntk4vSuUWoZQGhLcDuR9q",
  "storage_size": 34600,
  "storage_paid": 34608,
  "first_seen": 1149672,
  "last_seen": 1342865,
  "first_seen_time": "2020-09-29T16:18:45Z",
  "last_seen_time": "2021-02-13T10:28:55Z",
  "n_ops": 13765,
  "n_ops_failed": 158,
  "bigmaps": {
    "accounts": 124
  },
  "iface_hash": "cf9361e1",
  "code_hash": "666dcc01",
  "call_stats": {
    "addLiquidity": 608,
    "approve": 0,
    "default": 0,
    "removeLiquidity": 230,
    "setBaker": 0,
    "setManager": 0,
    "tokenToToken": 16,
    "tokenToXtz": 2421,
    "updateTokenPool": 0,
    "updateTokenPoolInternal": 0,
    "xtzToToken": 2195
  },
  "features": [
    "set_delegate",
    "transfer_tokens"
  ],
  "interfaces": [
    "DEXTER"
  ]
}

Returns information about a Tezos smart contract. For balance details call the explorer account endpoint using the contracts KT1 address.

HTTP Request

GET /explorer/contract/{hash}

HTTP Response

Field Description
address hash Contract address.
creator hash Creator account (called manager before Babylon.
delegate hash Delegate (may be empty).
storage_size int64 Storage size allocated in bytes.
storage_paid int64 Storage bytes paid for in bytes.
first_seen int64 Block height of account creation.
last_seen int64 Block height of last activity.
delegated_since int64 Block height of most recent delegation.
first_seen_time datetime Block time of account creation.
last_seen_time datetime Block time of last activity.
n_ops int64 Lifetime total number of operations sent and received.
n_ops_failed int64 Lifetime total number of operations sent that failed.
bigmaps object Named bigmaps owned by this contract, map between annotation used in storage spec and bigmap id.
iface_hash bytes Short hash to uniquely identify the contract interface, first 4 bytes of the SHA256 hash over binary encoded Michelson script parameters.
code_hash bytes Short hash to uniquely identify the contract code, first 4 bytes of the SHA256 hash over binary encoded Michelson script code.
call_stats object Per-entrypoint call statistics, as named key/value pairs.
features array Michelson features used by this contract. Any of account_factory, contract_factory, set_delegate, lambda, transfer_tokens, chain_id, ticket, sapling.
interfaces array Standard interfaces implemented by this contract. Any of MANAGER, SET_DELEGATE, TZIP-005, TZIP-007, TZIP-012, DEXTER (list will be extended).

Contract Scripts

Example request.

curl "https://api.tzstats.com/explorer/contract/KT1Puc9St8wdNoGtLiD2WXaHbWU7styaxYhD/script?prim=1"
import (
  "context"
  "blockwatch.cc/tzgo"
  "blockwatch.cc/tzstats-go"
)

// use default Mainnet client
client := tzstats.DefaultClient

script, err := client.GetContractScript(
  context.Background(),
  tezos.MustParseAddress("KT1Puc9St8wdNoGtLiD2WXaHbWU7styaxYhD"),
  tzstats.NewContractParams().WithPrim(),
)

Example response.

// ...
{
  "script": {
    "code": [
      //...
    ],
    "storage": {
      // ...
    },
  },
  "storage_type": {
    "name": "storage",
    "type": "struct",
    "args": [{
      // ...
    }]
  },
  "entrypoints": {
    "approve": {
      "id": 0,
      "call": "approve",
      "branch": "/L/L/L",
      "type": [{
        "name": "spender",
        "type": "address"
      },{
        "name": "allowance",
        "type": "nat"
      },{
        "name": "currentAllowance",
        "type": "nat"
      }],
      "prim": {
        // ...
      }
    },
    //...
  }
},
// ...

GET /explorer/contract/{hash}/script

Returns the native Michelson JSON encoding of the deployed smart contract code as well as type specifications for call parameters, storage and bigmaps. Also contains decoded entrypoints and unfolded storage type.

JSON keys for entrypoint arguments always follow the convention <order>@<name>, i.e. they include an integer order number as first argument, followed by an optional @ symbol and an optional argument name extracted from type annotations.

Field Description
script object Native Micheline primitives (optional, use prim=1).
storage_type object Typedef for contract storage.
entrypoint object List of named entrypoints.
entrypoint.$.id int64 Position of the entrypoint in the Michelson parameter tree.
entrypoint.$.branch string Path of left (L) or right (R) branches to reach the entrypoint’s code in the Michelson code tree.
entrypoint.$.call string Annotated name of the entrypoint.
entrypoint.$.type polymorph Array of typedef for entrypoint arguments.
entrypoint.$.prim object Native Micheline primitives (optional, use prim=1).

Contract Storage

Example request.

curl "https://api.tzstats.com/explorer/contract/KT1Puc9St8wdNoGtLiD2WXaHbWU7styaxYhD/storage?prim=1"
import (
  "context"
  "blockwatch.cc/tzgo"
  "blockwatch.cc/tzstats-go"
)

// use default Mainnet client
client := tzstats.DefaultClient

storage, err := client.GetContractStorage(
  context.Background(),
  tezos.MustParseAddress("KT1Puc9St8wdNoGtLiD2WXaHbWU7styaxYhD"),
  tzstats.NewContractParams().WithPrim(),
)

Example response.

{
  "value": {
    "accounts": "124",
    "freezeBaker": false,
    "lqtTotal": "55431856030",
    "manager": "KT1B5VTw8ZSMnrjhy337CEvAm4tnT8Gu8Geu",
    "selfIsUpdatingTokenPool": false,
    "tokenAddress": "KT1LN4LPSqTMS7Sd2CJw4bbDGRkMv2t68Fy9",
    "tokenPool": "1494861",
    "xtzPool": "1191482"
  },
  "prim": {
    // ...
  }
}

GET /explorer/contract/{hash}/storage

Returns the most recent or a historic version of the contracts storage. Supports

Field Description
meta object Metadata for the current storage entry (optional, use meta=1).
meta.contract hash Owner contract.
meta.time datetime Update timestamp.
meta.height int64 Update height.
meta.block hash Block hash of latest update.
value object Unfolded storage using type annotations.
prim object Native Micheline primitives (optional, use prim=1).

Contract Calls

Example request.

curl "https://api.tzstats.com/explorer/contract/KT1Puc9St8wdNoGtLiD2WXaHbWU7styaxYhD/calls?prim=1"
import (
  "context"
  "blockwatch.cc/tzgo"
  "blockwatch.cc/tzstats-go"
)

// use default Mainnet client
client := tzstats.DefaultClient

calls, err := client.GetContractCalls(
  context.Background(),
  tezos.MustParseAddress("KT1Puc9St8wdNoGtLiD2WXaHbWU7styaxYhD"),
  tzstats.NewContractParams().WithPrim(),
)

Example response.

// ...
"parameters": {
  "entrypoint": "addLiquidity",
  "call": "addLiquidity",
  "branch": "/L/L/R",
  "id": 1,
  "value": {
    "addLiquidity": {
      "deadline": "2020-09-30T18:30:44.002Z",
      "maxTokensDeposited": "6000000",
      "minLqtMinted": "1",
      "owner": "tz1fSkEwBCgTLas8Y82SYpEGW9aFZPBag8uY"
    }
  },
  "prim": {
    // ...
  },
},
"big_map_diff": {
  // ...
},
"storage": {
  // ...
}
// ...

GET /explorer/contract/{hash}/calls

Returns contract calls (transactions) sent to the contract with embedded parameters, storage and bigmap updates. Supports

Call parameters contain the following properties:

Field Description
entrypoint string Named entrypoint used in call params, e.g. ‘default’ or ‘entrypoint_00.
branch string Path of left (L) or right (R) branches to reach the entrypoint’s code in the Michelson code tree.
call string Name of the executed entrypoint. This is useful if call parameters reference a different entrypoint name, but include a sub-tree of primitives that unpacks to this concrete entrypoint.
id int64 Position of the entrypoint in the Michelson parameter tree.
value object Call parameters in order of type definition.
prim object Native Micheline primitives (optional, use prim=1).

Cycles

Example request.

curl "https://api.tzstats.com/explorer/cycle/head"

Example response.

{
  "cycle": 247,
  "start_height": 1011713,
  "end_height": 1015808,
  "start_time": "2020-06-25T03:36:14Z",
  "end_time": "2020-06-27T23:54:04Z",
  "progress": 13.2568359375,
  "is_complete": false,
  "is_snapshot": false,
  "is_active": true,
  "snapshot_height": -1,
  "snapshot_index": -1,
  "snapshot_time": "0001-01-01T00:00:00Z",
  "rolls": 84176,
  "roll_owners": 423,
  "active_delegators": 54434,
  "active_bakers": 447,
  "staking_supply": 674670196.013393,
  "staking_percent": 80.2706912175752,
  "working_bakers": 117,
  "working_endorsers": 300,
  "missed_priorities": 4,
  "missed_endorsements": 115,
  "n_double_baking": 0,
  "n_double_endorsement": 0,
  "n_orphans": 0,
  "solvetime_min": 60,
  "solvetime_max": 100,
  "solvetime_mean": 60.327808471454915,
  "priority_min": 0,
  "priority_max": 1,
  "priority_mean": 0.007366482504604053,
  "endorsement_rate": 99.33694649446494,
  "endorsements_min": 25,
  "endorsements_max": 32,
  "endorsements_mean": 31.78782287822878,
  "seed_rate": 100,
  "worst_baked_block": 1011950,
  "worst_endorsed_block": 1011819,
  "snapshot_cycle": {
    // ... same data as cycle
  },
  "follower_cycle": {
    // ... same data as cycle
  }
}

Provides information about a consensus cycle, the past roll snapshot cycle and the future cycle whose rights are determined by the current cycle. This endpoint accepts head and a cycle number as path parameters.

HTTP Request

GET /explorer/cycle/{head,number}

HTTP Response

Field Description
cycle int64 The cycle number.
start_height int64 First block height (level) in this cycle.
end_height int64 Last block height (level) in this cycle.
start_time datetime Start time (estimate for future cycles).
end_time datetime End time (estimate for open and future cycles).
progress float Cycle completion in percent.
is_complete bool Flag indicating the cycle is complete.
is_snapshot bool Flag indicating a roll snapshot has been selected.
is_active bool Flag indicating the cycle is currently active.
snapshot_height int64 Height of the snapshot block.
snapshot_index int64 Index of the snapshot block.
snapshot_time datetime Time the snapshot block was taken.
rolls int64 Number of rolls at selected snapshot block or most recent snapshot block.
roll_owners int64 Number of unique roll owners (delegates) at selected snapshot block or most recent snapshot block.
staking_supply money Total staked supply at selected snapshot block or most recent snapshot block.
staking_percent float Percent of total supply staked at selected snapshot block or most recent snapshot block.
active_bakers int64 Number of actively registered bakers.
active_delegators int64 Number of non-zero accounts delegating to active bakers.
working_bakers int64 Number of bakers seen during this cycle. Its expected for this number to be lower than active_bakers because some may have no rolls, others may not contribute.
working_endorsers int64 Number of unique endorsers seen during this cycle. Its expected for this number to be lower than active_bakers because some may have no rolls, others may not contribute.
missed_priorities int64 Total count of missed block priorities.
missed_endorsements int64 Total count of missed endorsement slots.
n_double_baking int64 Count of double_baking_evidence events.
n_double_endorsement int64 Count of double_endorsement_evidence events.
n_orphans int64 Number of orphan blocks in this cycle.
solvetime_min int64 Minimum time between blocks.
solvetime_max int64 Maximum time between blocks.
solvetime_mean float Mean time between blocks.
priority_min int64 Minimum block priority.
priority_max int64 Maximum block priority.
priority_mean float Mean block priority.
endorsement_rate float Percentage of seen endorsements vs expected endorsements.
endorsements_min int64 Minimum count of endorsements across all blocks.
endorsements_max int64 Maximum count of endorsements across all blocks.
endorsements_mean float Mean count of endorsements across all blocks.
seed_rate int64 Percentage of published vs expected seed_nonce_revelations.
worst_baked_block int64 Height of the block with lowest priority.
worst_endorsed_block int64 Height of the block with least endorsed slots.
snapshot_cycle object Embedded cycle data for the cycle that provided the roll snapshot for the current cycle.
follower_cycle object Embedded cycle data for the future cycle that will get its rights assigned from a snapshot in the current cycle.

Elections

Example request.

curl "https://api.tzstats.com/explorer/election/head"

Example response.

{
  "election_id": 13,
  "num_periods": 4,
  "num_proposals": 2,
  "start_time": "2019-07-16T19:02:34Z",
  "end_time": "2019-10-18T00:29:57Z",
  "start_height": 524288,
  "end_height": 655359,
  "is_empty": false,
  "is_open": true,
  "is_failed": false,
  "no_quorum": false,
  "no_majority": false,
  "no_proposal": false,
  "voting_period": "promotion",
  "proposal": {
    "voting_period": 15,
    "voting_period_kind": "proposal",
    "period_start_time": "2019-07-16T19:02:34Z",
    "period_end_time": "2019-08-09T06:46:57Z",
    "period_start_block": 524288,
    "period_end_block": 557055,
    "eligible_rolls": 70159,
    "eligible_voters": 461,
    "quorum_pct": 0,
    "quorum_rolls": 0,
    "turnout_rolls": 43133,
    "turnout_voters": 225,
    "turnout_pct": 6147,
    "turnout_ema": 0,
    "yay_rolls": 0,
    "yay_voters": 0,
    "nay_rolls": 0,
    "nay_voters": 0,
    "pass_rolls": 0,
    "pass_voters": 0,
    "is_open": false,
    "is_failed": false,
    "is_draw": false,
    "no_proposal": false,
    "no_quorum": false,
    "no_majority": false,
    "proposals": [
      {
        "hash": "PsBABY5nk4JhdEv1N1pZbt6m6ccB9BfNqa23iKZcHBh23jmRS9f",
        "source": "tz1eEnQhbwf6trb8Q8mPb2RaPkNk2rN7BKi8",
        "block_hash": "BLkbt55K5YZMPtjrSfo3ericxRaeXcwEwawfE5BkT9H5ZbZnLQV",
        "op_hash": "op4mZHRe1xTmYG34xYRwpGaGMAfTp6S82eeebgNZmdtNW6szeeX",
        "height": 537802,
        "time": "2019-07-26T13:20:04Z",
        "rolls": 19964,
        "voters": 146
      },
      {
        "hash": "PsBABY5HQTSkA4297zNHfsZNKtxULfL18y95qb3m53QJiXGmrbU",
        "source": "tz1eEnQhbwf6trb8Q8mPb2RaPkNk2rN7BKi8",
        "block_hash": "BLzSKKWp9NyrNrZrZgWin3m2zjPVUJfxNn1QkCzt9aZy7ZLWgJJ",
        "op_hash": "ooDAtGzFBeRUJcEK3QRBHU3kzk31CAp2RARYE3kmU3qsrvgs8JN",
        "height": 547386,
        "time": "2019-08-02T09:42:56Z",
        "rolls": 66302,
        "voters": 304
      }
    ]
  },
  "exploration": {
    "voting_period": 16,
    "voting_period_kind": "exploration",
    "period_start_time": "2019-08-09T06:48:02Z",
    "period_end_time": "2019-09-01T17:52:51Z",
    "period_start_block": 557056,
    "period_end_block": 589823,
    "eligible_rolls": 70585,
    "eligible_voters": 464,
    "quorum_pct": 7291,
    "quorum_rolls": 51463,
    "turnout_rolls": 57818,
    "turnout_voters": 179,
    "turnout_pct": 8191,
    "turnout_ema": 0,
    "yay_rolls": 37144,
    "yay_voters": 171,
    "nay_rolls": 0,
    "nay_voters": 0,
    "pass_rolls": 20674,
    "pass_voters": 8,
    "is_open": false,
    "is_failed": false,
    "is_draw": false,
    "no_proposal": false,
    "no_quorum": false,
    "no_majority": false,
    "proposals": [
      {
        "hash": "PsBABY5HQTSkA4297zNHfsZNKtxULfL18y95qb3m53QJiXGmrbU",
        "source": "tz1eEnQhbwf6trb8Q8mPb2RaPkNk2rN7BKi8",
        "block_hash": "BLzSKKWp9NyrNrZrZgWin3m2zjPVUJfxNn1QkCzt9aZy7ZLWgJJ",
        "op_hash": "ooDAtGzFBeRUJcEK3QRBHU3kzk31CAp2RARYE3kmU3qsrvgs8JN",
        "height": 547386,
        "time": "2019-08-02T09:42:56Z",
        "rolls": 0,
        "voters": 0
      }
    ]
  },
  "cooldown": {
    "voting_period": 17,
    "voting_period_kind": "cooldown",
    "period_start_time": "2019-09-01T17:53:51Z",
    "period_end_time": "2019-09-25T04:30:36Z",
    "period_start_block": 589824,
    "period_end_block": 622591,
    "eligible_rolls": 71053,
    "eligible_voters": 469,
    "quorum_pct": 0,
    "quorum_rolls": 0,
    "turnout_rolls": 0,
    "turnout_voters": 0,
    "turnout_pct": 0,
    "turnout_ema": 0,
    "yay_rolls": 0,
    "yay_voters": 0,
    "nay_rolls": 0,
    "nay_voters": 0,
    "pass_rolls": 0,
    "pass_voters": 0,
    "is_open": false,
    "is_failed": false,
    "is_draw": false,
    "no_proposal": false,
    "no_quorum": false,
    "no_majority": false,
    "proposals": [
      {
        "hash": "PsBABY5HQTSkA4297zNHfsZNKtxULfL18y95qb3m53QJiXGmrbU",
        "source": "tz1eEnQhbwf6trb8Q8mPb2RaPkNk2rN7BKi8",
        "block_hash": "BLzSKKWp9NyrNrZrZgWin3m2zjPVUJfxNn1QkCzt9aZy7ZLWgJJ",
        "op_hash": "ooDAtGzFBeRUJcEK3QRBHU3kzk31CAp2RARYE3kmU3qsrvgs8JN",
        "height": 547386,
        "time": "2019-08-02T09:42:56Z",
        "rolls": 0,
        "voters": 0
      }
    ]
  },
  "promotion": {
    "voting_period": 18,
    "voting_period_kind": "promotion",
    "period_start_time": "2019-09-25T04:32:51Z",
    "period_end_time": "2019-10-18T00:28:57Z",
    "period_start_block": 622592,
    "period_end_block": 655359,
    "eligible_rolls": 71840,
    "eligible_voters": 463,
    "quorum_pct": 7471,
    "quorum_rolls": 53671,
    "turnout_rolls": 11895,
    "turnout_voters": 79,
    "turnout_pct": 1655,
    "turnout_ema": 0,
    "yay_rolls": 11044,
    "yay_voters": 71,
    "nay_rolls": 844,
    "nay_voters": 6,
    "pass_rolls": 7,
    "pass_voters": 2,
    "is_open": true,
    "is_failed": false,
    "is_draw": false,
    "no_proposal": false,
    "no_quorum": false,
    "no_majority": false,
    "proposals": [
      {
        "hash": "PsBABY5HQTSkA4297zNHfsZNKtxULfL18y95qb3m53QJiXGmrbU",
        "source": "tz1eEnQhbwf6trb8Q8mPb2RaPkNk2rN7BKi8",
        "block_hash": "BLzSKKWp9NyrNrZrZgWin3m2zjPVUJfxNn1QkCzt9aZy7ZLWgJJ",
        "op_hash": "ooDAtGzFBeRUJcEK3QRBHU3kzk31CAp2RARYE3kmU3qsrvgs8JN",
        "height": 547386,
        "time": "2019-08-02T09:42:56Z",
        "rolls": 0,
        "voters": 0
      }
    ]
  }
}

On-chain elections can be queried by proposal hash or sequence number. An election contains a complete set of data on a past or the currently ongoing (head) on-chain voting process, including up to four voting periods. Voting periods may be empty when no proposal has been published. Only the last voting period of the last election can be in state open. Ballots represent the individual ballot operations sent by bakers during votes or the up-votes to a proposal during the first voting period.

HTTP Request

GET /explorer/election/{head,hash,number}

HTTP Response

Field Description
election_id int64 Sequence number of the election.
num_periods int64 Number of voting periods activated during this election (min 1, max 4)
num_proposals int64 Total number of submitted proposals.
start_time int64 Time of the first block in the election.
end_time int64 Time of the last block in the election (when open this is an approximation of the latest possible end assuming all voting periods are used and all remaining blocks are produced at priority zero).
start_height int64 First block of the election period.
end_height bool Last block of the election (when open this is an approximation of the full duration assuming all voting periods are used).
is_empty bool Flag indicating the election has not seen and proposal being submitted.
is_open bool Flag indicating the election is ongoing.
is_failed bool Flag indicating the election has failed to select or activate a new protocol.
no_quorum bool Flag indicating the election has failed because no quorum could be reached.
no_majority bool Flag indicating the election has failed because no majority could be reached.
no_proposal bool Flag indicating the election has failed because no proposal has been submitted.
voting_period enum Period kind proposal, exploration, cooldown, promotion, adoption.
proposal object Vote object for the proposal period 1 (see below).
exploration object Vote object for the exploration period 2 (see below).
cooldown object Vote object for the cooldown period 3 (see below).
promotion object Vote object for the promotion vote period 4 (see below).
adoption object Vote object for the adoption vote period 5 (see below).

Voting Period Object

Field Description
voting_period int64 Protocol-level voting period counter.
voting_period_kind enum Period kind proposal, exploration, cooldown, promotion, adoption.
period_start_time datetime Time of the first block in the voting period.
period_end_time datetime Time of the last block in the voting period (when open this is an approximation of the latest possible end assuming all remaining blocks are produced at priority zero).
period_start_block int64 First block of the voting period.
period_end_block int64 Last block of the voting period.
eligible_rolls int64 Number of rolls eligible to vote snapshot at start of the voting period.
eligible_voters int64 Number of eligible voters (delegates) snapshot at start of the voting period.
quorum_pct float Required quorum in percent.
quorum_rolls int64 Required rolls to reach quorum.
turnout_rolls int64 Actual rolls who voted.
turnout_voters int64 Actual voters who voted.
turnout_pct float Actual participation in percent.
turnout_ema float Moving average for Babylon v005 quorum algorithm.
yay_rolls int64 Number of Yay rolls.
yay_voters int64 Number of Yay voters.
nay_rolls int64 Number of Nay rolls.
nay_voters int64 Number of Nay voters.
pass_rolls int64 Number of Pass rolls.
pass_voters int64 Number of Pass voters.
is_open bool Flag indicating the voting period is currently open.
is_failed bool Flag indicating the voting period has failed to select or activate a new protocol.
is_draw bool Flag indication the reason for failure was a draw between two proposals in the proposal period.
no_proposal bool Flag indication the reason for failure was no submitted proposal in the proposal period.
no_quorum bool Flag indication the reason for failure was participation below the required quorum.
no_majority bool Flag indication the reason for failure was acceptance below the required supermajority.
proposals array List of submitted proposals (in proposal period) or the selected proposal.

Proposal Object

Field Description
hash hash Protocol hash.
source hash Sender account.
block_hash hash Proposal operation block hash.
op_hash hash Proposal operation hash.
height int64 Proposal operation submission height.
time datetime Proposal operation submission time.
rolls int64 Count of rolls voting for this proposal during the proposal period.
voters int64 Count of voters voting for this proposal during the proposal period.

List Voters

GET /explorer/election/{hash,number,head}/{stage}/voters

Lists all eligible voters for the current voting period where stage is the sequence number of the voting period [1..4]. The voter list supports pagination with limit, offset and cursor. To change the order of returned calls use the optional order (asc|desc) parameter.

Voter Object

Field Description
row_id int64 Internal account id for use with cursor.
address hash Voter address.
rolls int64 Count of rolls the voter has during this voting period.
stake money Staking balance the voter had at the beginning of this voting period.
has_voted bool Flag indicating if the account has already voted.
ballot enum Ballot cast by the voter, either yay, nay or pass.
proposals array List of proposals (as hashes) the voter voted for.

List Ballots

GET /explorer/election/{hash,number,head}/{stage}/ballots

Lists all ballots cast during the current voting period where stage is the sequence number of the voting period [1..4]. The voter list supports pagination with limit, offset and cursor. To change the order of returned calls use the optional order (asc|desc) parameter.

Ballot Object

Field Description
row_id int64 Internal account id for use with cursor.
sender hash Voter address.
height int64 Operation submission height.
time datetime Operation submission time.
election_id int64 Sequence number of the election.
voting_period int64 Protocol-level voting period counter.
voting_period_kind enum Period kind proposal, exploration, cooldown, promotion, adoption.
proposal hash Hash of the proposal the voter voted for. If the vote happened during the proposal period and the voter used to vote for multiple proposals either in a single proposals operation or with multiple proposals operations, multiple ballots exist.
op hash Operation hash.
ballot enum Ballot cast by the voter, either yay, nay or pass. During proposal period the ballot is always yay to describe the only choice.
rolls int64 Count of rolls the voter has during this voting period.

Market Tickers

Example request.

curl "https://api.tzstats.com/markets/tickers"

Example response.

[
  {
    "pair": "XTZ_BNB",
    "base": "XTZ",
    "quote": "BNB",
    "exchange": "binance",
    "open": 0.05813000,
    "high": 0.06058000,
    "low": 0.05583000,
    "last": 0.05741000,
    "change": -1.23860313,
    "vwap": 0.05787292,
    "n_trades": 176,
    "volume_base": 17373.80000000,
    "volume_quote": 1005.47257300,
    "timestamp": "2019-09-29T20:14:00.001014458Z"
  },
  {
    "pair": "XTZ_BTC",
    "base": "XTZ",
    "quote": "BTC",
    "exchange": "kraken",
    "open": 0.00011090,
    "high": 0.00011300,
    "low": 0.00010710,
    "last": 0.00010970,
    "change": -1.08205591,
    "vwap": 0.00011036,
    "n_trades": 808,
    "volume_base": 219356.80514484,
    "volume_quote": 24.20907256,
    "timestamp": "2019-09-29T20:14:00.000755843Z"
  }
]

Fetches a list of market price tickers with 24h OHLCV data.

HTTP Request

GET /markets/tickers

HTTP Response

Field Description
pair string Trading pair in format {base}_{quote}.
base string Base currency (always XTZ).
quote string Quote currency.
exchange string Exchange code.
open money 24h open price in quote currency.
high money 24h highest price in quote currency.
low money 24h lowest price in quote currency.
last money Last price in quote currency.
change float 24h price change in percent.
vwap money 24h volume weighted average price in quote currency.
n_trades int64 24h number of trades.
volume_base money 24h traded volume in base currency.
volume_quote money 24h traded volume in quote currency.
timestamp datetime Timestamp of the ticker result.

Table Endpoints

Generic Table Query

https://api.tzstats.com/tables/{table_code}.{format}?{args}

Tables store data in tabular form as a set of columns. Each column has a specified type and each row has a unique uint64 row_id. Empty values are represented as JSON null or empty strings. Tables can grow extremely large, so its good practice to use filters and the columns query argument to limit the result size. Table responses are automatically sorted by row_id. Use client-side sorting if a different sorting order is required.

List of supported tables

Endpoint Table Content
GET /tables/chain running blockchain totals
GET /tables/supply running supply totals
GET /tables/block blocks (including orphans)
GET /tables/op operations (only final)
GET /tables/account most recent account balances and state
GET /tables/contract smart contracts state at creation
GET /tables/flow balance, freezer and delegation flows
GET /tables/rights baking and endorsing rights
GET /tables/snapshot balances of active delegates & delegators at all snapshot blocks
GET /tables/income per-cycle statistics on baker income, efficiency, etc
GET /tables/election election metadata (i.e. entire governance cycles)
GET /tables/proposal individual proposals
GET /tables/vote voting period metadata
GET /tables/ballot ballots and proposal operations
GET /tables/bigmaps bigmap allocations
GET /tables/bigmap_values currently live bigmap values
GET /tables/bigmap_updates historic bigmap updates (including copy/alloc)

Query Arguments

Tables support the following general query parameters.

Argument Description
columns optional Comma separated list of column names to return. Bulk array results will be ordered accordingly. Default is all defined columns for a table.
limit optional Maximum number of rows to return. Limited to 50,000, default 500.
cursor optional Id (row_id) of the latest result row returned by a previous call.
order optional Result order either asc (default) or desc, sorted by row_id.

To paginate result sets larger than the maximum limit, include row_id into the list of columns and use the last value of row_id as cursor in your next call. This will automatically apply an extra filter row_id.gt=cursor for ascending and row_id.lt=cursor for descending order. You can of course also apply the relevant row_id filter directly, without using cursor.

Query Filters

Filter Example

The example below filters blocks by time range from time.gte=2019-08-01 (inclusive) to time.lte=2019-08-31 (inclusive) and returns columns time and height. The same effect can be achieved with the range operator time.rg=2019-08-01,2019-08-31.

curl "https://api.tzstats.com/tables/block.json?columns=time,height&time.gte=2018-08-01&time.lte=2018-08-31&limit=50000"

JSON result

[
  [1533081657000,42672],
  [1533081717000,42673],
  [1533081777000,42674],
  [1533081837000,42675],
  [1533081897000,42676],
  [1533081957000,42677],
  [1533082017000,42678],
  [1533082152000,42679],
  [1533082287000,42680],
  [1533082347000,42681],
  [1533082407000,42682],
  // ...
]

To filter tables use filter expressions of the form <column>.<operator>=<arg>. Filters work on any combination of columns regardless of type. For arguments, type encoding rules of the column type apply. Filtering by multiple columns is similar to a logical AND between expressions. For simplicity and performance there are currently no OR expressions or more complex operators available. Comparison order for strings and binary is the lexicographical order over UTF8 (string) or ASCII (binary) alphabets.

Operator Semantics
=, .eq= Equal. Matches rows where column values match exactly the filter value.
.ne= Not equal. Matches rows where column values do not match the filter value.
.gt= Greater than. matches columns whose value is strictly greater than the filter value.
.gte= Greater than or equal. matches columns whose value is greater than or equal to the filter value.
.lt= Less than. matches columns whose value is strictly smaller than the filter value.
.lte= Less than or equal. matches columns whose value is strictly smaller than or equal to the filter value.
.in= Inclusion in list. matches columns whose value is equal to one of the filter values. Multiple values must be separated by comma.
.nin= Not included in list. matches columns whose value is not equal to one of the filter values. Multiple values may be separated by comma.
.rg= Range. matches columns whose value is between the provided filter values, boundary inclusive. Requires exactly two values separated by comma. (This is similar to, but faster than using .gte= and .lte= in combination.)
.re= Regexp. matches columns whose value matches the regular expression. Can only be used on string-type columns (not enum or hash). Non-URL-safe characters must be properly escaped.

Account Table

Example request.

curl "https://api.tzstats.com/tables/account?address=tz2TSvNTh2epDMhZHrw73nV9piBX7kLZ9K9m"
import (
  "context"
  "blockwatch.cc/tzstats-go"
)

// create a new query object
q := tzstats.DefaultClient.NewAccountQuery()

// add filters and configure the query
q.WithFilter(tzstats.FilterModeEqual, "address", "tz2TSvNTh2epDMhZHrw73nV9piBX7kLZ9K9m").
    WithLimit(1000).
    WithColumns("row_id", "address", "spendable_balance")

// execute the query
list, err := q.Run(context.Background())

// walk accounts
for _, acc := range list.Rows {
    // access regular Account structs
}

Example response (comments added for explanation).

[
  [
    278469,             // row_id
    278469,             // delegate_id
    0,                  // creator_id
    "sppk7bn9MKAWDUFwqowcxA1zJgp12yn2kEnMQJP3WmqSZ4W8WQhLqJN" // pubkey
    "secp256k1",        // address_type
    360996,             // first_in
    360997,             // first_out
    633203,             // last_in
    633203,             // last_out
    360996,             // first_seen
    633203,             // last_seen
    0,                  // delegated_since
    361000,             // delegate_since
    0,                  // delegate_until
    4129917.992000,     // total_received
    1241985.094354,     // total_sent
    0.000000,           // total_burned
    0.041097,           // total_fees_paid
    488373.754858,      // total_rewards_earned
    53.292001,          // total_fees_earned
    0.000000,           // total_lost
    3029056.000000,     // frozen_deposits
    94254.999996,       // frozen_rewards
    10.405040,          // frozen_fees
    0.000000,           // unclaimed_balance
    253038.498372,      // spendable_balance
    28092993.766577,    // delegated_balance
    13,                 // total_delegations
    8,                  // active_delegations
    1,                  // is_funded
    0,                  // is_activated
    0,                  // is_delegated
    1,                  // is_revealed
    1,                  // is_delegate
    1,                  // is_active_delegate
    0,                  // is_contract
    6165,               // blocks_baked
    41,                 // blocks_missed
    129,                // blocks_stolen
    102793,             // blocks_endorsed
    195539,             // slots_endorsed
    332,                // slots_missed
    103002,             // n_ops
    0,                  // n_ops_failed
    38,                 // n_tx
    1,                  // n_delegation
    0,                  // n_origination
    1,                  // n_proposal
    1,                  // n_ballot
    2,                  // token_gen_min
    4875,               // token_gen_max
    160,                // grace_period
    "08c80261",         // baker_version
    "tz2TSvNTh2epDMhZHrw73nV9piBX7kLZ9K9m", // address
    "tz2TSvNTh2epDMhZHrw73nV9piBX7kLZ9K9m", // delegate
    null,               // creator
    1553123452000,      // first_seen_time
    1570032391000,      // last_seen_time
    1553123452000,      // first_in_time
    1570032391000,      // last_in_time
    1553123512000,      // first_out_time
    0,                  // delegated_since_time
    1553123692000,      // delegate_since_time
    0,                  // delegate_until_time
    0,                  // rich_rank
    0,                  // volume_rank
    0,                  // traffic_rank
    815436,             // next_bake_height
    0,                  // next_bake_priority
    1553123692000,      // next_bake_time
    815397,             // next_endorse_height
    1553123692000       // next_endorse_time
  ]
]

List information about the most recent state of implicit and smart contract accounts.

HTTP Request

GET https://api.tzstats.com/tables/account?args

HTTP Response

Field Description
row_id uint64 Unique row identifier.
delegate_id uint64 Unique row_id of the delegate (baker) this account delegates to. If same as row_id, this is a baker account.
creator_id uint64 Contract creator unique row_id.
address_type enum Account address type ed25519 (tz1), secp256k1 (tz2), p256 (tz3), contract (KT1) or blinded (btz1)
pubkey hash Revealed public key base58check encoded.
first_in int64 Block height of first incoming transaction.
first_out int64 Block height of first outgoing transaction.
last_in int64 Block height of latest incoming transaction.
last_out int64 Block height of latest outgoing transaction.
first_seen int64 Block height of account creation.
last_seen int64 Block height of last activity.
delegated_since int64 Block height of most recent delegation.
delegate_since int64 Block height of registration as delegate (baker).
delegate_until int64 Block height of most recent deactivation as delegate (baker).
total_received money Lifetime total tokens received in transactions.
total_sent money Lifetime total tokens sent in transactions.
total_burned money Lifetime total tokens burned in tez.
total_fees_paid money Lifetime fees paid in tez.
total_rewards_earned money Lifetime rewards earned in tez.
total_fees_earned money Lifetime fees earned in tez.
total_lost money Lifetime total tokens lost in tez.
frozen_deposits money Currently frozen deposits
frozen_rewards money Currently frozen rewards.
frozen_fees money Currently frozen fees.
unclaimed_balance money Currently unclaimed balance (for vesting contracts and commitments).
spendable_balance money Currently spendable balance.
delegated_balance money (baker only) Current incoming delegations.
total_delegations int64 (baker only) Lifetime count of delegations.
active_delegations int64 (baker only) Currently active and non-zero delegations.
is_funded bool Flag indicating the account is funded.
is_activated bool Flag indicating the account was activated from a commitment.
is_delegated bool Flag indicating the account is currently delegated.
is_revealed bool Flag indicating the account has a revealed public key .
is_delegate bool Flag indicating the account is a registered delegate.
is_active_delegate bool Flag indicating the account is a registered and active delegate.
is_contract bool Flag indicating the account is a smart contract.
blocks_baked int64 Lifetime total blocks baked.
blocks_missed int64 Lifetime total block baking missed.
blocks_stolen int64 Lifetime total block baked at priority > 0.
blocks_endorsed int64 Lifetime total blocks endorsed.
slots_endorsed int64 Lifetime total endorsement slots endorsed.
slots_missed int64 Lifetime total endorsement slots missed.
n_ops int64 Lifetime total number of operations sent and received.
n_ops_failed int64 Lifetime total number of operations sent that failed.
n_tx int64 Lifetime total number of transactions sent and received.
n_delegation int64 Lifetime total number of delegations sent.
n_origination int64 Lifetime total number of originations sent.
n_proposal int64 Lifetime total number of proposals (operations) sent.
n_ballot int64 Lifetime total number of ballots sent.
token_gen_min int64 Minimum generation number of all tokens owned.
token_gen_max int64 Maximum generation number of all tokens owned.
grace_period int64 (baker only) Current grace period before deactivation.
baker_version string (baker only) Git hash of software version run to generate the most recent block (from block nonce).
address hash Account address base58check encoded.
delegate hash Account delegate address base58check encoded.
creator hash Account creator address base58check encoded.
first_seen_time datetime Block time of account creation.
last_seen_time datetime Block time of last activity.
first_in_time datetime Block time of first incoming transaction.
last_in_time datetime Block time of latest incoming transaction.
first_out_time datetime Block time of first outgoing transaction.
last_out_time datetime Block time of latest outgoing transaction.
delegated_since_time datetime Block time of most recent delegation.
delegate_since_time datetime Block time of registration as delegate.
delegate_until_time datetime Block time of the most recent baker deactivation.
rich_rank int64 Global rank on rich list by total balance.
volume_rank int64 Global rank on 1D most active accounts by transactions sent/received.
traffic_rank int64 Global rank on 1D most active accounts by volume sent/received.
next_bake_height int64 Height of next block baking right.
next_bake_priority int64 Priority of next baking right (fixed at zero currently).
next_bake_time datetime Approximate time of next block baking right.
next_endorse_height int64 Height of next block endorsing right.
next_endorse_time datetime Approximate time of next block endorsing right.

Ballot Table

Example request.

curl "https://api.tzstats.com/tables/ballot?voting_period=16&limit=1"

Example response (comments added for explanation).

[
  [
    856,            // row_id
    13,             // election_id
    5,              // proposal_id
    16,             // voting_period
    "exploration",  // voting_period_kind
    557061,         // height
    1565333732000,  // time
    63795,          // source_id
    13150288,       // op_id
    6,              // rolls
    "yay",          // ballot
    "tz1abmz7jiCV2GH2u81LRrGgAFFgvQgiDiaf",  // source
    "onw6yGKFPucybjz5ysTRoohdnZMt9UFkTo6RdUFe7vcMp5aGv4s",  // op
    "PsBABY5HQTSkA4297zNHfsZNKtxULfL18y95qb3m53QJiXGmrbU"   // proposal
  ]
]

List individual ballot operations sent by bakers during votes.

HTTP Request

GET https://api.tzstats.com/tables/ballot?args

HTTP Response

Field Description
row_id uint64 Unique row identifier.
election_id uint64 Unique row_id of the election this proposal was submitted in.
proposal_id uint64 Unique row_id of the proposal that is voted for.
voting_period int64 On-chain sequence number of the voting period this ballot was cast at.
voting_period_kind enum Type of the voting period proposal, exploration, cooldown, promotion, adoption.
height int64 Block height where the ballot was included
time datetime Block time where the ballot was included.
source_id uint64 Unique row_id if the ballot sender account.
op_id uint64 Unique row_id if the ballot operation.
rolls int64 Number of rolls owned by source.
ballot enum The actual ballot yay, nay, pass.
source hash Address of the ballot sender account, base58check encoded.
op hash Hash of the ballot operation, base58check encoded.
proposal hash Hash of the proposal that is voted on, if any.

Bigmap Table

Example request.

curl "https://api.tzstats.com/tables/bigmaps?limit=1&order=desc"
import (
  "context"
  "blockwatch.cc/tzstats-go"
)

// create a new query object
q := tzstats.DefaultClient.NewBigmapQuery()

// add filters and configure the query to list all active keys
q.WithLimit(1).WithOrder(tzstats.OrderDesc)

// execute the query
list, err := q.Run(context.Background())

// walk bigmaps
for _, row := range list.Rows {
    // access BigmapRow structs

}

Example response (comments added for explanation).

[
    [
        9066,          // row_id
        9058,          // bigmap_id
        1478230,       // account_id
        1585347,       // alloc_height
        9,             // n_keys
        9,             // n_updates
        1585347,       // update_height
        "KT1PvEyN1xCFCgorN92QCfYjw3axS6jawCiJ", // contract
        1628005298000, // alloc_time
        "BLHBYPnzrqEszy6ZswFQkhc727hDbsYVNnWCTppdQnmqsh1fWDz", // alloc_block
        1628005298000, // update_time
        "BLHBYPnzrqEszy6ZswFQkhc727hDbsYVNnWCTppdQnmqsh1fWDz", // update_block
        "0362",        // key_type
        "075e07650965000003ed076...", // value_type
    ]
]

Lists bigmap allocations and the most recent state of each bigmap. Use this table only when you have a very good reason, e.g. to search through all bigmaps of all contracts efficiently. A better way might be to use the explorer API endpoints.

HTTP Request

GET https://api.tzstats.com/tables/bigmaps?args

HTTP Response

Field Description
row_id uint64 Unique row identifier.
bigmap_id int64 Unique on-chain id of the bigmap.
account_id uint64 Unique row_id of the account that owns the bigmap.
alloc_height int64 Height at which the bigmap was allocated on-chain.
alloc_time datetime Timestamp at which the bigmap was allocated on-chain.
alloc_block hash Hash of the block in which the bigmap was allocated.
update_height int64 Height at which the bigmap was last updated.
update_time datetime Timestamp at which the bigmap was last updated.
update_block hash Hash of the block in which the bigmap was last updated.
key_type string Hex string with Micheline encoded type for bigmap keys.
value_type string Hex string with Micheline encoded type for bigmap values.
n_keys int64 Number of live bigmap keys after the last update.
n_updates int64 Total number of updates.

Bigmap Value Table

Example request.

curl "https://api.tzstats.com/tables/bigmap_values?bigmap_id=515&limit=1&order=desc"
import (
  "context"
  "blockwatch.cc/tzstats-go"
)

// create a new query object
q := tzstats.DefaultClient.NewBigmapValueQuery()

// need typs for decoding
info, err := tzstats.DefaultClient.GetBigmap(
    context.Background(),
    511,
    tzstats.NewContractParams().WithPrim(),
)
keyType := info.MakeKeyType()
valType := info.MakeValueType()

// add filters and configure the query to list all active keys
q.WithFilter(tzstats.FilterModeEqual, "bigmap_id", 511).
    WithLimit(1).
    WithOrder(tzstats.OrderDesc)

// execute the query
list, err := q.Run(context.Background())

// walk bigmap updates
for _, row := range list.Rows {
    // access BigmapRow structs (use TzGo Type/Value to decode binary data)
    key := row.GetKey(keyType)
    val := row.GetValue(valType)

}

Example response (comments added for explanation).

[
    [
        3447263,                // row_id
        515,                    // bigmap_id
        3143289717337607700,    // key_id
        1669888,                // height
        "07070a0000001600003f365276e50080856992f4382eaf5e4e6e6b93360000", // key
        "00bca2f501",           // value
        "exprucYwnpqVYDKuUkPsoGAJ4213DjAJHef2FSqrLx66aFoyEn1Ygv" // key_hash
        1630908360000           // time
    ]
]

Lists individual bigmap values exist in a bigmap at the time of the call. Use this table to bulk-fetch large quantities of bigmap content. A better way might be to use the explorer API endpoints.

HTTP Request

GET https://api.tzstats.com/tables/bigmap_values?args

HTTP Response

Field Description
row_id uint64 Unique row identifier.
bigmap_id int64 Unique on-chain id of the bigmap.
height int64 Height when this key was last updated.
time datetime Time of the latest key update.
key_id uint64 Short hash of the bigmap key.
key_hash string Tezos script expression hash of the key.
key string Hex string with Micheline encoded data for the key.
value string Hex string with Micheline encoded data for the value.

Bigmap Update Table

Example request.

curl "https://api.tzstats.com/tables/bigmap_updates?bigmap_id=515&limit=1&order=desc"
import (
  "context"
  "blockwatch.cc/tzstats-go"
)

// create a new query object
q := tzstats.DefaultClient.NewBigmapUpdateQuery()

// need typs for decoding
info, err := tzstats.DefaultClient.GetBigmap(
    context.Background(),
    511,
    tzstats.NewContractParams().WithPrim(),
)
keyType := info.MakeKeyType()
valType := info.MakeValueType()

// add filters and configure the query to list all updates (update/removal actions)
q.WithFilter(tzstats.FilterModeEqual, "bigmap_id", 511).
    WithLimit(1).
    WithOrder(tzstats.OrderDesc)

// execute the query
list, err := q.Run(context.Background())

// walk bigmap updates
for _, row := range list.Rows {
    // access BigmapRow structs (use TzGo Type/Value to decode binary data)
    key := row.GetKey(keyType)
    val := row.GetValue(valType)

}

Example response (comments added for explanation).

[
    [
        12520900,              // row_id
        515,                   // bigmap_id
        14880518129034867591,  // key_id
        "update",              // action
        63514493,              // op_id
        1585371,               // height
        1628006826000,         // time
        "07070a0000001601b39686f116bb35115559f7e781200850e02854c4000000", // key
        "008d96adb1af01",      // value
        "onw1dT9DssyqPN6fGXq99qG5nd5zK1MXuHZPHm5GTrjQy6aERt1",   // op_hash
        "exprvLWAQodM4mjNkpX3WzgbUi8KKhL8qPDchFuwNQBdPbt6CTQQjf" // key_hash
    ]
]

Lists historic bigmap updates. Use this table to bulk-fetch large quantities of bigmap updates, e.g. to replay or reconstruct bigmap state. A different way to access updates is by using the explorer API endpoints.

HTTP Request

GET https://api.tzstats.com/tables/bigmap_updates?args

HTTP Response

Field Description
row_id uint64 Unique row identifier.
bigmap_id int64 Unique on-chain id of the bigmap.
key_id uint64 Short hash of the bigmap key.
key_hash string Tezos script expression hash of the key.
key string Hex string with Micheline encoded data for the key.
value string Hex string with Micheline encoded data for the value.
action enum Update action, one of update, remove, alloc, copy.
height int64 Block height at which the update happened.
time timestamp Time of the update.
op_id uint64 Unique row id of the operation that contained the update.
op_hash hash Hash of the operation that contained the update.

Block Table

Example request.

curl https://api.tzstats.com/tables/block?time.gte=today&limit=1
import (
  "context"
  "blockwatch.cc/tzstats-go"
)

// create a new query object
q := tzstats.DefaultClient.NewBlockQuery()

// add filters and configure the query
q.WithFilter(tzstats.FilterModeGte, "time", "today").WithLimit(1)

// execute the query
list, err := q.Run(context.Background())

// access that block
if list.Len() == 1 {
    fmt.Println(list.Rows[0].Hash)
}

Example response (comments added for explanation).

[
  [
    632250,             // row_id
    632249,             // parent_id
    "BMapnMicyiqFsWU9NdqXvfQJQcpFfzWHMicRRjALEMNngkefd7B", // hash
    0,                  // is_orphan
    632249,             // height
    154,                // cycle
    0,                  // is_cycle_snapshot
    1569974422000,      // time
    60,                 // solvetime
    4,                  // version
    4,                  // validation_pass
    20007610,           // fitness
    0,                  // priority
    "d74e7b6dbd050900", // nonce
    "promotion_vote",   // voting_period_kind
    35034,              // baker_id
    32,                 // n_endorsed_slots
    30,                 // n_ops
    0,                  // n_ops_failed
    0,                  // n_ops_contract
    2,                  // n_tx
    0,                  // n_activation
    0,                  // n_seed_nonce_revelation
    0,                  // n_double_baking_evidence
    0,                  // n_double_endorsement_evidence
    27,                 // n_endorsement
    0,                  // n_delegation
    1,                  // n_reveal
    0,                  // n_origination
    0,                  // n_proposal
    0,                  // n_ballot
    10529.635160,       // volume
    0.004140,           // fee
    80.000000,          // reward
    2560.000000,        // deposit
    0.000000,           // unfrozen_fees
    0.000000,           // unfrozen_rewards
    0.000000,           // unfrozen_deposits
    0.000000,           // activated_supply
    0.000000,           // burned_supply
    31,                 // n_accounts
    0,                  // n_new_accounts
    0,                  // n_new_implicit
    0,                  // n_new_managed
    0,                  // n_new_contracts
    0,                  // n_cleared_accounts
    0,                  // n_funded_accounts
    32100,              // gas_limit
    30414,              // gas_used
    0.136,              // gas_price
    0,                  // storage_size
    58.567415,          // days_destroyed
    1,                  // n_ops_implicit
    100,                // pct_account_reuse
    false,              // lb_esc_vote
    0,                  // lb_esc_ema
    "tz1hThMBD8jQjFt78heuCnKxJnJtQo9Ao25X", // baker
    "ffffffff",         // slot_mask
    ""                  // predecessor (optional, must be requested)
  ]
]

List detailed information about each block, including orphans.

HTTP Request

GET https://api.tzstats.com/tables/block?args

HTTP Response

Field Description
row_id uint64 Unique row identifier.
parent_id uint64 Unique row id of parent block.
hash hash Block hash.
is_orphan bool Flag indicating the block is an orphan, i.e. not on main chain.
height int64 Block height.
cycle int64 Consensus cycle this block is part of.
is_cycle_snapshot bool Flag indicating this block is a cycle snapshot.
time datetime Block timestamp.
solvetime int64 Duration between the parent block’s timestamp and this block.
version int64 Block protocol version (note, this is a serial version that depends on how many protocols have been activated on the current chain so far).
validation_pass int64 Block validation pass.
fitness int64 Block fitness used to determine longest chain.
priority int64 Baking priority.
nonce uint64 Block nonce.
voting_period_kind enum Current voting period proposal, exploration, cooldown, promotion, adoption.
baker_id uint64 Unique row id of the block’s baker account.
slot_mask uint64 32bit big-endian bitmask indicating which slots have been endorsed. (Note this field will be set from endorsements published in the subsequent block.)
n_endorsed_slots int64 Count of endorsed slots. (Note this field will be set from endorsements published in the subsequent block.)
n_ops int64 Count of operations contained in this block.
n_ops_failed int64 Count of failed operations.
n_ops_contract int64 Count of smart contract operations (transactions sent to contracts and internal operations sent by contracts).
n_tx int64 Count of transaction operations.
n_activation int64 Count of activate_account operations.
n_seed_nonce_revelation int64 Count of seed_nonce_revelation operations.
n_double_baking_evidence int64 Count of double_baking_evidence operations.
n_double_endorsement_evidence int64 Count of double_endorsement_evidence operations.
n_endorsement int64 Count of endorsement operations.
n_delegation int64 Count of delegation operations.
n_reveal int64 Count of reveal operations.
n_origination int64 Count of origination operations.
n_proposal int64 Count of proposals operations.
n_ballot int64 Count of ballot operations.
volume money Total amount of tokens moved between accounts.
fee money Total fees paid (and frozen) by all operations.
reward money Reward earned (and frozen) by baker.
deposit money Deposit frozen by baker.
unfrozen_fees money Total unfrozen fees (at end of a cycle).
unfrozen_rewards money Total unfrozen rewards (at end of a cycle).
unfrozen_deposits money Total unfrozen deposits (at end of a cycle).
activated_supply money Total amount of commitments activated in tez.
burned_supply money Total amount of tokens burned by operations in tez.
n_accounts int64 Count of accounts seen in this block (i.e. this includes all operation senders, receivers, delegates and the block’s baker).
n_new_accounts int64 Count of new accounts created regardless of type.
n_new_implicit int64 Count of created implicit accounts (tz1/2/3).
n_new_managed int64 Count of created managed accounts (KT1 without code or manager.tz script).
n_new_contracts int64 Count of created smart contracts (KT1 with code).
n_cleared_accounts int64 Count of accounts that were emptied (final balance = 0).
n_funded_accounts int64 Count of accounts that were funded by operations (this includes all new accounts plus previously cleared accounts that were funded again).
gas_limit int64 Total gas limit defined by operations.
gas_used int64 Total gas consumed by operations.
gas_price float Average price of one gas unit in mutez.
storage_size int64 Total sum of new storage allocated by operations.
days_destroyed float Token days destroyed (tokens transferred * token idle time).
n_ops_implicit int64 Count of implicit protocol events.
pct_account_reuse float Portion of seen accounts that existed before.
lb_esc_ema int64 Granada liquidity baking vote moving average.
lb_esc_vote bool Granada liquidity baking disable vote flag.
baker hash Address of the block baker account, base58check encoded.
predecessor hash Hash of the predecessor block. Optional field, must be explicityly requested in list of columns.

Chain Table

Example request.

curl "https://api.tzstats.com/tables/chain?time.gte=today&limit=1"
import (
  "context"
  "blockwatch.cc/tzstats-go"
)

// create a new query object
q := tzstats.DefaultClient.NewChainQuery()

// add filters and configure the query
q.WithFilter(tzstats.FilterModeGte, "time", "today").WithLimit(1)

// execute the query
list, err := q.Run(context.Background())

// access that chain status
if list.Len() == 1 {
    fmt.Println(list.Rows[0].TotalAccounts)
}

Example response (comments added for explanation).

[
  [
    632250,         // row_id
    632249,         // height
    154,            // cycle
    1569974422000,  // time
    334414,         // total_accounts
    309308,         // total_implicit
    25074,          // total_managed
    108,            // total_contracts
    15227175,       // total_ops
    7139,           // total_contract_ops
    20774,          // total_activations
    19559,          // total_seed_nonce_revelations
    13113009,       // total_endorsements
    127,            // total_double_baking_evidences
    24,             // total_double_endorsement_evidences
    29354,          // total_delegations
    223262,         // total_reveals
    26863,          // total_originations
    1793082,        // total_transactions
    404,            // total_proposals
    725,            // total_ballots
    8747841,        // total_storage_bytes
    167308,         // total_paid_bytes
    0,              // total_used_bytes
    0,              // total_orphans
    298796,         // funded_accounts
    10751,          // unclaimed_accounts
    17567,          // total_delegators
    17105,          // active_delegators
    462,            // inactive_delegators
    3889,           // total_delegates
    483,            // active_delegates
    3406,           // inactive_delegates
    3,              // zero_delegates
    135,            // self_delegates
    78,             // single_delegates
    270,            // multi_delegates
    72059,          // rolls
    462             // roll_owners
  ]
]

List running totals of network-wide statistics. This table is updated at each block.

HTTP Request

GET https://api.tzstats.com/tables/chain?args

HTTP Response

Field Description
row_id uint64 Unique row identifier.
height int64 Block height the current row refers to.
cycle int64 Cycle the current row refers to.
time datetime Block time in UNIX milliseconds the current row refers to.
total_accounts int64 Total count of existing funded & non-funded accounts.
total_implicit int64 Total count of implicit (tz1/2/3) accounts.
total_managed int64 Total count of managed accounts (KT1) used for delegation (without code / using manager.tz script).
total_contracts int64 Total count of deployed smart contracts.
total_ops int64 Total count of on-chain operations.
total_contract_ops int64 Total count of smart contract calls (sent to or originated from contracts).
total_activations int64 Total count of activate_account operations.
total_seed_nonce_revelations int64 Total count of seed_nonce_revelation operations.
total_double_endorsement_evidences int64 Total count of endorsement operations.
total_double_baking_evidences int64 Total count of double_baking_evidence operations.
total_double_endorse int64 Total count of double_endorsement_evidence operations.
total_delegations int64 Total count of delegation operations.
total_reveals int64 Total count of reveal operations.
total_originations int64 Total count of origination operations.
total_transactions int64 Total count of transaction operations.
total_proposals int64 Total count of proposals operations.
total_ballots int64 Total count of ballot operations.
total_storage_bytes int64 Total count of storage bytes allocated.
total_paid_bytes int64 Total count of storage bytes paid.
total_used_bytes int64 Total count of storage used.
total_orphans int64 Total count of orphaned blocks.
funded_accounts int64 Current number of funded accounts.
unclaimed_accounts int64 Current number of unclaimed fundraiser accounts.
total_delegators int64 Current number of non-zero delegators.
active_delegators int64 Current number of non-zero delegators who delegate to an active delegate.
inactive_delegators int64 Total count of non-zero delegators who delegate to an inactive delegate.
total_delegates int64 Current number of registered bakers (active and inactive).
active_delegates int64 Current number of active bakers.
inactive_delegates int64 Current number of inactive bakers (note: inactive bakers can still have future rights, but won’t get any new rights).
zero_delegates int64 Current number of active bakers with zero staking balance.
self_delegates int64 Current number of active bakers who self-bake only and have no incoming delegations.
single_delegates int64 Current number of active bakers who potentially self-bake and have only a single incoming delegation.
multi_delegates int64 Current number of bakers (potentially staking services) who have more than 1 incoming delegation.
rolls int64 Current number of network-wide rolls.
roll_owners int64 Current number of network-wide roll owners.

Contract Table

Example | request.

curl "https://api.tzstats.com/tables/contract?address=KT1REHQ183LzfoVoqiDR87mCrt7CLUH1MbcV"
import (
  "context"
  "blockwatch.cc/tzstats-go"
)

// create a new query object
q := tzstats.DefaultClient.NewContractQuery()

// add filters and configure the query
q.WithFilter(tzstats.FilterModeEqual, "iface_hash", "cf9361e1")

// execute the query
list, err := q.Run(context.Background())

// process contracts
if _, row := range list.Rows {
}

Example response (comments added for explanation).

[
  [
    28402,                                   // row_id
    "KT1Puc9St8wdNoGtLiD2WXaHbWU7styaxYhD",  // address
    818466,                                  // account_id
    813541,                                  // creator_id
    1149672,                                 // first_seen
    1342907,                                 // last_seen
    34600,                                   // storage_size
    34608,                                   // storage_paid
    "00002e850200002e80050007...",           // script
    "cf9361e1",                              // iface_hash
    "666dcc01",                              // code_hash
    "000000000000026...",                    // call_stats
    "set_delegate,transfer_tokens",          // features
    "DEXTER",                                // interfaces
    "tz1P7A3YFgeSsGgopKN9vUU86W3psgTMdtcJ"   // creator
  ]
]

List creation-time information about smart contracts with embedded code and initial storage.

HTTP Request

GET https://api.tzstats.com/tables/contract?args

HTTP Response

Field Description
row_id uint64 Unique row identifier.
address hash Contract address base58check encoded.
account_id uint64 Unique row_id of related account entry.
creator_id uint64 Manager account row_id (deprecated in v005 Babylon).
first_seen int64 Block height of contract creation.
last_seen int64 Block height of last activity.
storage_size int64 Storage size allocated in bytes.
storage_paid int64 Storage bytes paid for in bytes.
script bytes Binary encoded Michelson script and initial contract storage.
iface_hash bytes Short hash to uniquely identify the contract interface, first 4 bytes of the SHA256 hash over binary encoded Michelson script parameters.
code_hash bytes Short hash to uniquely identify the contract code, first 4 bytes of the SHA256 hash over binary encoded Michelson script code.
call_stats bytes Big-endian uint32 call statistic counters per entrypoint. Only used on smart contracts.
features string Comma separated list of Michelson features used by this contract. Any of account_factory, contract_factory, set_delegate, lambda, transfer_tokens, chain_id, ticket, sapling.
interfaces string Comma separated list of standard interfaces implemented by this contract. Any of MANAGER, SET_DELEGATE, TZIP-005, TZIP-007, TZIP-012, DEXTER, WXTZ_VAULT, KOLIBRI_VAULT (list will be extended).
creator hash Contract creator address base58check encoded.

Election Table

Example request.

curl "https://api.tzstats.com/tables/election?proposal=PsBABY5HQTSkA4297zNHfsZNKtxULfL18y95qb3m53QJiXGmrbU"

Example response (comments added for explanation).

[
  [
    13,              // row_id
    5,               // proposal_id
    4,               // num_periods
    2,               // num_proposals
    15,              // voting_perid
    1563303754000,   // start_time
    0,               // end_time
    524288,          // start_height
    0,               // end_height
    0,               // is_empty
    1,               // is_open
    0,               // is_failed
    0,               // no_quorum
    0,               // no_majority
    "PsBABY5HQTSkA4297zNHfsZNKtxULfL18y95qb3m53QJiXGmrbU", // proposal
    "promotion_vote" // last_voting_period
  ]
]

List full details about past and current elections. Elections represent metadata about each consecutive run of related voting periods. Elections may contain 4, 2 or 1 vote periods. They are called empty when only one empty proposal vote without a proposal exists.

HTTP Request

GET https://api.tzstats.com/tables/election?args

HTTP Response

Field Description
row_id uint64 Unique row identifier.
proposal_id uint64 Unique row_id of the winning proposal, if any.
num_periods int64 Election duration in number of voting periods.
num_proposals int64 Total number of submitted proposals.
voting_perid int64 On-chain voting period number.
start_time datetime Block time of election start block.
end_time datetime Block time of election end block.
start_height int64 Block height of election start block.
end_height int64 Block height of election end block.
is_empty bool Flag indicating no proposal was submitted.
is_open bool Flag indicating the election is in progress.
is_failed bool Flag indicating the election has failed to select or activate a new protocol.
no_quorum bool Flag indicating the election has failed because no quorum could be reached.
no_majority bool Flag indicating the election has failed because no majority could be reached.
proposal hash Hash of the proposal that is voted on, if any.
last_voting_period enum Type of the last period at which this election ended proposal, exploration, cooldown, promotion, adoption.

Flow Table

Example request.

curl "https://api.tzstats.com/tables/flow?address=tz2TSvNTh2epDMhZHrw73nV9piBX7kLZ9K9m&limit=1"

Example response (comments added for explanation).

[
  [
    24807689,      // row_id
    360996,        // height
    88,            // cycle
    1553123452000, // time
    8361752,       // op_id
    24,            // op_n
    0,             // op_l
    0,             // op_p
    0,             // op_c
    0,             // op_i
    278469,        // account_id
    31922,         // counterparty_id
    "secp256k1",   // address_type
    "balance",     // category
    "transaction", // operation
    2.000000,      // amount_in
    0.000000,      // amount_out
    0,             // is_fee
    0,             // is_burned
    0,             // is_frozen
    0,             // is_unfrozen
    0,             // is_shielded
    0,             // is_unshielded
    1,             // token_gen_min
    1194,          // token_gen_max
    60,            // token_age
    "tz2TSvNTh2epDMhZHrw73nV9piBX7kLZ9K9m", // address
    "tz1Yju7jmmsaUiG9qQLoYv35v5pHgnWoLWbt", // counterparty
    "opPdGCS8cgW5j1id7WH485NuwjGnD4rVsJTaTZo4ftaT9jatFKJ" // op
  ]
]

List balance updates on all sub-accounts and different categories. Our categories go beyond on-chain types and include baking, denunciations, vesting contracts and the invoicing feature of protocol upgrades.

HTTP Request

GET https://api.tzstats.com/tables/flow?args

HTTP Response

Field Description
row_id uint64 Unique row identifier.
height int64 Block height at which this flow was created.
cycle int64 Cycle at which this flow was created.
time datetime Block time at which this flow was created.
op_n int64 Related operation position in block.
op_l int64 Tezos RPC operation list (0..3).
op_p int64 Tezos RPC operation list position.
op_c int64 Related bulk operation list position.
op_i int64 Related internal operation list position.
account_id uint64 Unique row_id of the account this flow relates to.
counterparty_id uint64 Unique row_id of the counterparty that initiated/received the flow.
address_type enum Account address type ed25519 (tz1), secp256k1 (tz2), p256 (tz3), contract (KT1) or blinded (btz1).
category enum Flow category (i.e. sub-account) rewards, deposits, fees, balance, delegation.
operation enum Operation creating this flow activation, denunciation, transaction, origination, delegation, reveal, endorsement, baking, noncerevelation, internal, vest, pour, invoice, airdrop.
amount_in money Incoming amount in tez.
amount_out money Outgoing amount in tez.
is_fee bool Flag indicating this flow is a fee payment.
is_burned bool Flag indicating this flow burns coins.
is_frozen bool Flag indicating this flow goes towards a freezer sub-account.
is_unfrozen bool Flag indicating this flow comes from a freezer sub-account.
is_shielded bool Flag indicating this flow shielded coins in Sapling.
is_unshielded bool Flag indicating this flow unshielded coins from Sapling.
token_gen_min int64 Minimum generation number of tokens moved.
token_gen_max int64 Maximum generation number of tokens moved.
token_age float Age of tokens moved in days.
address hash Address of the related account.
counterparty hash Address of the counterparty of this flow.

Income Table

Example request.

curl "https://api.tzstats.com/tables/income?address=tz2TSvNTh2epDMhZHrw73nV9piBX7kLZ9K9m&cycle=150"

Example response (comments added for explanation).

[
  [
    64698,            // row_id
    150,              // cycle
    278469,           // account_id
    3576,             // rolls
    3183854.077395,   // balance
    25426700.898205,  // delegated
    4,                // n_delegations
    199,              // n_baking_rights
    6507,             // n_endorsing_rights
    -292.000000,      // luck
    98.230000,        // luck_percent
    99.87,            // performance_percent
    100.00,           // contribution_percent
    201,              // n_blocks_baked
    0,                // n_blocks_lost
    2,                // n_blocks_stolen
    6507,             // n_slots_endorsed
    0,                // n_slots_missed
    15,               // n_seeds_revealed
    16198.000000,     // expected_income
    518336.000000,    // expected_bonds
    16176.875000,     // total_income
    519360.000000,    // total_bonds
    3216.000000,      // baking_income
    12959.000000,     // endorsing_income
    0.000000,         // double_baking_income
    0.000000,         // double_endorsing_income
    1.875000,         // seed_income
    1.680381,         // fees_income
    0.000000,         // missed_baking_income
    0.000000,         // missed_endorsing_income
    32.000000,        // stolen_baking_income
    0.000000,         // total_lost
    0.000000,         // lost_accusation_fees
    0.000000,         // lost_accusation_rewards
    0.000000,         // lost_accusation_deposits
    0.000000,         // lost_revelation_fees
    0.000000,         // lost_revelation_rewards
    "tz2TSvNTh2epDMhZHrw73nV9piBX7kLZ9K9m",  // address
    1568887343000,    // start_time
    1569136305000     // end_time
  ]
]

List detailed baker income and income statistics. This table is extended for all active bakers at each cycle and updated at every block until a cycle is complete. That way, rows for open cycles will always contain live data up to the most recent block in the chain.

HTTP Request

GET https://api.tzstats.com/tables/income?args

HTTP Response

Field Description
row_id uint64 Unique row identifier.
cycle int64 Cycle this income relates to.
account_id uint64 Unique row_id of the baker account this income relates to.
rolls int64 Number of rolls (at snapshot block).
balance money A baker’s own balance, composed of spendable balance and frozen deposits plus frozen fees (at snapshot block). Note that frozen rewards do not contribute towards rolls, hence they are not part of balance here.
delegated money Delegated balance (at snapshot block).
n_delegations int64 Count of incoming non-zero delegations (at snapshot block).
n_baking_rights int64 Count of baking rights in this cycle.
n_endorsing_rights int64 Count of endorsing rights in this cycle.
luck money Absolute luck in coins, i.e. the amount of extra coins that can be earned because randomization allocated more rights than the fair share of rolls.
luck_percent float Relation between actual random rights allocated vs. ideal rights gainable by rolls. Neutral luck is 100%, lower values indicated less rights than fair share, higher values indicate more rights.
performance_percent float Effectiveness of a baker in generating expected rewards. Optimal performance is 100%. The value is lower when blocks or endorsements are missed, low value blocks/endorsements are published or the baker is slashed and higher when extra income was generated from stolen blocks or denunciations. NOTE: This value is not ratio scale nor interval scale. CANNOT be used as benchmark between bakers.
contribution_percent float Effectiveness of a baker in utilizing all rights assigned and contribute to consensus. Optimal contribution is 100%. The value is lower when blocks or endorsements are missed and higher when blocks are stolen. NOTE: This value is ratio scale. It can be used as benchmark for baker availability or participation in consensus. It is strongly correlated to generated income, but does not capture low priority blocks, endorsements or slashing.
n_blocks_baked int64 Number of blocks baked in this cycle.
n_blocks_lost int64 Number of blocks lost in this cycle.
n_blocks_stolen int64 Number of blocks stolen in this cycle.
n_slots_endorsed int64 Number of slots endorsed in this cycle.
n_slots_missed int64 Number of endorsement slots missed in this cycle.
n_seeds_revealed int64 Number of seed nonces revealed in this cycle.
expected_income money Total income expected based on endorsing and priority 0 baking rights.
expected_bonds money Total expected deposits based on endorsing and priority 0 baking rights.
total_income money Total sum of all income (note: due to losses, the actual true income may be smaller which is not reflected by this field alone).
total_bonds money Actual deposits (note: due to losses, the actual bonds that will later be unfrozen may be smaller).
baking_income money Total income from baking blocks.
endorsing_income money Total income from endorsing blocks.
double_baking_income money Total income from denouncing double baking.
double_endorsing_income money Total income from denouncing double endorsing.
seed_income money Total income from publishing seed nonces.
fees_income money Total income from fees.
missed_baking_income money Missed income from lost blocks.
missed_endorsing_income money Missed income due to missed endorsements.
stolen_baking_income money Extra income from stolen blocks.
total_lost money Total lost income due to denunciations or unpublished seed nonces. NOTE: This does not automatically reduce total_income above.
lost_accusation_fees money Lost fees due to a denunciation.
lost_accusation_rewards money Lost rewards due to a denunciation.
lost_accusation_deposits money Lost income due to a denunciation.
lost_revelation_fees money Lost fees due to an unpublished seed nonce.
lost_revelation_rewards money Lost block rewards due to an unpublished seed nonce.
address hash Account address base58check encoded.
start_time datetime Income cycle start time.
end_time datetime Income cycle end time.

Operation Table

Example request.

curl "https://api.tzstats.com/tables/op?time.gte=today&limit=1"
import (
  "context"
  "blockwatch.cc/tzstats-go"
)

// create a new query object
q := tzstats.DefaultClient.NewOpQuery()

// add filters and configure the query
q.WithFilter(tzstats.FilterModeGte, "time", "today").WithLimit(1)

// execute the query
list, err := q.Run(context.Background())

// process ops
if _, row := range list.Rows {

}

Example response (comments added for explanation).

[
  [
    16848289,         // row_id
    1573516812000,    // time
    689942,           // height
    168,              // cycle
    "opGz2Sg1QiXchJMyz9v1rV9VN7mQadmkL81KVwteANQWZpgV5ew", // hash
    0,                // counter
    0,                // op_n
    0,                // op_l
    0,                // op_p
    0,                // op_c
    0,                // op_i
    "endorsement",    // type
    "applied",        // status
    1,                // is_success
    0,                // is_contract
    0,                // gas_limit
    0,                // gas_used
    0.000,            // gas_price
    0,                // storage_limit
    0,                // storage_size
    0,                // storage_paid
    0.000000,         // volume
    0.000000,         // fee
    2.000000,         // reward
    64.000000,        // deposit
    0.000000,         // burned
    18957,            // sender_id
    0,                // receiver_id
    0,                // creator_id
    0,                // delegate_id
    0,                // is_internal
    1,                // has_data
    "128",            // data
    null,             // parameters
    null,             // storage
    null,             // big_map_diff
    null,             // errors
    0,                // days_destroyed
    689941,           // branch_height
    1,                // branch_depth
    0,                // is_implicit
    0,                // entrypoint_id
    0,                // is_orphan
    0,                // is_batch
    0,                // is_sapling
    "tz1Z2jXfEXL7dXhs6bsLmyLFLfmAkXBzA9WE",  // sender
    null,             // receiver
    null,             // creator
    null              // delegate
    "BLKYeKsYgoQWkrQwSVuR5diN5RtM4WNpQaSyzGdhm5onVZhAWVz", // block_hash
    "",               // entrypoint
  ]
]

List detailed information about operations. Note that Tezos supports batch operations and internal operations created by smart contract calls in response to a transaction. On both types multiple ops share the same hash.

HTTP Request

GET https://api.tzstats.com/tables/op?args

HTTP Response

Field Description
row_id uint64 Unique row identifier.
time datetime Block time at which the operation was included on-chain.
height int64 Block height.
cycle int64 Cycle in which the operation was included on-chain.
hash hash Operation hash.
counter int64 Unique sender account ‘nonce’ value.
op_n int64 Operation position in block.
op_c int64 Bulk operation list position.
op_i int64 Internal operation list position.
op_l int64 Tezos RPC operation list (0..3).
op_p int64 Tezos RPC operation list position.
type enum Operation type, one of activate_account, double_baking_evidence, double_endorsement_evidence, seed_nonce_revelation, transaction, origination, delegation, reveal, endorsement, proposals, ballot or implicit event type bake, seed_slash, unfreeze, airdrop, invoice.
status enum Operation execution status applied, failed, backtracked, skipped.
is_success int64 Flag indicating operation was successfully applied.
is_contract bool Flag indicating smart-contract calls.
gas_limit int64 Caller-defined gas limit.
gas_used int64 Gas used by the operation.
gas_price float Effective price per gas unit in mutez.
storage_limit int64 Caller-defined storage limit.
storage_size int64 Actual storage size allocated.
storage_paid int64 Part of the storage the operation paid for.
volume money Amount of tokens transferred in tez.
fee money Fees paid in tez.
reward money Rewards earned in tez.
deposit money Amount of deposited tokens in tez.
burned money Amount of burned tokens in tez.
sender_id uint64 Unique row id of the operation sender account.
receiver_id uint64 Unique row id of the transaction receiver, may be zero.
manager_id uint64 Unique row id of the new manager account, may be zero.
delegate_id uint64 Unique row id of the new delegate account, may be zero.
is_internal bool Flag indicating if this operation was sent be a smart contract.
has_data bool Flag indicating if extra data or parameters are present.
data bytes Extra operation-specific data, see decoding operation data.
parameters bytes Call parameters as hex-encoded binary data serialized according to Micheline serialization for protocol v005 Babylon.
storage bytes Updated contract storage as hex-encoded binary data serialized according to Micheline serialization for protocol v005 Babylon, contract-only.
big_map_diff bytes Inserted, updated or deleted bigmap entries as hex-encoded binary data serialized according to Micheline serialization for protocol v005 Babylon, contract-only.
errors bytes When failed, contains details about the reason as escaped JSON string.
days_destroyed float Token days destroyed by this operation (tokens transferred * token idle time).
branch_height int64 Height of the branch block this op refers to.
branch_depth int64 Count of blocks between branch block and block including this op.
is_implicit bool Flag indicating implicit on-chain events, ie. state changes that don’t have an operation hash such as bake, unfreeze, seed_slash, airdrop and invoice.
entrypoint_id int64 Serial id of the called entrypoint, only relevant if the operation was a transaction, the receiver is a smart contract and call parameters are present.
is_orphan bool Flag indication whether this op was included in a block that was orphaned.
is_batch bool Flag indicating if this operation is part of a batch operation list.
is_sapling bool Flag indicating if this transaction interacted with a Sapling account.
sender hash Address of the operation sender, always set.
receiver hash Address of the receiver of a transaction, may be empty.
creator hash Address of the original source of a contract call, may be empty.
delegate hash Address of the new delegate account, may be empty.
block_hash hash Block the operation was included in.
entrypoint string Name of the contract entrypoint if op is a contract call.

Proposal Table

Example request.

curl "https://api.tzstats.com/tables/proposal"

Example response (comments added for explanation).

[
  [
    5,             // row_id
    "PsBABY5HQTSkA4297zNHfsZNKtxULfL18y95qb3m53QJiXGmrbU",  // hash
    547386,        // height
    1564738976000, // time
    38263,         // source_id
    12880576,      // op_id
    13,            // election_id
    15,            // voting_period
    66302,         // rolls
    304,           // voters
    "tz1eEnQhbwf6trb8Q8mPb2RaPkNk2rN7BKi8", // source
    "ooDAtGzFBeRUJcEK3QRBHU3kzk31CAp2RARYE3kmU3qsrvgs8JN" // op
  ]
]

List full details about every submitted proposal

HTTP Request

GET https://api.tzstats.com/tables/proposal?args

HTTP Response

Field Description
row_id uint64 Unique row identifier.
hash hash Protocol hash.
height int64 Proposal operation block height.
time datetime Proposal operation block time.
source_id uint64 Unique row_id of the proposal sender account.
op_id uint64 Unique row_id of the proposal operation.
election_id uint64 Unique row_id of the election this proposal was submitted in.
voting_period int64 On-chain sequence number of the voting period this proposal was submitted in.
rolls int64 Number of rolls that voted for this proposal in the proposal period.
voters int64 Number of voters who voted for this proposal in the proposal period.
source hash Address of the sender account, base58check encoded.
op hash Hash of the proposal operation, base58check encoded.

Rights Table

Example request.

curl "https://api.tzstats.com/tables/rights?address=tz2TSvNTh2epDMhZHrw73nV9piBX7kLZ9K9m&cycle=154&limit=1"
import (
  "context"
  "blockwatch.cc/tzstats-go"
)

// create a new query object
q := tzstats.DefaultClient.NewRightsQuery()

// add filters and configure the query
q.WithFilter(tzstats.FilterModeEqual, "address", "tz2TSvNTh2epDMhZHrw73nV9piBX7kLZ9K9m").
  WithFilter(tzstats.FilterModeEqual, "cycle", 154).
  Limit(1)

// execute the query
list, err := q.Run(context.Background())

// process rights
if _, row := range list.Rows {

}

Example response (comments added for explanation).

[
  [
    60555268,     // row_id
    "baking",     // type
    630785,       // height
    154,          // cycle
    0,            // priority
    "",           // slots
    278469,       // account_id
    1,            // is_used
    0,            // is_lost
    0,            // is_stolen
    0,            // is_missed
    0,            // is_seed_required
    0,            // is_seed_revealed
    0,            // is_bond_miss
    "tz2TSvNTh2epDMhZHrw73nV9piBX7kLZ9K9m", // address
    1569885537000 // time
  ]
]

List detailed rights for baking (all priorities 0..63) and endorsing. This table is extended with future data from cycle n+5 at the start of a new cycle N. During a cycle, rights for each block are updated according to actual baker, priority and endorsers.

HTTP Request

GET https://api.tzstats.com/tables/rights?args

HTTP Response

Field Description
row_id uint64 Unique row identifier.
type enum Right type, either baking or endorsing.
height int64 Block height this right relates to.
cycle int64 Cycle this right relates to.
priority int64 Baking priority of this right.
slots string Hex encoded bitset for endorsing rights slots (32 slots pre Granada, 256 slots in Granada).
account_id uint64 Unique row_id of the baker who owns this right.
is_used bool Flag indicating a right was used as intended.
is_lost bool Flag indicating a baking right was lost to another baker. This flag appears when a baker fails to produce a block at the designated priority and another baker bakes the block at higher priority.
is_stolen bool Flag indicating a baking right was stolen from another baker. This flag appears on the right relating to the actual baking priority.
is_missed bool Flag indicating an endorser missed endorsing a slot.
is_seed_required bool Flag indicating a baker is required to publish a seed_nonce_revelation in the next cycle.
is_seed_revealed bool Flag indicating whether the baker actually revealed the required seed nonce.
is_bond_miss bool Flag indicating a miss was caused by low balance to pay for deposits.
address hash Address of the baker who owns this right.
time datetime Past or estimated future block time for this right.

Snapshot Table

Example request.

curl "https://api.tzstats.com/tables/snapshot?address=tz2TSvNTh2epDMhZHrw73nV9piBX7kLZ9K9m&cycle=150&is_selected=1&limit=1"
import (
  "context"
  "blockwatch.cc/tzstats-go"
)

// create a new query object
q := tzstats.DefaultClient.NewSnapshotQuery()

// add filters and configure the query
q.WithFilter(tzstats.FilterModeEqual, "address", "tz2TSvNTh2epDMhZHrw73nV9piBX7kLZ9K9m").
  WithFilter(tzstats.FilterModeEqual, "cycle", 150).
  WithFilter(tzstats.FilterModeEqual, "is_selected", true).
  Limit(1)

// execute the query
list, err := q.Run(context.Background())

// process rows
if _, snapshot := range list.Rows {

}

Example response (comments added for explanation).

[
  [
    25384634,         // row_id
    616960,           // height
    150,              // cycle
    1,                // is_selected
    1569042994000,    // time
    9,                // index
    3915,             // rolls
    278469,           // account_id
    278469,           // delegate_id
    1,                // is_delegate
    1,                // is_active
    3216395.662038,   // balance
    28104896.167331,  // delegated
    7,                // n_delegations
    361000,           // since
    "tz2TSvNTh2epDMhZHrw73nV9piBX7kLZ9K9m", // address
    "tz2TSvNTh2epDMhZHrw73nV9piBX7kLZ9K9m", // delegate
    1553123692000     // since_time
  ]
]

List network-wide staking status across all bakers and delegators at snapshot blocks. this table contains all snapshots regardless of them being later chosen as cycle snapshot or not.

HTTP Request

GET https://api.tzstats.com/tables/snapshot?args

HTTP Response

Field Description
row_id uint64 Unique row identifier.
height int64 Block height of this snapshot.
cycle int64 Cycle of this snapshot.
is_selected bool Flag indicating this snapshot was randomly selected as cycle snapshot.
time datetime Block time of this snapshot.
index int64 Snapshot index in the cycle [0..15].
rolls int64 (baker only) Number of rolls owned by the delegate.
account_id uint64 Unique row_id of the account this snapshot relates to.
delegate_id uint64 Unique row_id of the baker this account delegates to.
is_delegate bool Flag indicating the current account is a baker.
is_active bool Flag indicating the current account is an active baker.
balance money Account staking balance (for bakers) or spendable balance (for delegators).
delegated money (baker-only) Incoming delegated amount in tz.
n_delegations int64 (baker-only) Incoming number of non-zero delegations.
since int64 (delegator-only) Block height at which this delegation was created.
address hash Account address.
delegate hash Account delegate address.
since_time datetime (delegator-only) Timestamp when this delegation was created.

Supply Table

Example request.

curl "https://api.tzstats.com/tables/supply?time.gte=today&limit=1"

Example response (comments added for explanation).

[
  [
    1342246,             // row_id
    1342245,             // height
    327,                 // cycle
    1613174407000,       // time
    866116758.904542,    // total
    576334364.096960,    // activated
    35120514.313220,     // unclaimed
    769208476.09957,     // circulating
    759835790.730190,    // liquid
    533295452.655376,    // delegated
    684826946.710113,    // staking
    0.000000,            // shielded
    531009506.095934,    // active_delegated
    681028249.309738,    // active_staking
    2285946.559442,      // inactive_delegated
    3798697.400375,      // inactive_staking
    102153556.968822,    // minted
    32054769.288139,     // minted_baking
    70092988.673362,     // minted_endorsing
    5199.000000,         // minted_seeding
    600.007321,          // minted_airdrop
    0,                   // minted_subsidy
    355396.076980,       // burned
    132029.815883,       // burned_double_baking
    31838.219485,        // burned_double_endorse
    9210.716000,         // burned_origination
    176835.688250,       // burned_implicit
    5481.637362,         // burned_seed_miss
    60264181.814994,     // frozen
    58508544.000000,     // frozen_deposits
    1754196.047913,      // frozen_rewards
    1441.767081          // frozen_fees
  ]
]

List running supply totals at each block.

HTTP Request

GET https://api.tzstats.com/tables/supply?args

HTTP Response

Field Description
row_id uint64 Unique row identifier.
height int64 Block height the current row refers to.
cycle int64 Cycle the current row refers to.
time int64 Block time the current row refers to.
total float64 Total supply, i.e. all coins in existence.
activated money Activated fundraiser supply.
unclaimed money Unclaimed fundraiser supply.
liquid money Circulating supply, i.e. all immediately spendable supply (total - frozen - unclaimed).
delegated money Delegated supply, i.e. all spendable supply owned by delegators.
staking money Staking supply, i.e. delegated supply and supply owned by bakers in form of spendable balances, frozen deposits and frozen fees. Frozen rewards are explicitly excluded because they can be slashed.
shielded money Shielded supply held in Sapling contracts.
active_delegated money Portion of delegated supply that is delegated to active delegates.
active_staking money Portion of staking supply available to active delegates and used for securing consensus.
inactive_delegated money Portion of delegated supply that is delegated to inactive delegates.
inactive_staking money Portion of staking supply on inactive delegates that is not used for securing consensus.
minted money Total issued supply in the form of block rewards.
minted_baking money Issued supply as rewards for block baking.
minted_endorsing money Issued supply as rewards for block endorsement.
minted_seeding money Issued supply as rewards for seed nonce revelations.
minted_airdrop money Issued supply as rewards for developers and protocol-upgrade airdrops (i.e. in Babylon).
minted_subsidy money Issued supply as liquidity baking subsidy (started in Granada).
burned money Total burned supply.
burned_double_baking money Total supply burned due to double baking.
burned_double_endorse money Total supply burned due to double endorsement.
burned_origination money Total supply burned due to contract originations.
burned_implicit money Total supply burned due to implicit account creation.
burned_seed_miss money Total supply burned due to implicit account creation.
frozen money Currently frozen supply.
frozen_deposits money Currently frozen bonds.
frozen_rewards money Currently frozen rewards.
frozen_fees money Currently frozen fees.

Vote Table

Example request.

curl "https://api.tzstats.com/tables/vote?voting_period=16"

Example response (comments added for explanation).

[
  [
    18,                // row_id
    13,                // election_id
    5,                 // proposal_id
    16,                // voting_period
    "exploration",     // voting_period_kind
    1565333282000,     // period_start_time
    1565333282000,     // period_end_time
    557056,            // period_start_height
    589823,            // period_end_height
    70585,             // eligible_rolls
    464,               // eligible_voters
    7291,              // quorum_pct
    51463,             // quorum_rolls
    57818,             // turnout_rolls
    179,               // turnout_voters
    8191,              // turnout_pct
    0,                 // turnout_ema
    37144,             // yay_rolls
    171,               // yay_voters
    0,                 // nay_rolls
    0,                 // nay_voters
    20674,             // pass_rolls
    8,                 // pass_voters
    0,                 // is_open
    0,                 // is_failed
    0,                 // is_draw
    0,                 // no_proposal
    0,                 // no_quorum
    0,                 // no_majority
    "PsBABY5HQTSkA4297zNHfsZNKtxULfL18y95qb3m53QJiXGmrbU" // proposal
  ]
]

List full details about every on-chain voting period.

HTTP Request

GET https://api.tzstats.com/tables/vote?args

HTTP Response

Field Description
row_id uint64 Unique row identifier.
election_id uint64 Unique row_id of the election this proposal was submitted in.
proposal_id uint64 Unique row_id of the proposal that is voted for (or the winning proposal, if any, from the proposal period).
voting_period int64 On-chain sequence number of the voting period.
voting_period_kind enum Type of the voting period proposal, exploration, cooldown, promotion, adoption.
period_start_time datetime Block time of vote start block.
period_end_time datetime Block time of vote end block.
period_start_height int64 Block height of vote start block.
period_end_height int64 Block height of vote end block.
eligible_rolls int64 Number of eligible rolls for this vote.
eligible_voters int64 Number of eligible voters for this vote.
quorum_pct int64 Required quorum for this vote in percent.
quorum_rolls int64 Required quorum for this vote in rolls.
turnout_rolls int64 Actual vote participation in rolls.
turnout_voters int64 Actual vote participation in voters.
turnout_pct int64 Actual vote participation in percent.
turnout_ema int64 Actual vote participation as moving average.
yay_rolls int64 Count of yay voting rolls.
yay_voters int64 Count of yay voting voters.
nay_rolls int64 Count of nay voting rolls.
nay_voters int64 Count of nay voting voters.
pass_rolls int64 Count of pass voting rolls.
pass_voters int64 Count of pass voting voters.
is_open bool Flag indicating the vote is in progress.
is_failed bool Flag indicating the vote has failed to select or activate a new protocol.
is_draw bool Flag indication the reason for failure was a draw between two proposals in the proposal period.
no_proposal bool Flag indication the reason for failure was no submitted proposal in the proposal period.
no_quorum bool Flag indication the reason for failure was participation below the required quorum.
no_majority bool Flag indication the reason for failure was acceptance below the required supermajority.
proposal int64 Hash of the proposal that is voted on, if any.

Time-Series Endpoints

Generic Time-Series Query

https://api.tzstats.com/series/{table_code}.{format}?{args}

The time-series API is an abstraction over tables which allows for server-side aggregation of multiple result rows over time. Time-series are meant to be displayed as graphs with time on the x-axis and some aggregate value on the y-axis. Since the underlying data is still in tabular form all table filters work on time-series as well.

Note that this time-series API does not fill gaps. That means when the underlying table contains no data for a particular time interval, the corresponding time-series row will be missing. Clients should be prepared for this case and fill gaps if required.

Intervals between timestamps are equally spaced and can be controlled by the collapse query parameter, i.e. 1d means each interval contains 24 hours of aggregated data. Time-series data can contain fields of all supported numeric data types (e.g. no strings or binary data). The aggregation function is fixed by the semantics of the data type. This may either be a sum, a count, first, last, min, max or mean value.

On the free API tier historic access is restricted to 90 days.

List of supported time-series

Endpoint Time-Series Content
GET /series/block aggregated block data
GET /series/flow aggregated balances, freezer and delegation flows
GET /series/op aggregated operations data
GET /series/chain running total counters for on-chain operations, accounts and rolls
GET /series/supply running supply totals
GET /series/{exchange}/{market}/ohlcv OHLCV candles

Query Arguments

Time-series datasets support the following query parameters.

Argument Description
columns optional Comma separated list of columns you like to fetch. Bulk array results will be ordered accordingly. Default is all defined columns for a series.
collapse optional Aggregate numeric data over different sampling intervals. Supported values are 1m (default), 5m, 15m, 30m, 1h, 2h, 3h, 4h, 6h, 12h, 1d, 1w, 1M, 3Mand 1y.
order optional Return data in asc (ascending) or desc (descending) order. Default is asc.
limit optional Maximum number of aggregated results returned. Limited to 50,000, default 500.
start_date optional Start of the time range to query. See timestamps for syntax.
end_date optional End of the time range to query. See timestamps for syntax.

When only start or end date are provided, the other end of the range is deducted from collapse and limit. I.e. with collapse of 1d and limit of 30 you’ll get 30 days of data after start_date or before end_date. Called without any optional parameters a query defaults to the most recent 500 minutes (end_date=now, limit=500 and collapse=1m).

Query Filters

Time-series support the same filters used on tables with the same filter expressions of form <column>.<operator>=<arg>. Filters can be used on all table fields, including fields that are not part of the aggregated result such as addresses and type enums.

Block Series

Example request.

curl "https://api.tzstats.com/series/block.json?start_date=today&collapse=1d"

Example response.

[
  [
    1570060800000,      // time
    25002,              // n_ops
    6,                  // n_ops_failed
    2,                  // n_ops_contract
    674,                // n_tx
    2,                  // n_activation
    0,                  // n_seed_nonce_revelation
    0,                  // n_double_baking_evidence
    0,                  // n_double_endorsement_evidence
    24188,              // n_endorsement
    19,                 // n_delegation
    95,                 // n_reveal
    18,                 // n_origination
    0,                  // n_proposal
    6,                  // n_ballot
    1489819.569887,     // volume
    2.223532,           // fee
    79822.000000,       // reward
    2565504.000000,     // deposit
    0.000000,           // unfrozen_fees
    0.000000,           // unfrozen_rewards
    0.000000,           // unfrozen_deposits
    8522.749680,        // activated_supply
    42.148000,          // burned_supply
    152,                // n_new_accounts
    134,                // n_new_implicit
    18,                 // n_new_managed
    0,                  // n_new_contracts
    46,                 // n_cleared_accounts
    164,                // n_funded_accounts
    8167612,            // gas_used
    214,                // storage_size
    17867256.383035008  // days_destroyed
    1440,               // count
  ]
]

Lists aggregate data about blocks. Filters are the same as on the block table, but response fields are limited to numeric data that can be aggregated over time. Aggregation function for all fields is sum.

HTTP Request

GET https://api.tzstats.com/series/block?args

HTTP Response

Field Description
time datetime Timestamp, start of interval.
n_ops int Count of all operations.
n_ops_failed int Count of failed operations.
n_ops_contract int Count of smart-contract operations.
n_tx int Count of transaction operations.
n_activation int Count of activate_account operations.
n_seed_nonce_revelation int Count of seed_nonce_revelation operations.
n_double_baking_evidence int Count of double_baking_evidence operations.
n_double_endorsement_evidence int Count of double_endorsement_evidence operations.
n_endorsement int Count of endorsement operations.
n_delegation int Count of delegation operations.
n_reveal int Count of reveal operations.
n_origination int Count of origination operations.
n_proposal int Count of proposals operations.
n_ballot int Count of ballot operations.
volume int Count of amount of tokens moved between accounts.
fee float Total fee paid (and frozen) by all operations.
reward float Reward earned (and frozen) by baker.
deposit float Deposit frozen by baker.
unfrozen_fees float Total unfrozen fees (at end of a cycle).
unfrozen_rewards float Total unfrozen rewards (at end of a cycle).
unfrozen_deposits float Total unfrozen deposits (at end of a cycle).
activated_supply float Total amount of commitments activated in tez.
burned_supply float Total amount of tokens burned by operations in tez.
n_new_accounts int Count of new accounts created regardless of type.
n_new_implicit int Count of created implicit accounts (tz1/2/3).
n_new_managed int Count of created managed accounts (KT1 without code or manager.tz script).
n_new_contracts int Count of created smart contracts (KT1 with code).
n_cleared_accounts int Count of accounts that were emptied (final balance = 0).
n_funded_accounts int Count of accounts that were funded by operations (this includes all new accounts plus previously cleared accounts that were funded again).
gas_used int Total gas consumed by operations.
storage_size int Total sum of new storage allocated by operations.
days_destroyed float Token days destroyed.
count int Number of aggregated rows for this time bucket.

Flow Series

Example request (network-wide re-delegation flows).

curl "https://api.tzstats.com/series/flow?start_date=today&collapse=1d&category=delegation"

Example response.

[
  [
    1570060800000, // time
    200650.535155, // amount_in
    246036.709877  // amount_out
    12,            // count
  ]
]

Lists aggregate data about flows. Filters are the same as on the flow table, but response fields are limited to numeric data that can be aggregated over time. Aggregation function for all fields is sum.

An interesting feature of flow series is that you can reconstruct the entire balance and delegation history of an account. You can either start at account creation time assuming zero balances or start at the current account state and work your way backwards through flows.

HTTP Request

GET https://api.tzstats.com/series/flow?args

HTTP Response

Field Description
time datetime Timestamp, start of interval.
amount_in float Incoming amount during interval in tez.
amount_out float Outgoing amount during interval in tez.
count int Number of aggregated rows for this time bucket.

Operation Series

Example request.

curl "https://api.tzstats.com/series/op?start_date=today&collapse=1d"

Example response.

[
  [
    1570060800000,      // time
    8187812,            // gas_used
    214,                // storage_size
    0,                  // storage_paid
    1493221.154887,     // volume
    2.228532,           // fee
    63790.000000,       // reward
    2052480.000000,     // deposit
    42.148000,          // burned
    17867317.80054702   // days_destroyed
    2000,               // count
  ]
]

Lists aggregate data about operations. Filters are the same as on the operation table, but response fields are limited to numeric data that can be aggregated over time. Aggregation function for all fields is sum.

HTTP Request

GET https://api.tzstats.com/series/op?args

HTTP Response

Field Description
time datetime Timestamp, start of interval.
gas_used int Total gas used by all operations.
storage_size int Total storage size allocated by all operations.
storage_paid int Total storage paid by all operations.
volume float Total amount of tokens transferred by all operations in tez.
fee float Fees paid by all operation in tez.
reward float Rewards earned in by all operation tez.
deposit float Amount of deposited tokens by all operation in tez.
burned float Amount of burned tokens by all operation in tez.
days_destroyed float Total token days destroyed by all operation.
count int Number of aggregated rows for this time bucket.

Chain Series

Example request.

curl "https://api.tzstats.com/series/chain?start_date=today&collapse=1d"

Example response.

[
  [
    815464,        // height
    199,           // cycle
    1581160828000, // time
    425778,        // total_accounts
    398643,        // total_implicit
    26819,         // total_managed
    316,           // total_contracts
    20554157,      // total_ops
    104074,        // total_contract_ops
    22179,         // total_activations
    25277,         // total_seed_nonce_revelations
    17393631,      // total_endorsements
    131,           // total_double_baking_evidences
    24,            // total_double_endorsement_evidences
    54288,         // total_delegations
    272080,        // total_reveals
    29052,         // total_originations
    2755973,       // total_transactions
    494,           // total_proposals
    1036,          // total_ballots
    122042155,     // total_storage_bytes
    470269,        // total_paid_bytes
    0,             // total_used_bytes
    0,             // total_orphans
    387718,        // funded_accounts
    9346,          // unclaimed_accounts
    29352,         // total_delegators
    28005,         // active_delegators
    1347,          // inactive_delegators
    4031,          // total_delegates
    461,           // active_delegates
    3570,          // inactive_delegates
    8,             // zero_delegates
    138,           // self_delegates
    68,            // single_delegates
    255,           // multi_delegates
    81005,         // rolls
    433            // roll_owners
    1,             // count
  ]
]

Lists running totals and counters at each block. Collapse selects data from the first block in a time window.

HTTP Request

GET https://api.tzstats.com/series/op?args

HTTP Response

Field Description
height int64 block height
cycle int64 block cycle
time int64 block creation time
total_accounts int64 total number of accounts (all types, all states)
total_implicit int64 total number of implicit accounts (tz1/2/3)
total_managed int64 total number of managed delegation contracts (KT1, formerly without code)
total_contracts int64 total number of deployed smart contracts (KT1 with code)
total_ops int64 total number of on-chain operations (external and internal, but not implicit events)
total_contract_ops int64 total number of on-chain calls to KT1 contracts
total_activations int64 total number of on-chain fundraiser account activations
total_seed_nonce_revelations int64 total number of on-chain seed nonce revelations
total_endorsements int64 total number of on-chain endorsement operations (not slots)
total_double_baking_evidences int64 total number of on-chain double-baking denunciations
total_double_endorsement_evidences int64 total number of on-chain double-endorsing denunciations
total_delegations int64 total number of on-chain delegations (including delegation withdrawals)
total_reveals int64 total number of on-chain pubkey revelations
total_originations int64 total number of on-chain contract originations (contains pre-Babylon delegation contracts)
total_transactions int64 total number of on-chain transactions (contains internal transactions)
total_proposals int64 total number of on-chain voting proposals operations
total_ballots int64 total number of on-chain voting ballots
total_storage_bytes int64 total number of allocated storage in bytes
total_paid_bytes int64 total number of paid bytes
total_used_bytes int64 total number of used bytes (TODO: does not work as expected yet)
total_orphans int64 total number of alternative blocks
funded_accounts int64 current number of funded accounts (non-zero balance)
unclaimed_accounts int64 current number of unclaimed fundraiser accounts
total_delegators int64 current number on non-zero balance delegators
active_delegators int64 current number of non-zero balance delegators delegating to active delegates
inactive_delegators int64 current number of non-zero balance delegators delegating to inactive delegates
total_delegates int64 current number of registered delegates (active and inactive)
active_delegates int64 current number of active delegates
inactive_delegates int64 current number of inactive delegates
zero_delegates int64 current number of active delegates with zero staking balance
self_delegates int64 current number of active delegates with no incoming delegation
single_delegates int64 current number of active delegates with 1 incoming delegation
multi_delegates int64 current number of active delegates with >1 incoming delegations (delegation services)
rolls int64 current number of rolls
roll_owners int64 current number of distinct active delegates with rolls
count int Number of aggregated rows. This series does a selection, so count is always equal to 1.

Supply Series

Example request.

curl "https://api.tzstats.com/series/supply?start_date=today&collapse=1d"

Example response.

[
  [
    815478,           // height
    199,              // cycle
    1581161668000,    // time
    825170161.728791, // total
    548313102.872648, // activated
    63141775.537532,  // unclaimed
    27582743.428170,  // vested
    125280976.174350, // unvested
    699889185.554441, // circulating
    516489777.211404, // delegated
    660867550.008684, // staking
    0,                // shieled
    514264193.700025, // active_delegated
    649473768.198626, // active_staking
    2225583.511379,   // inactive_delegated
    11393781.810058,  // inactive_staking
    61045504.551923,  // minted
    12446481.404808,  // minted_baking
    48595263.514794,  // minted_endorsing
    3159.625000,      // minted_seeding
    600.007321,       // minted_airdrop
    0,                // minted_subsidy
    193940.835832,    // burned
    114197.267834,    // burned_double_baking
    31838.219485,     // burned_double_endorse
    7221.767000,      // burned_origination
    37584.857000,     // burned_implicit
    3098.724513,      // burned_seed_miss
    54639772.184175,  // frozen
    52997504.000000,  // frozen_deposits
    1641852.516645,   // frozen_rewards
    415.667530        // frozen_fees
    1,                // count
  ]
]

Lists running supply totals at each block. Collapse selects data from the first block in a time window.

HTTP Request

GET https://api.tzstats.com/series/supply?args

HTTP Response

Field Description
height int64 block height
cycle int64 block cycle
time datetime block creation time
total money total available supply (including unclaimed)
activated money total activated fundraiser supply
unclaimed money total non-activated fundraiser supply
vested money total genesis vesting-contract supply that has already vested
unvested money total genesis vesting-contract supply that has not vested yet
circulating money current circulating supply (by unanimous consent this is total - unvested even though frozen supply cannot move next block but still counts against total network value)
delegated money current delegated supply (balances of all delegators)
staking money current staking supply (balances of delegators and all bakers even if inactive, see below)
shielded money current shielded supply (balances held in Sapling contracts)
active_delegated money current active delegated supply (balances of all delegators delegating to active bakers)
active_staking money current active staking supply (balances of all active bakers and their delegators)
inactive_delegated money current inactive delegated supply (balances of all delegators delegating to inactive bakers)
inactive_staking money current inactive staking supply (balances of all inactive bakers and their delegators)
minted money total supply minted so far
minted_baking money total supply minted as baking rewards
minted_endorsing money total supply minted as endorsing rewards
minted_seeding money total supply minted as seed nonce revelation rewards
minted_airdrop money total supply minted in airdrops
minted_subsidy money Issued supply as liquidity baking subsidy (started in Granada).
burned money total supply burned so far
burned_double_baking money total supply burned by double baking denunciations
burned_double_endorse money total supply burned by double endorsing denunciations
burned_origination money total supply burned by contract originations
burned_implicit money total supply burned by implicit account allocations
burned_seed_miss money total supply burned by seed nonce revelation misses
frozen money current frozen supply
frozen_deposits money current frozen deposits
frozen_rewards money current frozen rewards
frozen_fees money current frozen fees
count int Number of aggregated rows. This series does a selection, so count is always equal to 1.

OHLCV Series

Example request for the 24 most recent hourly candles.

curl "https://api.tzstats.com/series/kraken/XTZ_USD/ohlcv?start_date=now-24h&collapse=1h"

Example response.

[
  [
    1570032000000,  // time
    0.94000,        // open
    0.94460,        // high
    0.90890,        // low
    0.92180,        // close
    0.92183,        // vwap
    36,             // n_trades
    3,              // n_buy
    33,             // n_sell
    7878.17322,     // vol_base
    7262.35661,     // vol_quote
    162.09115,      // vol_buy_base
    150.18552,      // vol_buy_quote
    7716.08207,     // vol_sell_base
    7112.17109      // vol_sell_quote
  ],
  // ...
]

List aggregated OHLCV market data.

HTTP Request

GET https://api.tzstats.com/series/{exchange}/{market}/ohlcv

HTTP Response

Field Description
time datetime Timestamp, start of interval.
open float Opening price.
high float Highest price.
low float Lowest price.
close float Closing price.
vwap float Volume weighted average price from smallest increment (1 min).
n_trades int Count of trades in the time-frame.
n_buy int Count of trades where the market maker was buyer.
n_sell int Count of trades where the market maker was seller.
vol_base float Total trading volume in base currency (i.e. always XTZ).
vol_quote float Total trading volume in quote currency.
vol_buy_base float Buy-side volume in base currency.
vol_buy_quote float Buy-side volume in quote currency.
vol_sell_base float Sell-side volume in base currency.
vol_sell_quote float Sell-side volume in quote currency.

Changelog

Recent changes and additions to the TzStats Data API.

2021-09-04

This release is a minor update with a few performance improvements and several new fields.

2021-07-24

This API release introduces Granada support, changes the structure of rights and upgrades to a new bigmap index that is now split into 3 parts (bigmaps, bigmap_values and bigmap_updates). The bigmap explorer API does not change, but the tables API will reflect that new structure.

BREAKING CHANGES

New fields

2021-04-16

BREAKING CHANGES

With this release we introduce a new Micheline decoding engine which changes how data and typedefs are represented for contract storage, bigmaps and operation parameters.

2021-02-10

A big deal of behind-the-scenes performance improvements went into this release, so that we are able to deliver the snappy response times you’re used to. We’ve started to prune irrelevant historic data from rights (unused block priorities) and snapshots (non-selected baker and delegator balances) to make querying relevant data faster.

We also reworked our smart contract data model, stripping less useful fields available elsewhere and adding new fields like detected interface standard and used Michelson features. When contract code is patched by a protocol upgrade we now add an implicit migration operation and update the stored representation of contract code as well. The previous version of the contract code is still available, either as part of the origination or the most recent migration operation.

This release adds support for Edo, namely Michelson extensions tickets, comb pairs and lazy storage (currently still exposed as bigmap on the API) as well as simple Sapling support (tracking total Sapling supply and flows). Please reach out to tzstats@blockwatch.cc if you need additional Sapling or ticket support.

We decided to not remove deprecated operation listing endpoints because many people still use them and we found a way to optimize their performance.

BREAKING CHANGES

NEW FEATURES

FIXES

DEPRECATION NOTICES

2020-06-24

To handle the surge in volume we’re optimizing a few of the most heavily used API endpoints. Our aim is to improve user experience and stability for everybody.

The most important change is that we begin migrating operation listings on explorer endpoints from embedded arrays inside accounts/blocks to stand-alone arrays. Both flavors will be available in parallel for a while. For high-speed high-volume access, consider using the table API endpoints. Table access is much faster since data is streamed and requires less calls due to higher limits.

As we keep adding new fields to tables and time-series the default order of JSON bulk arrays may change over time. To ensure that our API always returns the field order you expect, use the columns query argument. The order of columns you specify is exactly the order that’s returned.

DEPRECATION NOTICES

BREAKING CHANGES

FIXES

NEW FEATURES

2020-02-24

FIXES

NEW FEATURES

BREAKING CHANGES

2020-01-06

2019-12-05

2019-11-01

2019-10-26

2019-10-24

2019-10-20