API Endpoints (WIP)

Overview

This document provides a list of API endpoints for a blockchain explorer. These endpoints allow users to query information about blocks, transactions, addresses, and other blockchain-related data.

API Endpoints

Blocks

  • GET /blocks - Description: Retrieve a list of recent blocks. - Parameters: - limit (optional, number of blocks to return)

  • GET /blocks/{blockHash} - Description: Retrieve details of a specific block by its hash. - Parameters: - blockHash (hash of the block)

  • GET /blocks/height/{blockHeight} - Description: Retrieve details of a block by its height. - Parameters: - blockHeight (height of the block)

Transactions

  • GET /extrinsic/{extrinsicHAsh}

    • Description: Retrieve an extrinsic associated with a specific hash. It contain all the events included and the state of them.
  • GET /extrinsics?startbloc=1234&endblock=345&limit=50

    • Description: Retrieve a list of extrinsic in the block range, if not defined it return the last 50 extrinsic. This need pagination
      • Parameters:
        • startbloc (the end block we want the transactions to be included not required)
        • endblock (the end block we want the transactions to be included not required )
        • limit (the maximum number of events we want to return, if not set we return 50)
  • GET /extrinsics/{palletName}/{extrinsicName}?startbloc=1234&endblock=345&limit=50

    • Description: Retrieve a list of extrinsic in the block range, if not defined it return the last 50 extrinsic. This need pagination
      • Parameters:
        • palletName (the pallet name we want the extrinsic from, required )
        • extrinsicName (the extrinsic name we want to retrieve, required)
        • startbloc (the end block we want the transactions to be included not required)
        • endblock (the end block we want the transactions to be included not required )
        • limit (the maximum number of events we want to return, if not set we return 50)

Addresses

  • GET /addresses

    • Description: the list of all the chain address balance paginated.
  • GET /address/{address}

    • Description: Retrieve information about a specific address, including balance and transaction history.
    • Parameters:
      • address (the blockchain address)
  • GET /address/{address}/balance

    • Description: Retrieve the balance of a specific address in realtime using the blockchain.
      • Parameters:
        • address (the blockchain address)
  • GET /address/{address}/transactions?startbloc=1234&endblock=345&limit=50

    • Description: Retrieve transactions associated with a specific address. If start and end block is not set we pass the last 50 transaction. This need pagination
      • Parameters:
        • address (the blockchain address)
        • start (the end block we want the transactions to be included not required)
        • endblock (the end block we want the transactions to be included not required )
        • limit (the maximum number of events we want to return, if not set we return 50)

Pallets Information

  • GET /{palletId}/consts?block=123

    • Description: Return a list of const item metadata for constant items of the specified palletId.
    • Parameters:
      • block (the block we want the const to be included not required if not set we return the last record know)
  • GET /{palletId}/events?block=123&limit=50

    • Description: Returns a list of event item metadata for event items of the specified palletId.
    • Parameters:
      • block (the block we want the event to be included not required if not set we return the last record know)
      • limit (the maximum number of events we want to return, if not set we return 50)
  • GET /{palletId}/events/{eventId}

    • Description: Returns an event item of the specified palletId.
    • Parameters:
      • eventId (the id of the event)
  • GET /{palletId}/events?block=123&limit=50

    • Description: Returns a list of event item metadata for event items of the specified palletId.
    • Parameters:
      • block (the block we want the event to be included not required if not set we return the last record know)
      • limit (the maximum number of events we want to return, if not set we return 50)

