Peer-to-peer endpoints
The peer-to-peer (P2P) API contains the RPC endpoints that Chainweb nodes must expose to establish blockchain consensus. These endpoints enable nodes to communicate about transactions waiting in the transaction pool and the blocks being produced. Although the peer-to-peer endpoints are intended primarily for communication between Chainweb nodes, they are also useful in providing low level insight into network operations, the progress of the blockchain, and node health. Peer-to-peer endpoints are typically more efficient than similar service API endpoints for most use cases. However, peer-to-peer endpoints only expose features that are required for the peer-to-peer network to function. For most use cases, you should send API requests to service API endpoints.
Each computer running chainweb-node serves peer-to-peer endpoints using the secure Hypertext Transfer Protocol (HTTPS) on a network interface and port that is available directly on the public internet.
You can also make P2P API endpoints available for other clients by exposing the endpoints using reverse proxies, load balancers, authentication frameworks, or similar web technologies.
Endpoints
The Chainweb peer-to-peer API includes endpoints to return information about the following aspects of the peer-to-peer network:
- Distributed state using
cutendpoints - Raw block payload using
payloadendpoints - Pending transaction using
mempoolendpoints - Peer-to-peer connections using
peerendpoints - Node configuration using the
configendpoint
The peer-to-peer communication that's required for Chainweb nodes to synchronize state is partitioned into separate independent network channels to perform different tasks.
- The
/cut/peerportion of the peer-to-peer network is responsible for communicating the consensus state across a set of distributed network nodes and all of the chains in the network. Each node has a set of peers that it recognizes and connects to for exchanging information about the state of the chain. - There is also one
/mempool/peerpeer-to-peer network channel for each chain. The/mempool/peerportion of the peer-to-peer network is responsible for queuing and managing pending transactions for each chain independently.
Base URL
The base URL for peer-to-peer API endpoints typically takes the form of <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 peer-to-peer endpoints in the Kadena test network is typically <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 specify development as the network name.
For peer-to-peer API endpoints that must connect to a specific chain, the base URL must also include the chain identifier if the form of /chain/<chain-id>/ where the <chain-id> is the chain identifier for the chain that you want to send the request to.
For example, to send a request to the /mempool/peer endpoint on the first chain (0), the URL would look similar to the following:
https://52.207.207.113:1789/chainweb/0.0/mainnet01/chain/0/mempool/peer