A quick introduction to using the Explorer running on Snowflake SQL.
Data Caveats
SQL: Our Explorer data is powered by Snowflake SQL.
Timestamps: All timestamps are in Coordinated Universal Time (UTC).
Prices: All prices-related data are in USD denomination unless otherwise stated
Address Casing: All EVM addresses are in lower casing.
Native token: Native tokens are presented by zero address for the respective chain. E.g for Ethereum and most EVM chains: 0x0000000000000000000000000000000000000000, Tron: T9yD14Nj9j7xAB4dbGeiX9h8unkKHxuWwb
Prerequisites
Before you get started, we assume you already have:
Create a query that you would like to run programmatically. If you haven't done so, head over to Allium App and create a query. For your convenience, here's an example query you can use:
SELECT*FROM ethereum.raw.blocks LIMIT100
Have a local environment set up where you can run cURL, python or js code.
You will get back a run_id like { "run_id": "c7UViykJloFAUY2pwFjd" }.
In the same terminal, run:
export RUN_ID=<your run ID>;curl-X'GET' \"https://api.allium.so/api/v1/explorer/query-runs/{RUN_ID}/status" \-H'accept: application/json' \-H"X-API-KEY: ${API_KEY}"
You will get back the current status of your query run. Keep polling to check for the status of your query run until it becomes success. If it becomes failed or canceled, your query run did not succeed and you will have to try again. Learn about statuses here. If your query failed, you can retrieve the error message by running:
Ensure that you have replaced query_id with your query ID and api_key with your API key.
Add the "limit" field to "run_config" allows you to increase your query's row limit. By default, the limit is set to 10000. To increase it beyond that, use the limit field. With Explorer API, the max limit allowed is 250000.
If you have any parameter fields in your query, add them to the parameters field of the POST request body.
If you request was successful, your query will now be running asynchronously and you will get a response with your query run ID, for example:
{ "run_id":"c7UViykJloFAUY2pwFjd" }
Keep this query run ID for the next step.
4. Check your query run status
Next, we want to check for the status of your query run using the query run ID returned in the previous step to identify your query run:
The return response will indicate the current status of your query. Possible values are: created, queued, running, success, failed, canceled. When your query run status is success, your query run has successfully completed and you may retrieve the query run's results.
5. Retrieve your query run results
Finally, we want to retrieve the results of the query run. To do so:
The response will contain your query run results formatted as JSON data.
With these simple steps, you can start exploring blockchain data and extracting valuable insights using our Explorer API. To learn more about Explorer API, check out the other sections or take a look at the OpenAPI docs. We look forward to seeing what you'll build with our API!
Questions?
If any questions remain after this guide on how to get started, connect to our APIs, or retrieve specific data you have in mind, feel free to reach out to support@allium.so at any time.