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

# Solana データストリーミング クイックスタート

> 5分以内にリアルタイムのSolanaデータストリームを実行します。LaserStream gRPC、LaserStream WebSocket、およびWebhookの設定ガイド。

## クイックセットアップ

実際のコード例を使用して数分でSolanaデータをストリーミングします。ニーズに基づいてアプローチを選択してください（最速から最遅順）：

| 方法                       | 最適な用途                                           | 必要なプラン                                              |
| ------------------------ | ----------------------------------------------- | --------------------------------------------------- |
| **\[Pre Confirmations]** | propAMMs、スナイパー、コピートレーダー、清算ボット — 最速のトランザクションシグナル | Professional+                                       |
| **Shred Delivery**       | propAMMs、スナイパー、コピートレーダー、清算ボット、アービトラージ — 実行前データ  | すべてのプラン（[有料アドオン](/ja/billing/plans#shred-delivery)） |
| **LaserStream gRPC**     | 重要なミッションクリティカルなバックエンドサービス                       | すべてのプラン（Devnet）、Business+（Mainnet）                  |
| **LaserStream WSS**      | ほとんどのアプリ、リアルタイムUI、幅広い互換性                        | Free+（Helius拡張機能: Developer+）                       |
| **Webhooks**             | サーバ通知、イベント駆動アプリ                                 | Free+                                               |

<Tip>
  生のシュレッドが必要ですか？Heliusダッシュボードの[Shredsタブ](https://dashboard.helius.dev/shred-delivery-seats)から購読してください。[How to Subscribe to Raw Shreds](/ja/shred-delivery/raw-shreds)を参照して、セットアップ手順を確認してください。
</Tip>

## オプション 1: LaserStream gRPC

[24時間の履歴再生](/ja/laserstream/historical-replay)とマルチノードフェイルオーバーを備えた最も信頼性の高いオプション。ミッションクリティカルなバックエンドやインデクサーに最適です。

```bash theme={"system"}
npm install helius-laserstream
```

```typescript theme={"system"}
import {
  subscribe,
  CommitmentLevel,
  LaserstreamConfig,
  SubscribeRequest,
} from "helius-laserstream";

async function main() {
  const subscriptionRequest: SubscribeRequest = {
    transactions: {
      "token-filter": {
        // user-defined label for this filter
        accountInclude: ["TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"],
        accountExclude: [],
        accountRequired: [],
        vote: false,
        failed: false,
      },
    },
    commitment: CommitmentLevel.CONFIRMED,
    accounts: {},
    slots: {},
    transactionsStatus: {},
    blocks: {},
    blocksMeta: {},
    entry: {},
    accountsDataSlice: [],
  };

  const config: LaserstreamConfig = {
    apiKey: "YOUR_API_KEY",
    endpoint: "https://laserstream-mainnet-ewr.helius-rpc.com",
  };

  await subscribe(
    config,
    subscriptionRequest,
    async (data) => {
      console.log(data);
    },
    async (error) => {
      console.error(error);
    },
  );
}

main().catch(console.error);
```

<CardGroup cols={2}>
  <Card title="LaserStream ガイド" icon="book" href="/ja/laserstream">
    履歴再生を含む完全なLaserStreamドキュメント
  </Card>

  <Card title="開始する" icon="arrow-right" href="https://dashboard.helius.dev/laserstream">
    LaserStream gRPCトークンとエンドポイントをHeliusダッシュボードで取得
  </Card>
</CardGroup>

## オプション 2: LaserStream WebSocket

[LaserStream WebSocket](/ja/rpc/websocket)は、[標準のSolanaサブスクリプションメソッド](/ja/api-reference/rpc/websocket-methods)と、`transactionSubscribe`などのHelius拡張機能を単一の統一エンドポイントで提供します。ブラウザ/UIクライアントや幅広いエコシステム互換性に最適です。

```javascript theme={"system"}
const WebSocket = require("ws");

const ws = new WebSocket("wss://mainnet.helius-rpc.com/?api-key=YOUR_API_KEY");

ws.on("open", () => {
  console.log("WebSocket connected");

  // Helius extension: transactionSubscribe with rich filtering
  ws.send(
    JSON.stringify({
      jsonrpc: "2.0",
      id: 1,
      method: "transactionSubscribe",
      params: [
        {
          accountInclude: ["TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"],
          vote: false,
          failed: false,
        },
        {
          commitment: "confirmed",
          encoding: "jsonParsed",
          transactionDetails: "full",
        },
      ],
    }),
  );

  // Keep connection alive
  setInterval(() => ws.ping(), 30000);
});

ws.on("message", (data) => {
  const message = JSON.parse(data);
  console.log("Transaction:", message);
});
```

\*\*`YOUR_API_KEY`\*\*を[dashboard.helius.dev](https://dashboard.helius.dev)からのキーに置き換えてください。

<Card title="LaserStream WebSocket 概要" icon="arrow-right" href="/ja/rpc/websocket">
  すべてのサブスクリプションメソッド（標準のSolana + Helius拡張機能）をパラメータリファレンスと例と共に
</Card>

## オプション 3: Webhooks

永続的な接続を保持せずにイベント通知を必要とするサーバーサイドアプリケーション用。

```bash theme={"system"}
# Create a webhook
curl -X POST "https://mainnet.helius-rpc.com/v0/webhooks" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "webhookURL": "https://your-server.com/webhook",
    "transactionTypes": ["Any"],
    "accountAddresses": ["YOUR_ACCOUNT_ADDRESS"],
    "webhookType": "enhanced"
  }'
```

```javascript theme={"system"}
// Handle webhook events (Express.js example)
app.post("/webhook", (req, res) => {
  req.body.forEach((event) => {
    console.log("Blockchain event:", event);
  });
  res.status(200).send("OK");
});
```

<Card title="Webhooks ガイド" icon="arrow-right" href="/ja/webhooks">
  完全なWebhookのセットアップとイベント処理
</Card>

## 一般的なユースケース

**トークン転送を監視**

```javascript theme={"system"}
// Subscribe to Token Program activity
method: "programSubscribe",
params: ["TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA", {...}]
```

**Pump.funの取引を追跡**

```javascript theme={"system"}
// Subscribe to Pump.fun program transactions
method: "transactionSubscribe",
params: [
  {
    accountInclude: ["6EF8rrecthR5Dkzon8Nwu78hRvfCKubJ14M5uBEwF6P"],
    vote: false,
    failed: false
  },
  { commitment: "confirmed" }
]
```

**ウォレットアクティビティを監視**

```javascript theme={"system"}
// Monitor specific wallet
method: "accountSubscribe",
params: ["WALLET_ADDRESS", {...}]
```

## 次のステップ

<CardGroup cols={2}>
  <Card title="ストリーミング概要" icon="play" href="/ja/data-streaming">
    すべてのストリーミングオプションとそれぞれを使用するタイミングについて学ぶ
  </Card>

  <Card title="API リファレンス" icon="book" href="/ja/api-reference">
    完全なメソッドドキュメントとパラメータ
  </Card>
</CardGroup>

**お手伝いが必要ですか？** [Discord](https://discord.com/invite/6GXdee3gBj)に参加するか、[サポートドキュメント](/ja/support)を確認してください。
