Overview
In this quickstart, you’ll create a simple Turbo pipeline that:- Reads ERC-20 transfer data from a Goldsky dataset
- Writes the results to a blackhole sink
- Inspect the data live
- [Optional] Write the data into a PostgreSQL Database
Prerequisites
- Turbo Pipelines CLI extension installed
- A Goldsky account with access to Turbo pipelines, logged in to your project
Step 1: Create Your Pipeline
Create a file namederc20-pipeline.yaml:
erc20-pipeline.yaml
What's happening in this pipeline?
What's happening in this pipeline?
Sources:
- We’re using the
base.erc20_transfersdataset (version 1.2.0) start_at: latestmeans we’ll only process new transfers going forward
- The
blackholesink discards the data but allows you to test the pipeline - Perfect for development and testing before adding real outputs
Step 2: Deploy Your Pipeline
Apply your pipeline configuration:Step 3: Inspect the Data Live
Now that the pipeline is running, you can replace erc20-pipeline.yaml with the name of the pipeline
erc20-transfers if desiredStep 4: Add a Filter for USDC Only
Now let’s add a SQL transform to filter only USDC transfers. Update yourerc20-pipeline.yaml:
erc20-pipeline.yaml
What changed?
What changed?
Transforms:
- Added a SQL transform named
usdc_transfersthat filters for the USDC contract on Base - The contract address
0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913is USDC on Base - We use
lower()to ensure consistent case-insensitive matching - Selected only essential columns:
sender,recipient,amount, andblock_time - Converted the Unix timestamp to a human-readable format using
to_timestamp()
- Updated the sink to read from
usdc_transfersinstead of the raw source - Now only USDC transfers will flow through the pipeline
Alternative: Using TypeScript Transform
Alternative: Using TypeScript Transform
You can achieve the same filtering using a TypeScript transform instead of SQL. Return Key features:
null to filter out records:- Return
nullto filter: Records that don’t match your criteria can be filtered out by returningnull - Custom output schema: Use the
schemafield to define a different output schema than the input. This lets you reshape data, rename fields, or include only specific columns - Flexible transformations: Perform calculations, string manipulation, and conditional logic
- More flexible data transformations and complex logic
- Familiar syntax for developers
- Type safety and autocompletion support
- Can perform calculations, string manipulation, and conditional logic
- Generally faster for simple filtering and aggregations
- More concise for straightforward queries
- Better for set-based operations
Redeploy and Inspect
Apply the updated configuration:usdc_transfers.
Optional: Write to PostgreSQL
To persist your data to a PostgreSQL database, update your pipeline configuration:1. Create a Secret
Store your PostgreSQL credentials:2. Update Your Pipeline
Modifyerc20-pipeline.yaml to add a PostgreSQL sink:
erc20-pipeline.yaml
3. Redeploy
Apply the updated configuration:4. Query Your Data
Connect to PostgreSQL and query the USDC transfers:What You’ve Learned
Using Datasets as Sources
Using Datasets as Sources
Datasets provide pre-indexed blockchain data without managing Kafka topics. They’re the easiest way to get started with Turbo Pipelines.
Blackhole Sink for Testing
Blackhole Sink for Testing
The blackhole sink is perfect for testing pipelines and understanding data flow before adding real destinations.
PostgreSQL Sink
PostgreSQL Sink
PostgreSQL sinks automatically create tables based on your data schema, reducing manual setup.
Pipeline Updates
Pipeline Updates
You can easily modify and redeploy pipelines by updating your YAML configuration and running
goldsky turbo apply.