How To Access Polkadot via Substrate Sidecar API

Learn how to access Polkadot via Substrate Sidecar API.

Step 1: To access the available Substrate Sidecar methods, use the following native access endpoint:

  • Network: Polkadot Mainnet
  • Request Type: POST / GET
https://svc.blockdaemon.com/polkadot/mainnet/native
  • Network: Polkadot Westend
  • Request Type: POST / GET
https://svc.blockdaemon.com/polkadot/westend/native

Step 2: You should authorize your request. Learn more: Authentication Guide

Step 3: Add a Substrate Sidecar method at the end of the query:

https://svc.blockdaemon.com/polkadot/mainnet/native/YOUR_METHOD

Step 4: For POST requests, specify the data required by the method in the request body.

Example Request for Substrate Sidecar API

Here is a cURL example for using GET /blocks/head/header to get the header of the most recently finalized block in Polkadot Mainnet:

curl -X GET \
https://svc.blockdaemon.com/polkadot/mainnet/native/blocks/head/header \
-H 'Authorization: Bearer YOUR_API_KEY'

The following is a typical response you will get:

{
    "parentHash": "0xce2dacd2a92d2ae272786c9fcca3f7bd831ef0f87fca252442a0e698a3366490",
    "number": "11557833",
    "stateRoot": "0xec013a64ddfc05f4a1fcc84e2a15d6e158fbd88fce541b7b96ed40c3d4ba6c40",
    "extrinsicsRoot": "0x4ebf6e119dff512925598aade56145811aa09f459f816f8e77dc8b9c396de2ec",
    "digest": {
        "logs": [
            {
                "preRuntime": [
                    "0x42414245",
                    "0x01b90000002a257e10000000000a154a6d22a07fcbb4769a5bec0983edba50d356753f6f006a795dca69c8462230b43eafb92eb8ed56beb9b28e1f399f910913d46cc974877876f826f0f7310fca528c6f73ae6acba72094a01659796f47701145357add6db6dbe7978cded101"
                ]
            },
            {
                "seal": [
                    "0x42414245",
                    "0xfc0ffcf11176d71725bf8f14e0691185a0159a3d06ce59811c09305b0df0b37c1949883a28837403feb225229923d53bbca2c4dcf82b8251f2aca964beedb385"
                ]
            }
        ]
    }
}

👋 Need Help?

Contact us through email or our support page for any issues, bugs, or assistance you may need.