> ## Documentation Index
> Fetch the complete documentation index at: https://docs.goldsky.com/llms.txt
> Use this file to discover all available pages before exploring further.

# NEAR Sources

> Build real-time pipelines with NEAR blockchain data

## Overview

Goldsky provides curated NEAR Protocol datasets covering blocks, transactions, receipts, and execution outcomes. NEAR data is pulled from chunks across all shards and flattened into per-row datasets for indexing.

<Note>
  **Turbo only**: NEAR datasets are exclusively available on Turbo. They are not supported in Mirror v1 pipelines.
</Note>

## Available datasets

| Dataset                   | Mainnet | Description                                                               |
| ------------------------- | ------- | ------------------------------------------------------------------------- |
| `near.blocks`             | v1.0.0  | Block-level data from the NEAR blockchain                                 |
| `near.receipts`           | v1.1.0  | Receipts created during execution of transactions                         |
| `near.transactions`       | v1.1.0  | Transactions pulled from chunks as found on the NEAR blockchain           |
| `near.execution_outcomes` | v1.1.0  | Execution outcomes generated from both transaction and receipt executions |

## Quick start

The fastest way to explore NEAR data is using a `blackhole` sink with `goldsky turbo inspect`:

```yaml theme={null}
name: demo-near-receipts-blackhole
resource_size: s

sources:
  near_receipts:
    type: dataset
    dataset_name: near.receipts
    version: 1.1.0
    start_at: latest

sinks:
  dev_sink:
    type: blackhole
    from: near_receipts
```

```bash theme={null}
goldsky turbo apply demo.yaml
goldsky turbo inspect demo-near-receipts-blackhole
```

## Guide: Track failed execution outcomes

Build a debugging dashboard by filtering execution outcomes to only capture failures:

```yaml theme={null}
name: near-execution-outcomes-failures
resource_size: s

sources:
  execution_outcomes:
    type: dataset
    dataset_name: near.execution_outcomes
    version: 1.1.0
    start_at: latest

transforms:
  failed_executions:
    type: sql
    primary_key: id
    sql: |
      SELECT
        id,
        block_hash,
        executor_id,
        status,
        gas_burnt,
        tokens_burnt,
        logs
      FROM execution_outcomes
      WHERE status <> 'SUCCESS'

sinks:
  postgres_output:
    type: postgres
    from: failed_executions
    schema: public
    table: failed_execution_outcomes
    secret_name: MY_POSTGRES_SECRET
    primary_key: id
```

The `id` field on execution outcomes is either the receipt ID or the transaction hash, depending on whether the outcome was produced by a receipt or the top-level transaction.

## Guide: Monitor transactions for a specific account

Track all transactions involving a particular NEAR account:

```yaml theme={null}
name: near-account-transactions
resource_size: s

sources:
  near_transactions:
    type: dataset
    dataset_name: near.transactions
    version: 1.1.0
    start_at: latest

transforms:
  account_transactions:
    type: sql
    primary_key: id
    sql: |
      SELECT *
      FROM near_transactions
      WHERE receiver_id = 'epic.poolv1.near'
        OR signer_id = 'epic.poolv1.near'

sinks:
  postgres_output:
    type: postgres
    from: account_transactions
    schema: public
    table: near_account_transactions
    secret_name: MY_POSTGRES_SECRET
    primary_key: id
```

## Performance tips

<AccordionGroup>
  <Accordion title="Filter early with SQL">
    NEAR produces high volumes of receipts and execution outcomes. Apply filters as early as possible to reduce data volume:

    ```yaml theme={null}
    transforms:
      filtered:
        type: sql
        sql: SELECT * FROM near_receipts WHERE receiver_id = 'wrap.near'
    ```
  </Accordion>

  <Accordion title="Use appropriate resource sizes">
    NEAR mainnet has high throughput. For historical backfills, consider medium or large resource sizes:

    ```yaml theme={null}
    resource_size: m  # or l for large historical backfills
    ```
  </Accordion>

  <Accordion title="Start with latest for development">
    When building and testing pipelines, use `start_at: latest` to avoid processing large amounts of historical data:

    ```yaml theme={null}
    start_at: latest  # Only process new data
    ```
  </Accordion>
</AccordionGroup>

For any questions or feedback, reach out at [support@goldsky.com](mailto:support@goldsky.com).
