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

# Track PumpFun Swaps on Solana

> Monitor PumpFun token swaps on Solana to track bonding curve activity, token launches, and graduation events.

## Use Case

You want to track PumpFun activity on Solana - token launches, swaps on bonding curves, and graduation events. This data powers trading dashboards, token launch trackers, and bonding curve analytics.

## Pipeline Configuration

<Steps>
  <Step title="Create a new pipeline">
    In the [GoldRush Platform](https://goldrush.dev/platform/), navigate to **Manage Pipelines** and click **Create Pipeline**. Name it `pumpfun-tracker`.
  </Step>

  <Step title="Configure the Postgres destination">
    Select **Postgres** as the destination type and enter your connection details:

    ```yaml theme={null}
    destination:
      type: "postgres"
      url: "postgresql://your-host:5432/solana_data"
      user: "${PG_USER}"
      password: "${PG_PASSWORD}"
      batch_size: 1000
    ```
  </Step>

  <Step title="Select your source">
    Choose **Solana** as the chain and **Pump.fun Events** as the data type. This streams all PumpFun lifecycle events: token creates, swaps, completions, and withdrawals.
  </Step>

  <Step title="Add a SQL transform (optional)">
    Filter swaps to only include specific columns:

    ```yaml theme={null}
    transforms:
      sol_pf_swap: >
        SELECT user, mint, bonding_curve, sol_amount, token_amount, direction,
               virtual_sol_reserves, virtual_token_reserves
        FROM sol_pf_swap
    ```
  </Step>

  <Step title="Deploy">
    Review and deploy. PumpFun events begin flowing to your Postgres database.
  </Step>
</Steps>

## Output Tables

The PumpFun normalizer routes events to 4 tables based on event type:

| Event        | Table             | Description                                      |
| ------------ | ----------------- | ------------------------------------------------ |
| Token Create | `sol_pf_create`   | New token launches with bonding curve parameters |
| Swap         | `sol_pf_swap`     | Buy/sell swaps on the bonding curve              |
| Complete     | `sol_pf_complete` | Bonding curve graduation (migration to DEX)      |
| Withdraw     | `sol_pf_withdraw` | Liquidity withdrawals                            |

## Verify Data

```sql theme={null}
-- Recent swaps
SELECT mint, direction, sol_amount, token_amount, virtual_sol_reserves
FROM pumpfun_tracker.sol_pf_swap
ORDER BY sol_amount DESC
LIMIT 20;
```

## Sample Analytical Queries

**Most traded tokens by swap count:**

```sql theme={null}
SELECT mint, count(*) AS swap_count,
       sum(CASE WHEN direction = 'buy' THEN 1 ELSE 0 END) AS buys,
       sum(CASE WHEN direction = 'sell' THEN 1 ELSE 0 END) AS sells
FROM pumpfun_tracker.sol_pf_swap
GROUP BY mint
ORDER BY swap_count DESC
LIMIT 20;
```

**Tokens that graduated (completed bonding curve):**

```sql theme={null}
SELECT c.mint, c.bonding_curve, cr.name, cr.symbol
FROM pumpfun_tracker.sol_pf_complete c
JOIN pumpfun_tracker.sol_pf_create cr ON c.mint = cr.mint
ORDER BY cr.name;
```

**Bonding curve progression for a specific token:**

```sql theme={null}
SELECT direction, sol_amount, token_amount,
       virtual_sol_reserves, virtual_token_reserves
FROM pumpfun_tracker.sol_pf_swap
WHERE mint = 'your-token-mint-address'
ORDER BY virtual_sol_reserves;
```

## Production Tips

* **All 4 tables** receive data from a single pipeline. You do not need separate pipelines for creates, swaps, and completions.
* **Bonding curve math**: The `virtual_sol_reserves` and `virtual_token_reserves` fields track the bonding curve state after each swap. Use these to reconstruct price curves.
* **High volume**: PumpFun generates significant swap volume. Consider using ClickHouse instead of Postgres if you need to run analytical queries over millions of swaps.
