Indexing Ink with Goldsky
Overview
Goldsky is a high-performance data indexing provider for Ink that makes it easy to extract, transform, and load on-chain data to power both application and analytics use cases. Goldsky offers two primary approaches to indexing and accessing blockchain data: Subgraphs (high-performance subgraphs) and Mirror (real-time data replication pipelines).
Scope
Goldsky has partnered with Ink to make our product available to the ecosystem and provide dedicated support for Ink data indexing. The full scope of our partnership (which products are enabled, what partner-exclusive benefit is available, and who this benefit is available to) is outlined below.
Subgraphs | Mirror | |
---|---|---|
Enablement | Yes | Yes |
Benefit | 100% discount on Subgraph workers and entities stored | 10% discount on Pipeline workers and events written |
Availability | Select developers | All developers |
Where perks are available to projects specified by the chain ecosystem, please reach out to their developer relations team for an access code and link to private signup form. Where perks are openly available to all developers, please contact sales@goldsky.com to apply the applicable partnership perks to your project.
Getting started
To use Goldsky, you’ll need to create an account, install the CLI, and log in.
Subgraphs
Ink Mainnet and Sepolia are available at the chain slugs ink
and ink-sepolia
respectively. Subgraphs can be deployed on Goldsky in 2 ways:
- Via CLI from a local subgraph configuration file. If you are familiar with developing subgraphs already, you'll be familiar with this approach; after defining a subgraph locally (with a
subgraph.yaml
file, aschema.graphql
file, and the necessary mappings to translate raw event data into the entities defined in the schema), you can deploy subgraphs to Goldsky (once the Goldsky CLI is installed) usinggoldsky subgraph deploy <name>/<version> --path .
For more, read the step-by-step guide. - Via instant subgraphs, where you can pass through a contract address and the ABI for that contract. This is a quick-start option that automatically generates the underlying subgraph configuration files on your behalf, making it easy to extract blockchain event data and serve it as an API endpoint without complex setup. Use the
--from-abi
flag in the command above instead of--path
. For more, read the no-code subgraphs guide.
Check out this GitHub repo to see example implementations of each deployment method using the Inko ETH (IETH) ERC-20 token on Ink Sepolia.
Mirror
Mirror pipelines allow users to replicate data into their own infrastructure (any of the supported sinks) in real time.
For a complete overview of how to deploy Mirror pipelines, including a video walkthrough, check the Create a Pipeline. Below, we will look at a few of the different ways by which you can deploy Mirror pipelines using Direct Indexing datasets for Ink Sepolia (remember that you can also use subgraphs as source to your pipelines); in specific, we’ll be streaming the ink_sepolia.receipt_transactions
direct indexing dataset into a PostgreSQL database.
Remember to first create a Secret in order for Mirror to be able to write the data into the database of your choice.
Pipelines can be deployed on Goldsky in 3 ways:
-
Using the Pipeline Builder in the Goldsky dashboard:
-
Select
Direct Indexing
as data source filter on Ink Sepolia and selectEnriched Transactions
as dataset. -
Follow the default options in the next steps and choose your pre-configured sink.
-
Deploy pipeline.
-
-
Using the interactive CLI:
-
Enter command
goldsky pipeline create <pipeline-name>
. -
This will kick off a guided flow with the first step to choose the dataset type. Choose
Direct Indexing
. -
Next, select
Ink Sepolia
as chain with the enter key, thenEnriched Transactions
as the dataset by pressing space on the selected dataset which you can select using the up and down arrow keys. We will process historical data so selectProcess all historical data
by pressing the enter key. This is the same as the yaml config setting ofstart_at: earliest
. If you prefer to only ingest data starting when your pipeline is deployed, selectProcess data from the time this pipeline is created
instead, this is equivalent to the yaml config settingstart_at: latest
. -
When asked to choose another source, choose
No
by pressing enter. -
Add your pre-configured sink. In this example case, we chose PostgreSQL and as a next step we selected the database schema.
-
Pipeline will be deployed automatically.
-
-
Using a pipeline configuration file:
-
This makes it easier to set up complex pipelines involving multiple sources, multiple sinks, and more complex, SQL-based transformations. For the full reference documentation on, click here.
-
As in the previous steps, we’ll be deploying a pipeline to stream Ink Sepolia transactions. Unlike the other methods, we have added a transformation to only select specific data attributes from the whole dataset. This is the configuration file:
-
- Add your corresponding secret name and run
goldsky pipeline apply ink-sepolia-transactions.yaml --status ACTIVE
to deploy the pipeline.
Getting support
Can't find what you're looking for? Reach out to us at support@goldsky.com for help.