Skip to main content

Service API

The Chainweb service API allows querying and control of Chainweb nodes by clients outside of the blockchain network. For example, other clients might include mining pools, decentralized services, web applications, exchanges, wallets, and so on. Node operators must explicitly enable access to the service API and expose its endpoints on a different network interface than the peer-to-peer API. The specific service API endpoints that are exposed for any node depend on the node configuration settings.

If you're a node operator, you can enable service API endpoints using configuration settings for the Chainweb node. The endpoints are served on a separate port over the unencrypted Hypertext Transfer Protocol (HTTP) by default. For bootstrap nodes, you can connect to service API endpoints using HTTP or the secure Hypertext Transfer Protocol (HTTPS). However, as a node operator, you can require access to any service API endpoints you expose to use HTTPS. In general, connecting over HTTPS is strongly recommended to protect data in transit and to prevent potential browser issues.

As a node operator, you can also choose to expose the endpoints locally or through reverse proxies, load balancers, authentication frameworks, and other similar web technologies.

Key features and use cases

The Chainweb API is essential for various blockchain operations and analysis:

  • Node information: Access detailed information about individual nodes in the network.
  • Block and transaction data: Retrieve comprehensive data about blocks and transactions across Kadena's multi-chain architecture.
  • Network statistics: Gather real-time statistics about network performance and state.
  • Peer-to-peer network topology: View the block heights and adjacent relationships between nodes in the Kadena network.
  • Chain-specific queries: Perform targeted queries for specific chains within the multi-chain structure of the Kadena Chainweb architecture.
  • Mining operations: Access endpoints relevant for miners and mining pool operators.

These features make the Chainweb API particularly valuable for developers building infrastructure tools, block explorers, analytics platforms, and other applications requiring deep blockchain data access.

Endpoints

The Chainweb service API includes the following types of endpoints:

  • Full block header and payload endpoints
  • Block hash endpoints
  • Block header endpoints
  • Node and network health endpoints
  • Mining service endpoints
  • Pact REST API endpoints

Base URL

Because the service API is configurable for individual nodes, the base URL for service API endpoints can vary. For bootstrap nodes, service API endpoints typically take the form of api.<hostname>/chainweb/0.0/mainnet01 where the <hostname> is the IP address or domain name of a Chainweb node in the Kadena public blockchain network. Similarly, the base URL for service API endpoints in the Kadena test network is typically api.testnet.<hostname>/chainweb/0.0/testnet04 where the <hostname> is the IP address or domain name of a Chainweb node in the Kadena test network. If you're running a local development environment, you can typically replace <hostname> with localhost:8080 to connect to the API and, if necessary, specify development as the network name.

Note that the Pact endpoints for any given chain identifier use the route prefix /chain/{chainId}/pact/ in addition to the base URL. For more information about Pact endpoints, see the Pact API or the Pact OpenAPI specification.

Resource consumption and vulnerability

Some service API endpoints can require considerable resources on the server side, Service API endpoints are also more vulnerable to denial-of-service (DOS) attacks. In most cases, you should avoid exposing service endpoints to the public internet and use firewall rules or access controls to prevent unauthorized access.