Datasets uses the production gateway. This stack's keys are refused there; use a project from app.pinax.network. The examples always show the production endpoint.
Connect with S3
The default way to read Datasets: point any S3 client or query engine at the endpoint and sign with your Pinax Project ID and API key. Run these examples locally or on your server.
Connection details
- Endpoint
https://datasets.s3.pinax.network- Region
us-east-1- Bucket
eth, base, bsc- Addressing
Path style
Loading your project…
Examples use placeholders. Find your Project ID and API key on the API keys page.
- Access key ID = Project ID
<your Pinax Project ID>- Secret access key = API key
<your Pinax API key>
Putting the API key in the Access key ID field reverses the mapping and returns 403 unauthenticated.
DuckDB example
DuckDB 1.5 or newer
1-- DuckDB 1.5 or newer. Your Pinax Project ID is the S3 access key,2-- your Pinax API key the secret.3INSTALL delta; LOAD delta;4CREATE SECRET pinax (5 TYPE s3,6 KEY_ID '<your Pinax Project ID>',7 SECRET '<your Pinax API key>',8 REGION 'us-east-1',9 ENDPOINT 'datasets.s3.pinax.network',10 URL_STYLE 'path'11);1213-- To keep the key out of SQL and history, export AWS_ACCESS_KEY_ID (Project ID)14-- and AWS_SECRET_ACCESS_KEY (API key) before starting DuckDB, then:15-- INSTALL aws; LOAD aws;16-- CREATE SECRET pinax (TYPE s3, PROVIDER credential_chain, CHAIN 'env',17-- REGION 'us-east-1', ENDPOINT 'datasets.s3.pinax.network', URL_STYLE 'path');1819-- Read through the Delta log, filtered by date.20SELECT block_num, block_id, timestamp, num_transactions21FROM delta_scan('s3://eth/blocks')22WHERE date = DATE '2020-01-01'23ORDER BY block_num24LIMIT 10;
Python example
Polars for Delta reads; boto3 for listing
1# export PINAX_PROJECT_ID=<your Pinax Project ID> PINAX_API_KEY=<your Pinax API key>2import datetime3import os45import polars as pl67storage = {8 "aws_endpoint_url": "https://datasets.s3.pinax.network",9 "aws_region": "us-east-1",10 "aws_access_key_id": os.environ["PINAX_PROJECT_ID"],11 "aws_secret_access_key": os.environ["PINAX_API_KEY"],12 "aws_virtual_hosted_style_request": "false",13}1415# Read through the Delta log, filtered by date.16blocks = (17 pl.scan_delta("s3://eth/blocks", storage_options=storage)18 .filter(pl.col("date") == datetime.date(2020, 1, 1))19 .select("block_num", "block_id", "timestamp", "num_transactions")20 .head(10)21 .collect()22)23print(blocks)2425# boto3: list under a table (with its trailing slash) or fetch one file.26import boto327from botocore.config import Config2829s3 = boto3.client(30 "s3",31 endpoint_url="https://datasets.s3.pinax.network",32 region_name="us-east-1",33 aws_access_key_id=os.environ["PINAX_PROJECT_ID"],34 aws_secret_access_key=os.environ["PINAX_API_KEY"],35 config=Config(36 s3={"addressing_style": "path"},37 request_checksum_calculation="when_required",38 response_checksum_validation="when_required",39 ),40)41listing = s3.list_objects_v2(Bucket="eth", Prefix="blocks/_delta_log/", MaxKeys=5)42print([o["Key"] for o in listing.get("Contents", [])])
AWS CLI example
AWS CLI, using a dedicated profile
1# A dedicated profile: Access Key ID = your Pinax Project ID,2# Secret Access Key = your Pinax API key, region us-east-1.3aws configure --profile pinax4aws configure set profile.pinax.s3.addressing_style path5export AWS_PROFILE=pinax6PINAX_S3=https://datasets.s3.pinax.network78# List a table, with its trailing slash (a bucket's root can't be listed)9aws s3 ls s3://eth/blocks/ --endpoint-url $PINAX_S310aws s3 ls s3://eth/blocks/_delta_log/ --endpoint-url $PINAX_S3 | tail -51112# Download one file.13aws s3 cp s3://eth/blocks/_delta_log/_last_checkpoint . --endpoint-url $PINAX_S31415# A date folder can also hold files that compaction replaced: read tables16# through their Delta log (DuckDB delta_scan, Polars scan_delta), not with aws s3 sync.
Node.js example
AWS SDK v3, on your server
1// Node.js only: keep your API key on the server. Browser downloads use presigned URLs.2import { S3Client, ListObjectsV2Command } from "@aws-sdk/client-s3";34const s3 = new S3Client({5 endpoint: "https://datasets.s3.pinax.network",6 region: "us-east-1",7 forcePathStyle: true,8 credentials: {9 accessKeyId: process.env.PINAX_PROJECT_ID, // your Pinax Project ID10 secretAccessKey: process.env.PINAX_API_KEY, // your Pinax API key11 },12 requestChecksumCalculation: "WHEN_REQUIRED",13 responseChecksumValidation: "WHEN_REQUIRED",14});1516// List under a table, with its trailing slash (a bucket's root can't be listed)17const { Contents = [] } = await s3.send(18 new ListObjectsV2Command({ Bucket: "eth", Prefix: "blocks/_delta_log/", MaxKeys: 5 }),19);20console.log(Contents.map((object) => object.Key));
Python and Node.js read credentials from environment variables. Run the commented export line in your shell before starting the example. Keep credentials out of shared files and shell history.
To let a query engine discover tables through the catalog, see Connect with Iceberg. To hand one file to a browser or to someone without your API key, see Presigned URLs.