Skip to main content

Community Data

The Spice.ai Cloud Platform includes a comprehensive set of free, ready-to-query sample and blockchain datasets.

The Spice runtime can query these datasets using the Spice.ai Data Connector.

Quickstart​

To access these community datasets, navigate to spice.ai, and create a new account by clicking Try for Free.

spiceai_try_for_free-1

After logging in, create an app in order to get an API key.

create_app-1

This quickstart will use the eth.recent_blocks dataset.

Step 1. Initialize a new project:

# Initialize a new Spice app
spice init spice_app

# Change to app directory
cd spice_app

Step 2. Log in to the Spice Cloud Platform from the command line using the spice login command. A pop up browser window will prompt you to authenticate:

spice login

Logging in will create or update a .env file in the project directory with the API key.

Step 3. Start the runtime:

# Start the runtime
spice run

Step 4. Configure the dataset:

In a new terminal window, configure a new dataset using the spice dataset configure command:

spice dataset configure

Enter a dataset name that will be used to reference the dataset in queries. This name does not need to match the name in the dataset source.

dataset name: (spice_app) eth_recent_blocks

Enter the description of the dataset:

description: Recent Ethereum blocks

Enter the location of the dataset:

from: spice.ai/eth.recent_blocks

Select y when prompted whether to accelerate the data:

Locally accelerate (y/n)? y

You should see the following output from your runtime terminal:

2024-05-20T22:50:17.997446Z  INFO runtime: Registered dataset eth_recent_blocks
2024-05-20T22:50:17.998125Z INFO runtime::accelerated_table::refresh: Loading data for dataset eth_recent_blocks

Step 5. In a new terminal window, use the Spice SQL REPL to query the dataset

spice sql
SELECT number, size, gas_used from eth_recent_blocks LIMIT 10;

The output displays the results of the query along with the query execution time:

+----------+--------+----------+
| number | size | gas_used |
+----------+--------+----------+
| 19281345 | 400378 | 16150051 |
| 19281344 | 200501 | 16480224 |
| 19281343 | 97758 | 12605531 |
| 19281342 | 89629 | 12035385 |
| 19281341 | 133649 | 13335719 |
| 19281340 | 307584 | 18389159 |
| 19281339 | 89233 | 13391332 |
| 19281338 | 75250 | 12806684 |
| 19281337 | 100721 | 11823522 |
| 19281336 | 150137 | 13418403 |
+----------+--------+----------+

Query took: 0.004057791 seconds

You can experiment with the time it takes to generate queries when using non-accelerated datasets. You can change the acceleration setting from true to false in the datasets.yaml file.