swagger.json


Overview

This file is an OpenAPI 3.0.0 specification document describing the RESTful API for **@shapeshiftoss/blockbook**, a blockchain indexer backend primarily used by the Trezor wallet. The API exposes endpoints for querying blockchain data such as blocks, transactions, addresses, unspent transaction outputs (UTXOs), and sending transactions.

The specification provides detailed descriptions of request paths, query and path parameters, response schemas, and example payloads for supported operations across multiple blockchain types (notably Bitcoin and Ethereum). It defines a comprehensive set of reusable data models (schemas) describing blockchain entities like transactions, blocks, addresses, tokens, and backend status.

This API serves as a normalized interface for accessing blockchain data abstracted from coin-specific differences, enabling clients to interact uniformly with multiple coins and tokens.


Detailed Explanation of Components

Components Section

Schemas

The `components.schemas` section defines JSON schema models representing the domain entities used in requests and responses.

Security Schemes

No security schemes are defined in this API specification.


API Paths and Operations

/api/v2 - GetInfo


/api/v2/block-index/{height} - GetBlockHash


/api/v2/tx/{txid} - GetTransaction


/api/v2/tx-specific/{txid} - GetTransactionSpecific


/api/v2/address/{address} - GetAddress


/api/v2/xpub/{xpub} - GetXpub


/api/v2/utxo/{account} - GetUtxo


/api/v2/block/{block} - GetBlock


/api/v2/sendtx/{hex} - SendTransaction


/api/v2/balancehistory/{account} - BalanceHistory


/api/v2/estimatefees - EstimateFees


Important Implementation Details


Interaction with Other System Components


Usage Examples

Example: Retrieve Blockchain Info

Request: `GET /api/v2`

Response snippet:

{
  "blockbook": {
    "coin": "Bitcoin",
    "host": "indexer-sts-1",
    "version": "0.3.4",
    "syncMode": true,
    "bestHeight": 577261,
    "inSync": true,
    "mempoolSize": 17348,
    "decimals": 8,
    "dbSize": 191887866502,
    "about": "Blockbook - blockchain indexer for Trezor wallet"
  },
  "backend": {
    "chain": "main",
    "blocks": 577261,
    "headers": 577261,
    "bestBlockHash": "0000000000000000000ca8c902aa58b3118a7f35d093e25a07f17bcacd91cabf",
    "difficulty": "6704632680587.417",
    "version": "180000"
  }
}

Example: Get Transaction Details (Bitcoin)

Request: `GET /api/v2/tx/75d18ecf1a785fe7d08c6092e0e57bc6b6c180da317424ed5d38dc82cdfc0966`

Response includes transaction inputs, outputs, block info, confirmations, fees, and raw hex.


Mermaid Diagram: API Structure and Schema Relationships

flowchart TD
    Info["Info\n(blockbook + backend)"]
    BlockbookInfo["BlockbookInfo\n(blockbook status)"]
    BackendInfo["BackendInfo\n(backend node status)"]
    Tx["Tx\n(transaction)"]
    Vin["Vin\n(tx input)"]
    Vout["Vout\n(tx output)"]
    TokenTransfer["TokenTransfer"]
    MultiTokenValue["MultiTokenValue"]
    EthereumSpecific["EthereumSpecific"]
    Token["Token\n(tokens held)"]
    Erc20Contract["Erc20Contract"]
    Address["Address\n(account address)"]
    Xpub["Xpub\n(extends Address)"]
    Utxo["Utxo\n(unspent outputs)"]
    Block["Block\n(block data)"]
    SendTx["SendTx\n(send transaction response)"]
    BalanceHistory["BalanceHistory\n(balance time point)"]
    BlockIndex["BlockIndex\n(block hash)"]

    Info --> BlockbookInfo
    Info --> BackendInfo

    Tx --> Vin
    Tx --> Vout
    Tx --> TokenTransfer
    Tx --> EthereumSpecific

    TokenTransfer --> MultiTokenValue

    Address --> Tx
    Address --> Token
    Address --> Erc20Contract

    Xpub --> Address

    Block --> Tx

    Utxo

    SendTx

    BalanceHistory

    BlockIndex

Summary

The [swagger.json](/projects/291/68851) file comprehensively defines the REST API for the Blockbook blockchain indexer backend. It focuses on normalized blockchain data access for blocks, transactions, addresses, and tokens across multiple coins, with special support for Bitcoin and Ethereum ecosystems. The specification enables client applications to query blockchain states efficiently with rich filtering, pagination, and token support, as well as send transactions and estimate fees. The detailed schemas and example payloads serve as a robust contract for both API consumers and implementers.