Skip to main content
This guide walks you through exporting every event a contract emits into a Postgres database with a Turbo pipeline. You’ll define the pipeline in YAML and deploy it with the Turbo CLI.
Prefer a visual editor? You can build the same pipeline by dragging sources, transforms, and sinks onto a canvas with Goldsky Flow in the dashboard.

What you’ll need

  1. An idea of the data you’re interested in indexing (e.g. a contract address)
  2. A destination sink to write your data to; any Postgres database works, for example a Neon instance
  3. The Turbo Pipelines CLI extension installed and a Goldsky account, logged in to your project

Walkthrough

In this example, we will create a pipeline that indexes Bored Ape Yacht Club contract events to a Postgres database. This will include all transfers and other auxiliary events emitted by that address, using the Ethereum raw logs dataset as the source and decoding the events in a SQL transform.
1

Create a secret

Store your Postgres credentials as a secret so the pipeline can connect to your database:
When prompted, enter your Postgres connection string:
See managing secrets for details. If you already have a secret, find its name with goldsky secret list.
2

Define the pipeline

Create a file named bored-ape-events.yaml:
bored-ape-events.yaml
A quick tour of the pipeline:
  • Source: the ethereum.raw_logs dataset streams every event log on Ethereum. start_at: latest processes data from the time the pipeline is created; use start_at: earliest with a source-level filter on the contract address to backfill history via fast scan.
  • Transforms: the first transform filters to the BAYC contract address and decodes each log with _gs_log_decode, fetching the ABI from Etherscan with _gs_fetch_abi (replace YOUR_KEY with your own Etherscan API key). The second transform unnests the decoded event name and parameters. For a deeper explanation of this decoding pattern, see Decode contract events.
  • Sink: writes the decoded events to the public.bored_ape_events table, creating it automatically on first write. Change schema and table if you prefer different names.
If you only care about NFT transfers, skip the decoding entirely and use the curated ethereum.erc721_transfers dataset as your source; see EVM sources.
3

Validate and deploy

Check the configuration, then deploy:
Pass -i to apply to open the live inspect TUI right after deployment and watch events flow through each step.
4

Monitor the pipeline

Upon successful completion of these steps, an active pipeline is created and data should start appearing in your database shortly. To check on it at any time:
5

Query your data

Connect to your Postgres database and query the decoded events:
6

Explore

For a full list of all available commands, use:
Or browse the Turbo CLI reference.
Can’t find what you’re looking for? Reach out to us at support@goldsky.com for help.