Direct Shreds - 快速入門
安裝 SLV
bash
curl -fsSL https://storage.slv.dev/slv/install | shcurl -fsSL https://storage.slv.dev/slv/install | sh$ slv b init

只需一條命令
slv b init,即可立即搭建基於高效能流資料的 Solana 機器人開發環境。bash
slv b initslv b init- 如果您偏好基於 TypeScript 的 Shreds 機器人,請選擇
shreds-ts - 如果您偏好利用 Shreds 的 Rust 機器人,請選擇
shreds-rust
將 Shreds 負載均衡器 IP 加入白名單
我們使用每個區域 Shreds 負載均衡器的實時 ping 檢測,選擇距離您註冊 IP 最近的節點。如果防火牆(ufw、安全組等)阻止了 ICMP,ping 結果可能變為
9999ms,這可能導致無法選擇最佳的就近區域。請將以下 IP 加入白名單,以便自動使用最近的區域。| 區域 | 域名 | IP 地址 |
|---|---|---|
| 🇳🇱 阿姆斯特丹 | shreds-ams6-1.erpc.global | 64.130.43.108 |
| 🇩🇪 法蘭克福 | shreds-fra6-1.erpc.global | 64.130.41.236 |
| 🇬🇧 倫敦 | shreds-lon6-1.erpc.global | 64.130.63.211 |
| 🇮🇪 都柏林 | shreds-dub6-1.erpc.global | 82.40.61.2 |
| 🇺🇸 紐約 | shreds-ny6-1.erpc.global | 64.130.37.235 |
| 🇺🇸 芝加哥 | shreds-chi-2.erpc.global | 84.32.71.34 |
| 🇺🇸 鹽湖城 | shreds-slc6-1.erpc.global | 72.244.154.7 |
| 🇸🇬 新加坡 | shreds-sgp6-1.erpc.global | 67.209.55.19 |
| 🇯🇵 東京 | shreds-ty6-1.erpc.global | 198.13.133.89 |
Shreds 客戶端示例 - TypeScript
- 將
.env.sample檔案重新命名為.env。 - 使用您的實際端點更新
.env檔案中的值:
ini
SHREDS_ENDPOINT=http://shreds-ams6-1.erpc.global
SOLANA_RPC_ENDPOINT="https://edge.erpc.global?api-key=YOUR_API_KEY"SHREDS_ENDPOINT=http://shreds-ams6-1.erpc.global
SOLANA_RPC_ENDPOINT="https://edge.erpc.global?api-key=YOUR_API_KEY"⚠️ **重要提示:**此端點僅作為示例提供,不能直接使用。請獲取並設定您的實際端點。
- 安裝依賴並執行指令碼:
bash
pnpm i
pnpm devpnpm i
pnpm dev
Shreds 客戶端示例 - Rust
- 將
.env.sample重新命名為.env - 使用您的實際 Shreds 端點編輯
.env:
ini
SHREDS_ENDPOINT=http://shreds-ams6-1.erpc.global
SOLANA_RPC_ENDPOINT="https://edge.erpc.global?api-key=YOUR_API_KEY"SHREDS_ENDPOINT=http://shreds-ams6-1.erpc.global
SOLANA_RPC_ENDPOINT="https://edge.erpc.global?api-key=YOUR_API_KEY"請注意:
此端點為示例,不能直接使用。請獲取並配置適合您環境的端點。
- 構建並執行客戶端:
bash
RUST_LOG=info cargo runRUST_LOG=info cargo run
✅ 提供 1 天免費試用
Shreds 端點可透過 ERPC Web 儀表盤 官方伺服器免費試用 1 天。
Solana Stream SDK

透過
slv b init 命令下載的 Shreds 啟動程式碼中包含的客戶端實現
由開源專案 Solana Stream SDK 提供支援。該 SDK 同時支援 Rust 和 TypeScript,能夠高效處理 Solana 的直接通訊層——
包括 Shreds 訂閱、資料包解析和交易提取。
使用此 SDK,您可以立即開始 Shreds 流開發。
slv b init 生成的啟動程式碼可作為實用模板,供您在此基礎上構建自己的應用。更多詳情請訪問 GitHub 倉庫:
https://github.com/ValidatorsDAO/solana-stream