Polkadot

This section outlines how to use our API endpoint to connect to Polkadot.

Polkadot is a blockchain platform that enables the creation of a network of interoperable and secure specialized blockchains called parachains. It aims to solve traditional blockchain networks' scalability, interoperability, and governance issues by facilitating seamless communication between blockchains while maintaining high-security standards.

How to Connect to Polkadot

Using Public Endpoint

You can connect to polkadot using Blockops public API endpoints. These endpoints are only suitable for testing. Public RPC endpoints are not intended for dApp building. (Throughput rate limited to 50 rps).

circle-info

We have different rate limits set for private API endpoints (e.g. ones with API keys attached) - Read more below

To avoid rate limiting and service interruption, sign up nowarrow-up-right to get your own API key.

For Polkadot Mainnet

https://polkadot-public-rpc.blockops.network/rpc

For Polkadot Westend

https://westend-rpc.blockops.network/rpc

The below example uses the public API endpoint to make a request on the terminal

Using curl

curl -H "Content-Type: application/json" -d '{"id":1, "jsonrpc":"2.0", "method": "chain_getBlock"}' 'https://polkadot-public-rpc.blockops.network/rpc'

Using Private Endpoint

Using API keys on an RPC node provides better tracking and monitoring of API usage.

Secure your data, speed up your queries, and take control of your API usage with our RPC API endpoint and personalized API keys. Sign up nowarrow-up-right to get your own API key.

To get your API key, create a project using a unique Identifier as the project name and select Polkadot from the network options.

Create a Polkadot project

Open the project to view your api key and rpc endpoints.

view Polkadot project

Send requests

circle-info

All requests are POST requests.

Connect via Command Line

You can connect to the network using websocket or HTTP with your API key in two ways:

  • Adding the API key as a query string ?api_key=${APIKEY}

  • Or the request header -H 'authorization: APIKEY ${APIKEY}'

Curl

For example, the following CURL command can be used to get header and body of a relay chain block.

Here is the response you will receive back.

Wscat

If you want to send data requests with WebSockets, you can use several libraries or wscat. You can install and use wscat as follows:

You can connect to the network with wscat using two options by adding the API key as a query string.

Or the request header.

After executing the command, the terminal will display a message indicating that the connection has been enabled successfully.

Then, you can send the following request:

circle-info

For more information on the Polkadot network, please see the official Polkadot developer documentationarrow-up-right.

Login or set up an account herearrow-up-right to get started!

Websitearrow-up-right

Githubarrow-up-right

Last updated