Subnets Information

  • GET /subnets?block=123

    • Description: Return a list of all the subnets at the latest block with basic informations ( Active Keys, Active Validators, Active Dual Miners / Validators, Active Miners, Registration Cost)
      • Parameters:
        • block (the block we want the const to be included not required if not set we return the last record know)
  • GET /{subnets}/{subnetId}/miners?block=123 - Description: Return a list of all miners active in the subnet at a defined block.

    • Parameters:
      • subnetId (the id of the subnet we want to query)
      • block (the block we want the const to be included not required if not set we return the last record know)
  • GET /{subnets}/{subnetId}/infos?block=123 - Description: Return a list of all miners active in the subnet at a defined block.

    • Parameters:

      • subnetId (the id of the subnet we want to query)
      • block (the block we want the const to be included not required if not set we return the last record know)
    • Data Returned:

      • subnet specs:
        • name
        • reg date
        • emissions %
        • emissions (t/24)
        • emissions (total t)
      • subnet info:
        • github link
        • dev
        • discord
        • additional links ( exchanges )
        • description
        • hardware reqs (miner/validator)
      • metagraph
      • reg data:
        • reg price chart (7 days)
        • reg cost
        • blocks until next reg
        • regs per block
        • last regs table
      • dereg data:
        • last dereg incentive
        • historical dereg incentive/emissions
      • distributions:
        • miner incentive distribution chart (include uid for each data point)
        • coldkey distribution
        • ip distribution.
      • recycle data: recycled tao/24, total recycled tao, historical graph.
      • historical vtrust: all valid, + network mean
      • historical incenitve: high, low, mean (keys not in immunity only)
      {
      	"subnet_specs": {
      		"name": "",
      		"reg_date": "",
      		"emissions_percentage": 0,
      		"emissions_per_day": 0,
      		"total_emissions": 0
      	},
      	"subnet_info": {
      		"github_link": "",
      		"developer": [],
      		"discord": "",
      		"additional_links": {
      			"exchanges": ""
      		},
      		"description": "",
      		"hardware_requirements": {
      			"miner": "",
      			"validator": ""
      		}
      	},
      	"metagraph": {},
      	"registration_data": {
      		"reg_price_chart_7_days": [],
      		"reg_cost": 0,
      		"blocks_until_next_reg": 0,
      		"regs_per_block": 0,
      		"last_regs_table": ""
      	},
      	"deregistration_data": {
      		"last_dereg_incentive": 0,
      		"historical_dereg_incentive_emissions": ""
      	},
      	"distributions": {
      		"miner_incentive_distribution_chart": {
      			"uid": ""
      		},
      		"coldkey_distribution": "",
      		"ip_distribution": ""
      	},
      	"recycle_data": {
      		"recycled_tao_per_day": 0,
      		"total_recycled_tao": 0,
      		"historical_graph": []
      	},
      	"historical_vtrust": {
      		"all_valid": "",
      		"network_mean": 0
      	},
      	"historical_incentive": {
      		"high": 0,
      		"low": 0,
      		"mean": 0
      	}
      }
      
      
  • GET /miners?block=123 - Description: Return a list of all miners active at a defined block.

    • Parameters:
      • block (the block we want the const to be included not required if not set we return the last record know)
  • GET /miner/{minerId}?block=123 - Description: Return a list of all miners active at a defined block.

    • Parameters:
      • minerId (the the miner id we want to return the infos from)
      • block (the block we want the const to be included not required if not set we return the last record know)

Validators Information

GET /validators?block=123 - Description: Return a list of all validators active at a defined block. - Parameters: - block (the block we want the const to be included not required if not set we return the last record know) - GET /validator?validatorId=5F4tQyWrhfGVcNhoqeiNsR6&block=123 - Description: Return a single validator active at a defined block. - Parameters: - validatorId ( the id of the validator we want the informations ) - block (the block we want the const to be included not required if not set we return the last record know)

Network Statistics

  • GET /stats - Description: Retrieve blockchain network statistics, such as total number of transactions, average block time, price, total supply, Market Cap, Circulating Supply, 24h Volume, Finalised blocks, Validating APY, Signed extrinsic, Staking APY, Total Accounts, Active accounts ( account that are active the last X days it will give a chain health), Staked Supply, Total transfers.

  • GET /totalsupply

    • Description: just give the supply for CMC as a simple number, no formatting

Node Information

  • GET /node/info - Description: Retrieve information about the blockchain node, such as software version, connection count, etc.
  • GET /search - Description: General search endpoint to find blocks, transactions, or addresses. - Parameters: query (search query, could be block hash, transaction hash, or address)

Miscellaneous

  • GET /price - Description: Retrieve current price and historical price data for the blockchain's native cryptocurrency.

Notes

  • All endpoints return data in JSON format.
  • Parameters should be passed as query parameters in the URL.

Errors

  • Standard HTTP response codes are used for errors.
  • 400 Bad Request for invalid requests.
  • 404 Not Found for non-existent resources.
  • 500 Internal Server Error for server errors.