Ankr API
Use Ankr to setup an Archive or Fast API endpoint
Instant xDai API access is available with Ankr. The free tier includes up to 100K requests/day, and you can connect to a Nethermind Archive or Fast node with JSON RPC or Websockets.
For more information, see the Ankr Docs

Setup

1) Sign up for an account at https://app.ankr.com/auth/sign-up. Once you are logged in, you will be directed to the dashboard.
  1. 1.
    Select the Market Icon
  2. 2.
    Go to API Markets
  3. 3.
    Select xDai
2) Enter a project name, network (keep as mainnet) and press next. This is for tracking and organizing your projects in the dashboard.
3) Choose your authentication method. For basic authentication you will select a username and password. You can also use token authentication and a token is automatically created.
4) Once you've created a project, you will see it in the API menu. Click on a project to view the details.
5) On the details page you will see your API endpoint and wss link. Click on the copy icon to get the endpoint.

Querying the xDai Chain

Example: eth_blockNumber query

This example uses token authentication with the copied API endpoint, so no need to specify username/password. We query the latest block number using the eth_blockNumber method and no parameters.
Example Query:
1
curl -H "Content-Type: application/json" -d '{"id":1, "jsonrpc":"2.0", "method": "eth_blockNumber","params": []}' your-copied-api-endpoint
Copied!
Example Response:
The query returns a hexadecimal response equal to the latest block number. We get 0xeb48e3equal to 15419619.
1
{"jsonrpc":"2.0","result":"0xeb48e3","id":1}
Copied!

JSON-RPC methods

Additional info on methods:
Last modified 6mo ago