# Table of Contents - [Endpoints and Configs | Astralane](#endpoints-and-configs-astralane) - [欢迎来到 Astralane | Astralane](#-astralane-astralane) - [快速上手 | Astralane](#-astralane) - [更新日志 | Astralane](#-astralane) - [提交交易 | Astralane](#-astralane) - [发送交易 V2 | Astralane](#-v2-astralane) - [端点与配置 | Astralane](#-astralane) - [附加优化 | Astralane](#-astralane) - [概览 | Astralane](#-astralane) - [小费返还 | Astralane](#-astralane) - [认证 | Astralane](#-astralane) - [DEX 流动性池接口 | Astralane](#dex-astralane) - [我们的产品 | Astralane](#-astralane) - [最新Dex流动性池接口 | Astralane](#-dex-astralane) - [K线OHLCV接口 | Astralane](#k-ohlcv-astralane) - [Websocket - 代币价格 | Astralane](#websocket-astralane) - [交易数据 - Dex 交易 | Astralane](#-dex-astralane) - [PnL 索引器 | Astralane](#pnl-astralane) - [Welcome to Astralane | Astralane](#welcome-to-astralane-astralane) - [前 100 代币持有者 | Astralane](#-100-astralane) - [钱包盈亏接口 | Astralane](#-astralane) - [Changelogs | Astralane](#changelogs-astralane) - [高收益钱包 | Astralane](#-astralane) - [历史代币价格接口 | Astralane](#-astralane) - [QuickStart | Astralane](#quickstart-astralane) - [Tip Refunds | Astralane](#tip-refunds-astralane) - [代币价格接口 | Astralane](#-astralane) - [Pro Tips | Astralane](#pro-tips-astralane) - [历史代币余额索引器 | Astralane](#-astralane) - [QUIC Transaction Submission | Astralane](#quic-transaction-submission-astralane) - [Send in Plain Text | Astralane](#send-in-plain-text-astralane) - [Send in Binary | Astralane](#send-in-binary-astralane) - [交易索引器 | Astralane](#-astralane) - [WebSocket Transaction Submission | Astralane](#websocket-transaction-submission-astralane) - [Shreds | Astralane](#shreds-astralane) - [Submit Transactions | Astralane](#submit-transactions-astralane) - [快速上手 | Astralane](#-astralane) --- # Endpoints and Configs | Astralane [hashtag](https://astralane.gitbook.io/docs/low-latency/endpoints-and-configs#endpoints) Endpoints ------------------------------------------------------------------------------------------------------- Iris **Transaction Sending Endpoints**: * Global Edge Endpoint : [https://edge.astralane.io/iris?api-key=xxxxarrow-up-right](https://edge.astralane.io/iris?api-key=xxxx) * Frankfurt (Recommended): [http://fr.gateway.astralane.io/iris?api-key=xxxxarrow-up-right](https://fr.gateway.astralane.io/iris?api-key=xxxx) * IPv4 : 185.191.117.97 * Frankfurt: [http://fr2.gateway.astralane.io/iris?api-key=xxxxarrow-up-right](https://fr2.gateway.astralane.io/iris?api-key=xxxx) * IPv4 : 45.139.132.160 * San Francisco: [http://la.gateway.astralane.io/iris?api-key=xxxxarrow-up-right](https://la.gateway.astralane.io/iris?api-key=xxxx) * IPv4 : 74.118.142.151 * Tokyo: [http://jp.gateway.astralane.io/iris?api-key=xxxxarrow-up-right](http://jp.gateway.astralane.io/iris?api-key=xxxx) * IPv4 : 189.1.164.31 * New York: [http://ny.gateway.astralane.io/iris?api-key=xxxxarrow-up-right](http://ny.gateway.astralane.io/iris?api-key=xxxx) * IPv4 : 64.130.45.19 * Amsterdam (Recommended): [http://ams.gateway.astralane.io/iris?api-key=xxxxarrow-up-right](http://ams.gateway.astralane.io/iris?api-key=xxxx) * IPv4 : 64.130.43.43 * Amsterdam 2: [http://ams2.gateway.astralane.io/iris?api-key=xxxxarrow-up-right](http://ams2.gateway.astralane.io/iris?api-key=xxxx) * IPv4 : 84.32.186.73 (Cherry Servers) * Limburg: [http://lim.gateway.astralane.io/iris?api-key=xxxxarrow-up-right](http://lim.gateway.astralane.io/iris?api-key=xxxx) * IPv4 : 162.19.222.232 * Singapore: [http://sg.gateway.astralane.io/iris?api-key=xxxxarrow-up-right](http://sg.gateway.astralane.io/iris?api-key=xxxx) * IPv4 : 67.209.54.176 * Lithuania: [http://lit.gateway.astralane.io/iris?api-key=xxxxarrow-up-right](http://lit.gateway.astralane.io/iris?api-key=xxxx) * IPv4 : 84.32.97.47 circle-info * Its recommended to broadcast your txns to both global edge endpoint as well as to the closest endpoint for optimal performance. * You can also use HTTPS on above endpoints. * Using an IPv4 address will be **faster** and will support QUIC. **Available calls:** * _sendTransaction_ * _sendBundle_ * _sendIdeal_ * _getNonce_ * _sendPaladin_ * _getHealth_ **Tipping Address**: * astrazznxsGUhWShqgNtAdfrzP2G83DzcWVJDxwV9bF * astra4uejePWneqNaJKuFFA8oonqCE1sqF6b45kDMZm * astra9xWY93QyfG6yM8zwsKsRodscjQ2uU2HKNL5prk * astraRVUuTHjpwEVvNBeQEgwYx9w9CFyfxjYoobCZhL * astraEJ2fEj8Xmy6KLG7B3VfbKfsHXhHrNdCQx7iGJK * astraubkDw81n4LuutzSQ8uzHCv4BhPVhfvTcYv8SKC * astraZW5GLFefxNPAatceHhYjfA1ciq9gvfEg2S47xk * astrawVNP4xDBKT7rAdxrLYiTSTdqtUr63fSMduivXK Recently Added: * AstrA1ejL4UeXC2SBP4cpeEmtcFPZVLxx3XGKXyCW6to * AsTra79FET4aCKWspPqeSFvjJNyp96SvAnrmyAxqg5b7 * AstrABAu8CBTyuPXpV4eSCJ5fePEPnxN8NqBaPKQ9fHR * AsTRADtvb6tTmrsqULQ9Wji9PigDMjhfEMza6zkynEvV * AsTRAEoyMofR3vUPpf9k68Gsfb6ymTZttEtsAbv8Bk4d * AStrAJv2RN2hKCHxwUMtqmSxgdcNZbihCwc1mCSnG83W * Astran35aiQUF57XZsmkWMtNCtXGLzs8upfiqXxth2bz * AStRAnpi6kFrKypragExgeRoJ1QnKH7pbSjLAKQVWUum * ASTRaoF93eYt73TYvwtsv6fMWHWbGmMUZfVZPo3CRU9C #### [hashtag](https://astralane.gitbook.io/docs/low-latency/endpoints-and-configs#rate-limits) **Rate Limits:** By default we provide a rate limit of 5 TPS for `Iris endpoints`. Reach out to us on telegram for additional TPS and custom rebate plans for advanced transaction senders. **Authentication:** You can attach the `api-key` as a query-parameter or as a http-header (better privacy) with key as `api_key` . #### [hashtag](https://astralane.gitbook.io/docs/low-latency/endpoints-and-configs#min-tip) **Min Tip:** * Each transaction sent to `Iris endpoints` must include a system transfer instruction to the astralane tip address, with a minimum tip of 0.00001 SOL. * For advanced txn senders we also provide flexible plans with lower/no min tips under custom pricing plan options. circle-info Please create an account to our [user portalarrow-up-right](https://portal.astralane.io/) to get access to api keys for our transaction landing service and create a ticket in [our discordarrow-up-right](https://discord.gg/2UfWGtUDtN) server. During onboarding you will be provided an API key for using the above services and rate limits will be applied according to flexible pricing plans. For custom setups for colocation and hop optimization setups, create a ticket on our discord server. [PreviousQuickStartchevron-left](https://astralane.gitbook.io/docs/low-latency/quickstart) [NextChangelogschevron-right](https://astralane.gitbook.io/docs/low-latency/endpoints-and-configs/changelogs) Last updated 23 days ago --- # 欢迎来到 Astralane | Astralane 在 Astralane,我们替你承担 Solana 基础设施的繁重工作,让你专注于创新。**我们提供全球覆盖的 RPC 与索引化数据、超高速的交易处理,以及贴合业务需求的定制化解决方案**,全面为你的项目赋能提速。 让我们打造坚实的底座,你来改变这个世界! **现在就开始你的旅程 ->** [下一页快速上手chevron-right](https://astralane.gitbook.io/docs/products-wiki-zh/di-yan-chi-jiao-yi/kuai-su-shang-shou) 最后更新于 6个月前 --- # 快速上手 | Astralane 面向 Solana 最苛刻场景的低延迟基础设施:无论是追求极致链路时延的高频交易(HFT),还是在高峰拥堵期依然需要稳定执行的做市商,我们都能满足。借助领导者路径优化与二进制优化的网状网络,我们提供亚槽级精度的数据流与传播能力。 我们还配备智能化的动态优先级系统,为关键任务自动分配更多资源,并以企业级可靠性与 7×24 小时支持做后盾。 ### [hashtag](https://astralane.gitbook.io/docs/products-wiki-zh/di-yan-chi-jiao-yi/kuai-su-shang-shou#tiao-zhuan-zhi-zhu-yao-nei-rong) 跳转至主要内容 * 端点与配置 * 交易提交 ### [hashtag](https://astralane.gitbook.io/docs/products-wiki-zh/di-yan-chi-jiao-yi/kuai-su-shang-shou#he-xin-ji-chu-she-shi) 核心基础设施 * 双中继架构:交易中继 + Shred 中继 * 通过启用 SwQoS 的直连与质押对等,直接对接验证者 * 面向高频与带小费场景的高级交易执行系统 * 全球私有光纤网络,具备动态“领导者感知”路由 * 二进制协议,尽可能降低序列化开销 ### [hashtag](https://astralane.gitbook.io/docs/products-wiki-zh/di-yan-chi-jiao-yi/kuai-su-shang-shou#xing-neng-zhi-biao) 性能指标 * 相比标准 RPC 节点,端到端时延最多可降低约 500 ms * 已处理交易回执的额外开销减少 40–50 ms * 自动重试,零丢单 * 当前槽内账户变更的实时流式推送 ### [hashtag](https://astralane.gitbook.io/docs/products-wiki-zh/di-yan-chi-jiao-yi/kuai-su-shang-shou#shi-yong-ren-qun) 适用人群 **Astralane 为以下场景提供定制化能力:** * **极速交易发送**:适合需要快速落地、多笔批量、迅速执行的 HFT 与 Searcher。 * **更高落地率**:适合在网络拥堵时仍需稳定成交的做市商与 Solver。 * **低时延数据流**:通过冗余的全球线路,提供亚槽级原始/解析交易数据,并支持基于 Shred 的早期检测。适合追求最佳信号发现与机会捕捉的机器人开发者。 * **高性价比交易架构**:按量计费,兼顾高吞吐与成本优势,提供企业级性能。 ### [hashtag](https://astralane.gitbook.io/docs/products-wiki-zh/di-yan-chi-jiao-yi/kuai-su-shang-shou#zi-yan-tpu-ke-hu-duan) 自研 TPU 客户端 不同于走常规 RPC 管线,我们采用轻量、极速的 TPU 客户端,实时跟踪领导者日程,将交易直达领导者,并利用对其质押建立的直连通道提升送达效率。 **动态路由模块** 进入我们网络的所有流量都会被精细分析,并动态路由至距离当前领导者最近的合作对等节点,充分利用分布式质押网络。专用低时延链路确保交易以最快速度传播。 **智能费率与表现分析** 通过增强型监控,我们帮助你优化交易:深入洞察交易在不同领导者下的表现、槽级时延指标、落地过程细节等,从而指导费率与路由策略。 **重试机制** 默认监听全网交易确认,并在我们侧自动重试,以提升落地成功率。也支持根据你的需求配置自定义重试逻辑。 **高优先级交易通道** 高优端点接受向 Astralane 地址支付的小费,我们会同时通过 Jito 以及自有质押对等网络并行竞速转发,力求最低时延——即便当前领导者运行的是 Jito 验证器或原生 Agave 客户端。 **原子性与小费退款** 可提供自定义端点,生成在 X 个槽后过期的交易哈希,确保交易在目标槽内完成落地;未达成条件时支持小费退款策略,保障你的执行确定性。 [上一页欢迎来到 Astralanechevron-left](https://astralane.gitbook.io/docs/products-wiki-zh) [下一页端点与配置chevron-right](https://astralane.gitbook.io/docs/products-wiki-zh/di-yan-chi-jiao-yi/duan-dian-yu-pei-zhi) 最后更新于 6个月前 --- # 更新日志 | Astralane * 2025 年 8 月 7 日:因防火墙限速及硬件资源优化,纽约节点已迁移至 tsw。旧 IP 173.231.40.226 将下线退役。 * 2025 年 8 月 12 日:新增 4 个小费钱包地址,用于进一步优化转发与执行表现。 [上一页端点与配置chevron-left](https://astralane.gitbook.io/docs/products-wiki-zh/di-yan-chi-jiao-yi/duan-dian-yu-pei-zhi) [下一页提交交易chevron-right](https://astralane.gitbook.io/docs/products-wiki-zh/di-yan-chi-jiao-yi/ti-jiao-jiao-yi) 最后更新于 6个月前 --- # 提交交易 | Astralane Astralane 为不同场景提供多种选择。以下是我们用于发送交易的主要 RPC 方法。 * * * [hashtag](https://astralane.gitbook.io/docs/products-wiki-zh/di-yan-chi-jiao-yi/ti-jiao-jiao-yi#sendtransaction) sendTransaction ------------------------------------------------------------------------------------------------------------------------------------- circle-info 🚀 建议优先使用 `sendTransaction`,获取更快的落地速度。 * 与所有主流 Solana 库完全兼容,可直接替换你现有的 RPC 提交流程。 * 通过我们的 SWQoS 合作通道(包含 Jito 与 Paladin,后者要求更高的最小小费)进行路由,兼顾性能与可靠性。 * 用法与普通 RPC 完全一致:把 URL 换成我们的端点即可。唯一不同是需额外添加一条“小费”转账指令。 JSON-RPC 参数格式: 复制 "params" : [ // params 是一个数组\ ,\ ,\ \ ] 参数 类型 说明 Encoded Transaction String 使用 base64 编码的交易串。 Transaction Configuration JSON Object 建议设置: - `encoding` as `base64` - `skipPreflight` as `true` MeV Protect JSON Object 可选。设为 true 将开启 MEV 保护,默认 false。 请求示例 JSON : 复制 { "id": 1, "jsonrpc": "2.0", "method": "sendTransaction", "params": [\ "base64_encoded_txn1",\ {\ "encoding": "base64",\ "skipPreflight": true\ },\ { "mevProtect": true }\ ] } Rust 复制 const TIP: Pubkey = pubkey!("astra4uejePWneqNaJKuFFA8oonqCE1sqF6b45kDMZm"); // 视接入区域选择对应小费地址 const MIN_TIP_AMOUNT: u64 = 10000; // 反垃圾的最小小费 fn send_tx_tipped( ixs: &mut Vec, signer: &Keypair, rpc_client: &RpcClient, // https://api.mainnet-beta.solana.com astralane_txn_sender: &RpcClient // Astralane RPC ) { let tip_ix = system_instruction::transfer(&signer.pubkey(), &TIP, MIN_TIP_AMOUNT); ixs.push(tip_ix); let blockhash = rpc_client.get_latest_blockhash().unwrap(); let tx = Transaction::new_signed_with_payer(ixs, Some(&signer.pubkey()), &[signer], blockhash); let encoded_tx = base64::prelude::BASE64_STANDARD.encode(&bincode::serialize(tx).unwrap()); let response = client .post(url) .header("api_key", "xxx") .json(&json! ({ "jsonrpc": "2.0", "id": 1, "method": "sendTransaction", "params": [\ encoded_tx, \ {\ "encoding": "base64",\ "skipPreflight": true,\ },\ { "mevProtect": true }// 可选,默认 false\ ] })) .send() .await; } } circle-info sendTransaction 支持 `max_retries` 参数。若你不希望我们质押节点为你的交易自动重试,可用该参数控制。欢迎联系我们了解适用场景。 **\*\*新增:若最小小费达到 Paladin 要求,该端点也可同时向 Paladin 广播(优势见后文)。** * * * [hashtag](https://astralane.gitbook.io/docs/products-wiki-zh/di-yan-chi-jiao-yi/ti-jiao-jiao-yi#sendbundle) sendBundle --------------------------------------------------------------------------------------------------------------------------- 如果你的操作需要原子性落地,请使用 sendBundle。 * 单个原子包最多可包含 4 笔交易,按顺序依次执行。 * 任意一笔失败即整体回滚,确保一致性,避免“部分成功”。 参数 类型 说明 复制 revertProtection Boolean 若一个 bundle 仅包含 1 笔交易且该值为 `false`,则会走 `sentTransaction` 路线。默认 `false`。 Rust Golang 复制 const TIP: Pubkey = pubkey!("astra4uejePWneqNaJKuFFA8oonqCE1sqF6b45kDMZm"); // Use tip wallet depending on region of access const MIN_TIP_AMOUNT: u64 = 10000; // added for spam prevention async fn send_bundle( ixs: &mut Vec, signer: &Keypair, client: reqwest::Client, blockhash: Hash, url: String, ) { let tip_ix = system_instruction::transfer(&signer.pubkey(), &TIP, MIN_TIP_AMOUNT); ixs.push(tip_ix); let tx = Transaction::new_signed_with_payer(ixs, Some(&signer.pubkey()), &[signer], blockhash); let encoded_tx = base64::prelude::BASE64_STANDARD.encode(&bincode::serialize(tx).unwrap()); let response = client .post(url) .header("api_key", "xxx") .json(&json! ({ "jsonrpc": "2.0", "id": 1, "method": "sendBundle", "params": [[encoded_tx]], })) .send() .await; } _Code example for sendIdeal endpoint usage in Go given below:_ 复制 package main import ( "bytes" "context" "encoding/base64" "encoding/json" "fmt" "github.com/davecgh/go-spew/spew" "github.com/gagliardetto/solana-go/programs/system" "log" "net/http" "time" "github.com/gagliardetto/solana-go" "github.com/gagliardetto/solana-go/rpc" ) func main() { payerPrivateKeyBase58 := "YOUR_WALLET_PRIVATE_KEY" astralaneTipAddressBase58 := "astra4uejePWneqNaJKuFFA8oonqCE1sqF6b45kDMZm" rpcEndpoint := "DM_US_FOR_TRIAL_RPC_ENDPOINTS" astralaneEndpoint := "http://fr.gateway.astralane.io/iris?api-key=YOUR_ASTRALANE_API_KEY" signer, err := solana.PrivateKeyFromBase58(payerPrivateKeyBase58) if err != nil { log.Fatalf("Failed to load private key: %v", err) } client := rpc.New(rpcEndpoint) recentBlockhash, err := client.GetLatestBlockhash(context.Background(), rpc.CommitmentFinalized) if err != nil { log.Fatalf("Failed to get recent blockhash: %v", err) } astralaneTipAddress, err := solana.PublicKeyFromBase58(astralaneTipAddressBase58) if err != nil { log.Fatalf("Failed to decode astralane tip address: %v", err) } tx, err := solana.NewTransaction( []solana.Instruction{ system.NewTransferInstruction( 200_000, signer.PublicKey(), astralaneTipAddress, ).Build(), }, recentBlockhash.Value.Blockhash, solana.TransactionPayer(signer.PublicKey()), ) if err != nil { log.Fatalf("Failed to create transaction: %v", err) } if _, err := tx.Sign(func(key solana.PublicKey) *solana.PrivateKey { return &signer }); err != nil { log.Fatalf("Failed to sign transaction: %v", err) } spew.Dump(tx) out, err := tx.MarshalBinary() if err != nil { log.Fatalf("Marshaling to binary failed: %v", err) } encodedTx := base64.StdEncoding.EncodeToString(out) decoded, err := base64.StdEncoding.DecodeString(encodedTx) if err != nil { log.Fatalf("Sanity check decode failed: %v", err) } if !bytes.Equal(decoded, out) { log.Fatalf("Sanity check failed: decoded transaction does not match original binary") } payload := map[string]interface{}{ "jsonrpc": "2.0", "id": 1, "method": "sendBundle", "params": []interface{}{ []string{encodedTx}, }, } response, err := sendBundleRequest(astralaneEndpoint, payload) if err != nil { log.Fatalf("Bundle RPC failed: %v", err) } log.Printf("Bundle RPC response: %s", response) } func sendBundleRequest(endpoint string, payload map[string]interface{}) (string, error) { jsonData, err := json.Marshal(payload) if err != nil { return "", fmt.Errorf("Failed to marshal JSON: %w", err) } client := &http.Client{Timeout: 15 * time.Second} resp, err := client.Post(endpoint, "application/json", bytes.NewBuffer(jsonData)) if err != nil { return "", fmt.Errorf("Request to Bundle RPC failed: %w", err) } defer resp.Body.Close() var result map[string]interface{} if err := json.NewDecoder(resp.Body).Decode(&result); err != nil { return "", fmt.Errorf("Failed to decode Bundle RPC response: %w", err) } responseBytes, _ := json.MarshalIndent(result, "", " ") return string(responseBytes), nil } For further explanation please refer Rust docs on step by step details on whats happening. **请求示例:** 复制 { "id": 1, "jsonrpc": "2.0", "method": "sendBundle", "params": [\ [\ "base64_encoded_txn1",\ "base64_encoded_txn2",\ "base64_encoded_txn3"\ ],\ {\ "encoding": "base64",\ "mevProtect": true,\ "revertProtection": false\ }\ ] } **响应示例:** 返回交易签名列表 复制 { "jsonrpc": "2.0", "id": 1, "result": [\ "37Dxw2nJYw3T8JVqenPQMf39VJ9CNZYCyQm67b6nRj6fa6UjQ1UuLqFvh3wJ2G7LcMuZn4oq5kDt2A2CEXfi8D8"\ ] } circle-info 说明:MAX\_TRANSACTIONS\_IN\_BUNDLE = 4 * * * [hashtag](https://astralane.gitbook.io/docs/products-wiki-zh/di-yan-chi-jiao-yi/ti-jiao-jiao-yi#sendideal) sendIdeal ------------------------------------------------------------------------------------------------------------------------- **为狙击场景而生!** 由于验证者分化为 Jito 与非 Jito,两种付费路径(Jito tip vs 优先费)如何取舍常令人纠结。可利用可持久 nonce(durable nonce)来对冲不确定性。 sendIdeal 接受两笔交易: * 交易 A:**高优先费 + 最低小费** * 交易 B:**高小费 + 较低优先费** 我们会通过 **SWQoS 与打包管线并行路由**,并借助 **durable nonce** 确保一旦其中一笔上链,另一笔会自动作废,从而兼顾效率与成本。 如果你不想自行管理 nonce 账户,可使用我们的托管服务。我们会为你的每个 api-key 创建专属 nonce 账户,并可通过 **getNonce RPC** 查询。 建议按以下步骤集成: Rust Typescript #### [hashtag](https://astralane.gitbook.io/docs/products-wiki-zh/di-yan-chi-jiao-yi/ti-jiao-jiao-yi#step-1-huo-qu-nonce) **Step 1 :** 获取 Nonce 复制 use solana_sdk::hash::Hash; use solana_sdk::pubkey::Pubkey; use solana_sdk::signature::{EncodableKey, Keypair, Signer}; async fn get_nonce( client: reqwest::Client, url: String, auth_key: String, ) { let response = client .post(url) .header("api_key", "xxx") .json(&json! ({ "jsonrpc": "2.0", "id": 1, "method": "getNonce", "params": [api_key], // provided during onboarding })) .send() .await; let result = response["result"].clone(); let nonce = result["nonce"].as_str().unwrap(); let nonce_account = Pubkey::from_str(result["nonceAccount"].as_str().unwrap()).unwrap(); let nonce_authority = Pubkey::from_str(result["nonceAuthority"].as_str().unwrap()).unwrap(); let nonce_as_hash = Hash::from_str(nonce).unwrap(); } circle-info if you already have an existing nonce account, you can just pass in your nonce account, you can simply pass in your nonce account public key instead of the API key. The response will still include your parsed nonce. 已有自托管 nonce 账户? 可以直接在 params 传入你的 nonce 账户公钥,响应同样会返回解析后的 nonce。 使用时,注意把 advance nonce 指令放在交易的第一条指令。 #### [hashtag](https://astralane.gitbook.io/docs/products-wiki-zh/di-yan-chi-jiao-yi/ti-jiao-jiao-yi#step-2-sheng-cheng-liang-bi-jiao-yi-bing-yong-partialsign-yu-qian-ming) **Step 2 :** 生成两笔交易并用 partial\_sign 预签名 复制 const TIP: Pubkey = pubkey!("astra4uejePWneqNaJKuFFA8oonqCE1sqF6b45kDMZm"); // Use tip wallet depending on region of access const MIN_TIP_AMOUNT: u64 = 10000; // added for spam prevention async fn send_ideal( signer: &Keypair, client: reqwest::Client, nonce: Hash, instructions: Vec, nonce_authority: &Pubkey, nonce_account: &Pubkey, ) { // 先添加 advance nonce 指令 let advance_nonce = solana_sdk::system_instruction::advance_nonce_account(nonce_account, nonce_authority); let low_tip_high_fee_ixs = vec![\ advance_nonce.clone(),\ solana_sdk::compute_budget::ComputeBudgetInstruction::set_compute_unit_price(\ 10 * MICRO_LAMPORTS_PER_LAMPORTS,\ ),\ // 你的任务指令\ solana_sdk::system_instruction::transfer(&signer.pubkey(), &TIP, MIN_TIP_AMOUNT),\ ]; let high_tip_low_fee_ixs = vec![\ advance_nonce,\ solana_sdk::compute_budget::ComputeBudgetInstruction::set_compute_unit_price(\ 100,\ ),\ // 你的任务指令\ solana_sdk::system_instruction::transfer(&signer.pubkey(), &TIP, 100 * MIN_TIP_AMOUNT),\ ]; // 高优先费 + 最低小费 let mut low_tip_high_fee_tx = Transaction::new_with_payer(&low_tip_high_fee_ixs, Some(&signer.pubkey())); low_tip_high_fee_tx.partial_sign(&[&signer], nonce); // 高小费 + 低优先费 let mut high_tip_low_fee_tx = Transaction::new_with_payer(&high_tip_low_fee_ixs, Some(&signer.pubkey())); high_tip_low_fee_tx.partial_sign(&[&signer], nonce); // 编码 let low_tip_high_fee_tx_encoded = base64::prelude::BASE64_STANDARD.encode(&bincode::serialize(low_tip_high_fee_tx).unwrap()); let high_tip_low_fee_tx_encoded = base64::prelude::BASE64_STANDARD.encode(&bincode::serialize(high_tip_low_fee_tx).unwrap()); let response = client .post(url) .json(&json! ({ "jsonrpc": "2.0", "id": 1, "method": "sendIdeal", "params": [[low_tip_high_fee_tx_encoded, high_tip_low_fee_tx_encoded]], })) .send() .await; } circle-info 使用 Astralane 托管的 nonce 账户时,请务必使用 **partial\_sign**。若使用自管 nonce,可按常规 sign。 **\*\*新增:若最小小费满足 Paladin 要求,该端点也可同时向 Paladin 广播(优势见下文)。** _下面是使用 TypeScript 调用 sendIdeal 端点的代码示例:_ 复制 import { Connection, Keypair, PublicKey, SystemProgram, Transaction, LAMPORTS_PER_SOL, ComputeBudgetProgram, } from '@solana/web3.js'; import * as bs58 from 'bs58'; async sendTransTest() { try { const result = await fetch( `http://fr.gateway.astralane.io/iris?api-key=`, { method: 'POST', headers: { 'Content-Type': 'application/json', }, body: JSON.stringify({ jsonrpc: '2.0', id: 1, method: 'getNonce', params: [\ 'api-key',\ ], }), }, ); const res = await result.json(); const data = res as any; const nonceAccount = new PublicKey(data.result.nonceAccount); const nonceAuthority = new PublicKey(data.result.nonceAuthority); const nonce = data.result.nonce; const advanceNonce = SystemProgram.nonceAdvance({ noncePubkey: nonceAccount, authorizedPubkey: nonceAuthority, }); const secretKey = Keypair.fromSecretKey( bs58.default.decode( 'wallet-private-key', ), ); const wallet = secretKey; //Tip account const toPublicKey = new PublicKey( 'astra4uejePWneqNaJKuFFA8oonqCE1sqF6b45kDMZm', ); const MIN_TIP_AMOUNT = 10000; const lowTipHighFeeIx = [\ advanceNonce,\ ComputeBudgetProgram.setComputeUnitPrice({\ microLamports: 1 * 100000,\ }),\ SystemProgram.transfer({\ fromPubkey: wallet.publicKey,\ toPubkey: toPublicKey,\ lamports: MIN_TIP_AMOUNT,\ }),\ ]; const HighTipLowFeeIx = [\ advanceNonce,\ ComputeBudgetProgram.setComputeUnitPrice({\ microLamports: 1 * 100,\ }),\ SystemProgram.transfer({\ fromPubkey: wallet.publicKey,\ toPubkey: toPublicKey,\ lamports: 100 * MIN_TIP_AMOUNT,\ }),\ ]; const htlfTransaction = new Transaction().add(...HighTipLowFeeIx); htlfTransaction.recentBlockhash = nonce; htlfTransaction.feePayer = wallet.publicKey; htlfTransaction.partialSign(wallet); const highTipLowFeeEncoded = Buffer.from( htlfTransaction.serialize({ requireAllSignatures: false, verifySignatures: false, }), ).toString('base64'); const lthfTransaction = new Transaction().add(...lowTipHighFeeIx); lthfTransaction.recentBlockhash = nonce; lthfTransaction.feePayer = wallet.publicKey; lthfTransaction.partialSign(wallet); const lowTipHighFeeEncoded = Buffer.from( lthfTransaction.serialize({ requireAllSignatures: false, verifySignatures: false, }), ).toString('base64'); const final = await fetch( `http://fr.gateway.astralane.io/iris?api-key=`, { method: 'POST', headers: { 'Content-Type': 'application/json', }, body: JSON.stringify({ jsonrpc: '2.0', id: 1, method: 'sendIdeal', params: [[highTipLowFeeEncoded, lowTipHighFeeEncoded]], }), }, ); const finalResult = await final.json(); console.log(finalResult); return lowTipHighFeeEncoded; } catch (error) { console.log(error); } } 你的交易时延表现会受当前网络状况影响。若需为你的业务获取更合适的参数与架构建议,欢迎在 Telegram 联系我们。 **请求示例:** 复制 { "id": 1, "jsonrpc": "2.0", "method": "sendIdeal", "params": [[\ "transction_with_large_tip_low_priority_fee",\ "transaction_with_large_priority_fee_low_tip"\ ]] } **响应示例:** 复制 { "jsonrpc": "2.0", "id": 1, "result": [\ "",\ ""\ ] } 实际时延表现受当前网络状态影响。如需为你的业务推荐更合适的参数与架构,请在 Telegram 联系我们。 * * * [hashtag](https://astralane.gitbook.io/docs/products-wiki-zh/di-yan-chi-jiao-yi/ti-jiao-jiao-yi#sendpaladin-beta) **sendPaladin (Beta)** --------------------------------------------------------------------------------------------------------------------------------------------- Paladin 是定制的 TPU 端口实现,可更高效地将交易直达当前 Leader。截止 2025-03-10,Paladin 客户端已覆盖约 10% 的 Solana 节点。[更多arrow-up-right](https://send.paladin.one/) **Step 1:追踪 Paladin 领导者** 由于 Paladin 验证者并非覆盖所有 slot,我们提供了“Paladin 领导者跟踪”服务,便于你按领导者动态路由交易。 > **强烈建议使用 gRPC 跟踪实时领导者(普通 RPC 时效性不足)。** > > 若暂时无法使用 gRPC,建议在配置中将 `enableFallback` 设为 true,以获得更稳的效果。 1. **获取当前 epoch 的 Palidator 公钥列表** 复制 ⚔️ GET http://paladin.astralane.io/api/palidators 复制 [\ "Ss...Z77",\ "ACv...mi",\ "7Z...Z84",\ ] 或参考: \`[https://api.paladin.one/validatorsarrow-up-right](https://api.paladin.one/validators/) \` 1. **获取下一位 Palidator 的领导槽位** 复制 ⚔️ GET http://paladin.astralane.io/api/next_palidator 复制 { "pubkey": "Csd...def", "leader_slot": 42424242, "context_slot": 42424242 } 1. 查询某一槽位及之后的下一位 Palidator 领导 复制 ⚔️ GET http://paladin.astralane.io/api/next_palidator/{slot} 复制 { "pubkey": "Csd...def", "leader_slot": 42424242, "context_slot": 42424242 } circle-exclamation 有极少数恶意参与者**可能伪装为 Paladin**。为防止被利用,**建议实现“恶意运营者”主动阻名单**。如不确定如何落地,请到我们的 [Discordarrow-up-right](https://discord.gg/2UfWGtUDtN) 咨询。 向 Paladin 验证者发送交易时,最小费用为 10 lamports/cu。 **Step 2:构造 Paladin 交易** circle-info 请参考“**最低小费(Min Tip)**”的相关使用限制。 Paladin slot 内通过 `sendPaladin`方法发送交易。务必满足最小小费与最小优先费的要求。 该端点的排序规则: * 优先按 priority fee 排序; * 若出现并列,再按向 Astralane 小费地址支付的小费高低决出先后。 参数 类型 说明 复制 revertProtection Boolean 启用后,失败的交易将被丢弃,而不是以失败状态上链。默认 false。 复制 enableFallback Boolean 设为 `true`:若当前 slot Leader 非 Paladin,或在 Paladin slot 的拍卖中未“胜出”,则自动回退到 sendTransaction 流水线继续发送。 设为 false:若在非 Paladin slot 提交,或竞拍未中标,将报错(如 `Invalid Request: transaction received at slot xxx which is not a paladin slot, fallback not enabled`),并被静默丢弃。 复制 { "id": 1, "jsonrpc": "2.0", "method": "sendPaladin", "params": [\ "",\ {\ "revertProtection": false,\ "enableFallback" : true\ }\ ] } 复制 { "jsonrpc": "2.0", "id": 1, "result": [\ "",\ ] } circle-info 请结合 Paladin Leader API 持续追踪活跃领导者与 slot 时间窗口,按需调整小费/费用;并通过配置端点动态更新参数,**以获得更优的成本与成功率。** * * * **需要帮助?** 加入我们的 [**Discord**arrow-up-right](https://discord.gg/2UfWGtUDtN) ,获取技术文档、接入支持与实时更新。 [上一页更新日志chevron-left](https://astralane.gitbook.io/docs/products-wiki-zh/di-yan-chi-jiao-yi/duan-dian-yu-pei-zhi/geng-xin-ri-zhi) [下一页发送交易 V2chevron-right](https://astralane.gitbook.io/docs/products-wiki-zh/di-yan-chi-jiao-yi/ti-jiao-jiao-yi/fa-song-jiao-yi-v2) 最后更新于 6个月前 --- # 发送交易 V2 | Astralane **主要改进** * 无需触发 CORS 预检请求 * 使用纯文本请求体,替代 JSON * 显著减小请求体体积,降低带宽与网络开销 > #### > > [hashtag](https://astralane.gitbook.io/docs/products-wiki-zh/di-yan-chi-jiao-yi/ti-jiao-jiao-yi/fa-song-jiao-yi-v2#guan-jian-shuo-ming) > > 关键说明 > > * 请求头仅需保留一项:`Content-Type: text/plain` > > * 交易数据需使用 Base64 编码 > > * 必须在 URI 参数中携带 `api-key` 与 `method` > > * 当前仅支持 `sendTransaction` 方法 > > * 请求路径:`/iris2` > #### [hashtag](https://astralane.gitbook.io/docs/products-wiki-zh/di-yan-chi-jiao-yi/ti-jiao-jiao-yi/fa-song-jiao-yi-v2#uri-can-shu) URI 参数 参数名 类型 Description `api-key` String **必填**,用于鉴权 `method` String **必填**,用于指定调用方法 `mev-protect` Boolean **选填**,是否开启 MEV 保护,默认 `false` #### [hashtag](https://astralane.gitbook.io/docs/products-wiki-zh/di-yan-chi-jiao-yi/ti-jiao-jiao-yi/fa-song-jiao-yi-v2#zhi-chi-de-fang-fa) 支持的方法 方法名 HTTP 动词 说明 `sendTransaction` `POST` 发送 Base64 编码后的交易 `getHealth` `POST` 保活探测 / 健康检查 #### [hashtag](https://astralane.gitbook.io/docs/products-wiki-zh/di-yan-chi-jiao-yi/ti-jiao-jiao-yi/fa-song-jiao-yi-v2#qing-qiu-shi-li) 请求示例 复制 curl --location 'https://lim.gateway.astralane.io/iris2?api-key=APIKEY&method=sendTransaction' \ --header 'Content-Type: text/plain' \ --data 'base64_encoded_txn' Rust : 复制 #[tokio::main] async fn main() -> Result<(), Box> { let client = reqwest::Client::builder() .build()?; let mut headers = reqwest::header::HeaderMap::new(); headers.insert("Content-Type", "text/plain".parse()?); let data = "base64_encoded_txn"; let request = client.request(reqwest::Method::POST, "https://lim.gateway.astralane.io/iris2?api-key=APIKEY&method=sendTransaction") .headers(headers) .body(data); let response = request.send().await?; let body = response.text().await?; println!("{}", body); Ok(()) } NodeJS 复制 const axios = require('axios'); let data = 'base64_encoded_txn'; let config = { method: 'post', maxBodyLength: Infinity, url: 'https://lim.gateway.astralane.io/iris2?api-key=APIKEY&method=sendTransaction', headers: { 'Content-Type': 'text/plain' }, data : data }; axios.request(config) .then((response) => { console.log(JSON.stringify(response.data)); }) .catch((error) => { console.log(error); }); Go Lang 复制 package main import ( "fmt" "strings" "net/http" "io" ) func main() { url := "https://lim.gateway.astralane.io/iris2?api-key=APIKEY&method=sendTransaction" method := "POST" payload := strings.NewReader(`base64_encoded_txn`) client := &http.Client { } req, err := http.NewRequest(method, url, payload) if err != nil { fmt.Println(err) return } req.Header.Add("Content-Type", "text/plain") res, err := client.Do(req) if err != nil { fmt.Println(err) return } defer res.Body.Close() body, err := io.ReadAll(res.Body) if err != nil { fmt.Println(err) return } fmt.Println(string(body)) } #### [hashtag](https://astralane.gitbook.io/docs/products-wiki-zh/di-yan-chi-jiao-yi/ti-jiao-jiao-yi/fa-song-jiao-yi-v2#fan-hui-jie-guo-shuo-ming) 返回结果说明 HTTP 状态码 含义 200 请求成功,交易已正常处理 400 请求参数或格式存在问题 [上一页提交交易chevron-left](https://astralane.gitbook.io/docs/products-wiki-zh/di-yan-chi-jiao-yi/ti-jiao-jiao-yi) [下一页附加优化chevron-right](https://astralane.gitbook.io/docs/products-wiki-zh/di-yan-chi-jiao-yi/ti-jiao-jiao-yi/fu-jia-you-hua) 最后更新于 4个月前 --- # 端点与配置 | Astralane [hashtag](https://astralane.gitbook.io/docs/products-wiki-zh/di-yan-chi-jiao-yi/duan-dian-yu-pei-zhi#endpoints) Endpoints ------------------------------------------------------------------------------------------------------------------------------ Iris **交易发送端点** * 法兰克福(推荐):[http://fr.gateway.astralane.io/iris?api-key=xxxxarrow-up-right](http://fr2.gateway.astralane.io/iris?api-key=xxxx) IPv4 : 185.191.117.97 * 法兰克福: [http://fr2.gateway.astralane.io/iris?api-key=xxxxarrow-up-right](http://fr2.gateway.astralane.io/iris?api-key=xxxx) IPv4:45.139.132.160 * 旧金山: [http://lax.gateway.astralane.io/iris?api-key=xxxxarrow-up-right](http://lax.gateway.astralane.io/iris?api-key=xxxx) IPv4:45.32.86.58 * 东京: [http://jp.gateway.astralane.io/iris?api-key=xxxxarrow-up-right](http://jp.gateway.astralane.io/iris?api-key=xxxx) IPv4:189.1.164.31 * 纽约: [http://ny.gateway.astralane.io/iris?api-key=xxxxarrow-up-right](http://ny.gateway.astralane.io/iris?api-key=xxxx) IPv4:64.130.45.19 * 阿姆斯特丹: [http://ams.gateway.astralane.io/iris?api-key=xxxxarrow-up-right](http://ams.gateway.astralane.io/iris?api-key=xxxx) IPv4:64.130.43.43 * 林堡: [http://lim.gateway.astralane.io/iris?api-key=xxxxarrow-up-right](http://lim.gateway.astralane.io/iris?api-key=xxxx) IPv4:162.19.222.232 circle-info **以上地址均支持 HTTPS 访问。** **Paladin 领导者追踪:** **接口地址:**[http://paladin.astralane.io/api/palidatorsarrow-up-right](http://paladin.astralane.io/api/palidators) **可用方法:** * _sendTransaction_ * _sendBundle_ * _sendIdeal_ * _getNonce_ * _sendPaladin_ * _getHealth_ _**小费地址(Tipping Address):**_ * astrazznxsGUhWShqgNtAdfrzP2G83DzcWVJDxwV9bF * astra4uejePWneqNaJKuFFA8oonqCE1sqF6b45kDMZm * astra9xWY93QyfG6yM8zwsKsRodscjQ2uU2HKNL5prk * astraRVUuTHjpwEVvNBeQEgwYx9w9CFyfxjYoobCZhL * astraEJ2fEj8Xmy6KLG7B3VfbKfsHXhHrNdCQx7iGJK * astraubkDw81n4LuutzSQ8uzHCv4BhPVhfvTcYv8SKC * astraZW5GLFefxNPAatceHhYjfA1ciq9gvfEg2S47xk * astrawVNP4xDBKT7rAdxrLYiTSTdqtUr63fSMduivXK #### [hashtag](https://astralane.gitbook.io/docs/products-wiki-zh/di-yan-chi-jiao-yi/duan-dian-yu-pei-zhi#xian-liu-ce-le-rate-limits) 限流策略(Rate Limits)**:** 默认限流为 5 TPS(每秒 5 笔)适用于 `Iris 端点` 。 需要更高 TPS 或“高频发送 + 自定义返利”方案?欢迎通过 Telegram 联系我们。 **鉴权方式(Authentication):** 支持两种传递方式: * 将 `api-key` 作为 URL 查询参数; * 更推荐作为 HTTP Header 传递(隐私更佳),Header 名称为 `api-key`。 **最低小费(Min Tip)** * 通过 `Iris endpoints` 发送的每笔交易,需包含一条向 Astralane 小费地址的系统转账指令,最低小费为 **0.00001 SOL**。 * 使用 `sendPaladin` 方法发送的交易,需包含同样的小费指令,最低 **0.0001 SOL**;同时计算单位价格(CU price)需≥ `100_000` micro lamports。 * 对于量化与高频用户,我们提供可协商的定制套餐,支持降低或免除最低小费要求。 circle-info 接入与开通 * 请先填写 [Onboardingarrow-up-right](https://forms.gle/G6NzFCYomgQ9HtVz6) 表单,并在 [Discordarrow-up-right](https://discord.com/invite/2UfWGtUDtN) 服务器提交工单,申请交易落地服务的 API Key。 * Onboarding 完成后我们会发放 API Key,并依据灵活定价方案为你配置相应的频率与额度。 * 如需同机托管(colocation)或跳点优化(hop optimization)等深度定制部署,请在 Discord 创建工单,我们将为你一对一配置。 [上一页快速上手chevron-left](https://astralane.gitbook.io/docs/products-wiki-zh/di-yan-chi-jiao-yi/kuai-su-shang-shou) [下一页更新日志chevron-right](https://astralane.gitbook.io/docs/products-wiki-zh/di-yan-chi-jiao-yi/duan-dian-yu-pei-zhi/geng-xin-ri-zhi) 最后更新于 5个月前 --- # 附加优化 | Astralane [hashtag](https://astralane.gitbook.io/docs/products-wiki-zh/di-yan-chi-jiao-yi/ti-jiao-jiao-yi/fu-jia-you-hua#keepalive-lian-jie) Keep-Alive 连接: ------------------------------------------------------------------------------------------------------------------------------------------------------ Keep-Alive(持久连接)是 HTTP、TCP 等网络协议中的特性,用于在客户端与服务器之间保持一条长连接,以承载多次请求与响应,而非每次交互都新建/关闭连接。 ### [hashtag](https://astralane.gitbook.io/docs/products-wiki-zh/di-yan-chi-jiao-yi/ti-jiao-jiao-yi/fu-jia-you-hua#mu-di) 目的: Keep-Alive 的核心目标是降低时延与开销,避免反复的建连与断连。该特性在高性能系统或需处理大量短生命周期请求的场景尤为有效。 ### [hashtag](https://astralane.gitbook.io/docs/products-wiki-zh/di-yan-chi-jiao-yi/ti-jiao-jiao-yi/fu-jia-you-hua#guan-jian-te-xing) 关键特性 * 连接复用:通过复用同一条 TCP 连接,避免频繁的连接建立与释放。 * 降低延迟:跳过新建连接所需的握手往返,缩短整体响应时间。 * 提升吞吐:维持传输通道处于可用状态,在同一连接上高效处理更多请求。 * 资源友好:减少客户端与服务端的 CPU、内存开销,降低连接抖动。 * 心跳/保活:可配置周期性保活信号,避免连接在空闲期间被中间网络设备回收或关闭。 **示例代码** 复制 async fn send_txn_with_keep_alive() -> Result<(), Box> { let client = reqwest::Client::builder() .pool_idle_timeout(Some(Duration::from_secs(85))) // 空闲连接保活 85 秒 .build()?; [完整实例arrow-up-right](https://github.com/Astralane/keep-Alive-Example/blob/main/src/main.rs) 以供参考 [上一页发送交易 V2chevron-left](https://astralane.gitbook.io/docs/products-wiki-zh/di-yan-chi-jiao-yi/ti-jiao-jiao-yi/fa-song-jiao-yi-v2) [下一页小费返还chevron-right](https://astralane.gitbook.io/docs/products-wiki-zh/di-yan-chi-jiao-yi/ti-jiao-jiao-yi/xiao-fei-fan-huan) 最后更新于 6个月前 --- # 概览 | Astralane Astralane 为开发者与量化团队提供可定制的 Solana 数据索引能力,覆盖实时流式处理与历史回填。基础设施支持高吞吐数据管道与批量历史数据导出,适用于资产组合跟踪、算法交易、链上分析等应用场景。 [hashtag](https://astralane.gitbook.io/docs/products-wiki-zh/shu-ju-guan-dao/gai-lan#wei-shen-me-xuan-ze-astralane) 为什么选择 Astralane? ----------------------------------------------------------------------------------------------------------------------------------------- * **实时索引:**基于 Kafka 的流式架构,提供毫秒级数据更新(如 DEX 成交、代币余额)。 * **历史回填:**按需导出批量历史数据,可按程序 ID、账户、指令参数进行过滤。 * **IDL 解析:**在提供 Anchor IDL 的前提下,可按指令名称与参数进行过滤。当前已覆盖 30+ 去中心化交易协议及主流 Solana 程序,协议支持范围广。 * **拥堵场景下的稳定性能:**在网络高峰期仍保持引擎稳定、不掉速,无需额外采购备份节点或连接服务。 * **预构建管道:**为常见的数据索引场景提供开箱即用的流水线,详见后续章节。 初始化接入时将发放 API Key;请求配额与速率限制将依据灵活的计费方案进行管理。 circle-info 请先填写 [Onboardingarrow-up-right](https://forms.gle/G6NzFCYomgQ9HtVz6) 表单,并在 [Discordarrow-up-right](https://discord.com/invite/2UfWGtUDtN) 服务器提交工单,申请交易落地服务的 API Key。 **需要定制索引或批量数据集?**欢迎加入我们的 [Discordarrow-up-right](https://discord.com/invite/2UfWGtUDtN) 服务器并提交工单,我们将与您共同制定方案。 [上一页小费返还chevron-left](https://astralane.gitbook.io/docs/products-wiki-zh/di-yan-chi-jiao-yi/ti-jiao-jiao-yi/xiao-fei-fan-huan) [下一页我们的产品chevron-right](https://astralane.gitbook.io/docs/products-wiki-zh/shu-ju-guan-dao/wo-men-de-chan-pin) 最后更新于 6个月前 --- # 小费返还 | Astralane 使用 Astralane Iris 的用户,如其通过我们中间层发送的交易最终在链上以“更低成本”成功执行,将自动获得 SOL 小费退款。该机制不会改变交易的执行路径,用户也无需做任何额外配置即可享受退款。 [hashtag](https://astralane.gitbook.io/docs/products-wiki-zh/di-yan-chi-jiao-yi/ti-jiao-jiao-yi/xiao-fei-fan-huan#shen-me-shi-xiao-fei-fan-huan) 什么是“小费返还”? ---------------------------------------------------------------------------------------------------------------------------------------------------------------- 由于 Solana 验证者客户端生态被分割(主要包括 Jito、Agave、FD 等),很多用户在“提高优先费”与“提高小费”之间难以抉择,以确保交易稳定落地。 在网络竞争空前激烈的情况下,用户常常为“过高的小费”买单。**很多交易其实用更低的小费也能同样快速落地。**借助 Astralane 的验证者侧车网络(validator sidecar network),**我们可以将这些“过度支付”的一部分返还给用户,形成“小费返还”。** Astralane 的系统目标是尽量减少过付。所有经由我们基础设施发送的交易,都会通过内部的 SwQoS 网络路由,从而提升落地概率;对于相对“为落地所需”支付过高费用的交易,我们会发放返还。 [hashtag](https://astralane.gitbook.io/docs/products-wiki-zh/di-yan-chi-jiao-yi/ti-jiao-jiao-yi/xiao-fei-fan-huan#na-xie-jiao-yi-ke-huo-de-fan-huan) 哪些交易可获得返还 ------------------------------------------------------------------------------------------------------------------------------------------------------------------- 返还适用于通过 Astralane 的 SwQoS 网络在某个 slot 内成功落地的交易。资格取决于每个区块动态变化的多项因素,包括但不限于: * 当前网络拥堵与竞争程度 * Astralane 内部 iris 网络在该笔交易上的盈余情况及幅度 * 交易是否直接发送至 Astralane Iris,或同时广播给了其他 RPC / 落地服务 circle-info 如果你已在使用 Astralane Iris,或计划在现有架构中接入,请在 Discord 联系我们,我们会为你开启返还功能。支持入口:[https://discord.gg/2UfWGtUDtNarrow-up-right](https://discord.gg/2UfWGtUDtN) [hashtag](https://astralane.gitbook.io/docs/products-wiki-zh/di-yan-chi-jiao-yi/ti-jiao-jiao-yi/xiao-fei-fan-huan#ru-he-tong-shi-zui-da-hua-fan-huan-yu-su-du) 如何同时最大化返还与速度 -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 直接发送至 Astralane,且不使用高级 nonce、也不自行同时对外广播至其他 RPC 或落地服务的交易,通常可获得更高档位的返还。这类流量能最大化 Astralane 内部网络的成功落地概率,从而促成更大的返还空间 circle-info 通常通过 `sendTransaction` 方法发送,能更快执行且返还更可观,因为它跳过了拍卖时间,直接走我们的内部 SwQoS 网络。 其他方法(`sendBundle`、`sendPaladin`、`sendIdeal`)也支持小费返还,但返还幅度取决于这些方法的具体配置。 由于交易发送对时延极度敏感,建议用户与我们进行同机托管(colocation),以提升区块纳入概率。 [hashtag](https://astralane.gitbook.io/docs/products-wiki-zh/di-yan-chi-jiao-yi/ti-jiao-jiao-yi/xiao-fei-fan-huan#qi-ta-ke-xuan-quan-yi) 其他可选权益: ----------------------------------------------------------------------------------------------------------------------------------------------------- 我们会根据你的交易流量与小费规模,提供多种激励,包括: * 月费优惠/减免 * 免费提升 TPS 配额 * 免费试用交易者向的内测产品(gRPC、shreds、topOfBlock 等) [hashtag](https://astralane.gitbook.io/docs/products-wiki-zh/di-yan-chi-jiao-yi/ti-jiao-jiao-yi/xiao-fei-fan-huan#fan-huan-cha-xun-yu-jie-suan) 返还查询与结算: ------------------------------------------------------------------------------------------------------------------------------------------------------------- * 返还以你的 Iris API Key 为维度进行统计。你可以用该 API Key 在我们的平台查询可获得的返还(功能开发中)。 * 返还将按月开放提现,月末可进行结算与提取。 [上一页附加优化chevron-left](https://astralane.gitbook.io/docs/products-wiki-zh/di-yan-chi-jiao-yi/ti-jiao-jiao-yi/fu-jia-you-hua) [下一页概览chevron-right](https://astralane.gitbook.io/docs/products-wiki-zh/shu-ju-guan-dao/gai-lan) 最后更新于 6个月前 --- # 认证 | Astralane 在每个 API 请求中,通过请求头 x-api-key 传递你的 API Key。 #### [hashtag](https://astralane.gitbook.io/docs/products-wiki-zh/shu-ju-guan-dao/wo-men-de-chan-pin/ren-zheng#qing-qiu-tou-request-headers) 请求头(Request Headers) **Header** **描述** **必要性** `x-api-key` 用于身份认证的 API Key 是 [上一页我们的产品chevron-left](https://astralane.gitbook.io/docs/products-wiki-zh/shu-ju-guan-dao/wo-men-de-chan-pin) [下一页DEX 流动性池接口chevron-right](https://astralane.gitbook.io/docs/products-wiki-zh/shu-ju-guan-dao/wo-men-de-chan-pin/dex-liu-dong-xing-chi-jie-kou) 最后更新于 6个月前 --- # DEX 流动性池接口 | Astralane **DEX 流动性池接口**提供面向各受支持去中心化交易所(DEX)池子的查询能力,可返回池子的详细信息与最新代币余额,便于开发者实时获取流动性数据并无缝集成到应用中。 该 API 在设计上兼顾高性能与可扩展性,能快速、稳定地访问关键池子数据,是构建 DeFi 应用、分析平台与交易工具的基础组件。 **基础地址(Base URL)** [https://graphql.astralane.io/api/v1/dataset/dex-pools/v2arrow-up-right](https://graphql.astralane.io/api/v1/dataset/dex-pools/v2) ### [hashtag](https://astralane.gitbook.io/docs/products-wiki-zh/shu-ju-guan-dao/wo-men-de-chan-pin/dex-liu-dong-xing-chi-jie-kou#graphql-query-cha-xun-shi-li) GraphQL Query 查询示例 复制 query PoolsData { poolsData(page: 1) { block_slot block_time pool mint_a mint_b token_a_amount token_b_amount program } } ### [hashtag](https://astralane.gitbook.io/docs/products-wiki-zh/shu-ju-guan-dao/wo-men-de-chan-pin/dex-liu-dong-xing-chi-jie-kou#xiang-ying-shi-li) 响应示例 接口返回一个包含 data 字段的 JSON 对象,其中的 poolsData 数组包含各池子的最新代币余额。 复制 { "data": { "poolsData": [\ {\ "block_slot": 321249880,\ "block_time": "2025-02-17 12:17:04.741",\ "pool": "FcQRFJpQcdfyc4UHqMYMgzQTiy5wfxPvDcP9ywQN7SYR",\ "mint_a": "61V8vBaqAGMpgDQi4JcAwo1dmBGHsyhzodcPqnEVpump",\ "mint_b": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",\ "token_a_amount": 86679.966529,\ "token_b_amount": 17380.573925\ }\ ] } } ### [hashtag](https://astralane.gitbook.io/docs/products-wiki-zh/shu-ju-guan-dao/wo-men-de-chan-pin/dex-liu-dong-xing-chi-jie-kou#zi-duan-shuo-ming) 字段说明 * `**block_slot**`: 区块的 slot 编号。 * `**block_time**`: 区块时间(日期时间)。 * `**pool**`: 池子地址。 * `**mint_a**`: 代币 A 的 mint 地址。 * `**mint_b**`: 代币 B 的 mint 地址。 * `**token_a_amount**`: 池中代币 A 的当前余额。 * `**token_b_amount**`: 池中代币 B 的当前余额。 * `**program**`: 对应 DEX 程序的地址。 ### [hashtag](https://astralane.gitbook.io/docs/products-wiki-zh/shu-ju-guan-dao/wo-men-de-chan-pin/dex-liu-dong-xing-chi-jie-kou#zhi-chi-de-dex) 支持的 DEX 关于已支持的 DEX 列表及索引的数据范围,请参见“[Supported DEXes and Indexed Dataarrow-up-right](https://www.notion.so/Supported-DEXes-and-Indexed-Data-14b2d9037ca78058ab32f8207665e53e?pvs=21) ”页面。 [上一页认证chevron-left](https://astralane.gitbook.io/docs/products-wiki-zh/shu-ju-guan-dao/wo-men-de-chan-pin/ren-zheng) [下一页最新Dex流动性池接口chevron-right](https://astralane.gitbook.io/docs/products-wiki-zh/shu-ju-guan-dao/wo-men-de-chan-pin/dex-liu-dong-xing-chi-jie-kou/zui-xin-dex-liu-dong-xing-chi-jie-kou) 最后更新于 6个月前 --- # 我们的产品 | Astralane **🔌 预构建高性能 API(亚秒级延迟)** 为高要求的交易流程提供超低延迟的链上数据流。 * **Dex Pools API** 来自主流 DEX(如 Orca、Raydium)的实时流动池更新。 * **OHLCV API** 按可配置时间粒度提供交易对的 K 线数据。 * **Token Price & Volume API** 实时代币价格与成交量,支持 WebSocket 实时推送。 * **Pump Fun API** 针对 Pump.fun 合约的结构化事件解析,便于快速集成与消费。 * **Profitable Wallets API** 按不同时间周期基于收益(PnL)排名的高收益钱包发现。 * **Wallet PnL API** 返回钱包级交易指标:PnL、胜率、成交笔数与成交量等。 * **Top 100 Token Holders API** 基于钱包余额的任意 SPL 代币 Top 100 持币地址列表(最新快照)。 * **Token Price API** 实时获取 SOL 与任意 SPL 代币价格。 * **Token Price(历史)API** 按可配置区间获取 SOL 与 SPL 代币的历史价格数据。 * * * **⚙️ 自定义数据索引管道** 基于模块化组件构建并配置专属索引基础设施。 * **Custom Program Indexer** 构建定制化的程序级索引器,可选接入外部 API 做数据增强。 * **Transaction Indexer** 摄取并索引原始 Solana 交易到热存储,相较标准 RPC 提供更快且更具性价比的查询能力。 * **Custom Account Indexes** 高速批量账户索引,绕开频繁调用 `getProgramAccounts` 与 `getMultipleAccounts` 的性能瓶颈与限制。 * * * #### [hashtag](https://astralane.gitbook.io/docs/products-wiki-zh/shu-ju-guan-dao/wo-men-de-chan-pin#zhang-hu-ji-suo-yin-account-indexer) 📊 账户级索引(Account Indexer) 覆盖 Solana 网络的全面账户数据索引。 * **Historical Portfolio Values** 按日/按月/按年(EOD/EOM/EOY)追踪用户资产组合价值变化。 * **Trade History** 针对每个账户的 DEX 级别兑换记录,支持强大的过滤条件。 * **PnL Data** 已实现与未实现盈亏指标,支持按日与累计视角统计。 * **Related Wallets** 发现与目标账户高频交互的优质关联钱包。 * * * #### [hashtag](https://astralane.gitbook.io/docs/products-wiki-zh/shu-ju-guan-dao/wo-men-de-chan-pin#li-shi-shu-ju-pi-liang-dao-chu-bulk-dumps) **📦** 历史数据批量导出(Bulk Dumps) 绕开 API 速率与轮询限制,按需获取可用于分析与机器学习的完整历史数据集。 * **Bulk Portfolio Indexer** 为指定钱包提供完整的历史余额与交易记录。 * **DEX Trades Archive** 按交易池或代币维度提供历史 DEX 交易数据,支持 CSV 或 Parquet 格式打包分发。 [上一页概览chevron-left](https://astralane.gitbook.io/docs/products-wiki-zh/shu-ju-guan-dao/gai-lan) [下一页认证chevron-right](https://astralane.gitbook.io/docs/products-wiki-zh/shu-ju-guan-dao/wo-men-de-chan-pin/ren-zheng) 最后更新于 6个月前 --- # 最新Dex流动性池接口 | Astralane **GraphQL API Endpoint** 使用以下端点发起请求(POST): `POST https://graphql.astralane.io/api/v1/dataset/latest-pools` **请求头** **Header** **描述** **必要性** `x-api-key` 用于身份认证的 API Key 是 **Graphql Query** 复制 query PoolsData { poolsData { block_slot blockTime pool mint_a mint_b token_a_amount token_b_amount } } #### [hashtag](https://astralane.gitbook.io/docs/products-wiki-zh/shu-ju-guan-dao/wo-men-de-chan-pin/dex-liu-dong-xing-chi-jie-kou/zui-xin-dex-liu-dong-xing-chi-jie-kou#xiang-ying-shi-li) 响应示例 成功响应将返回包含最新池子及其代币余额信息的 JSON: #### [hashtag](https://astralane.gitbook.io/docs/products-wiki-zh/shu-ju-guan-dao/wo-men-de-chan-pin/dex-liu-dong-xing-chi-jie-kou/zui-xin-dex-liu-dong-xing-chi-jie-kou#zi-duan-shuo-ming) 字段说明 * `**block_time**`: 区块处理时间戳。 * `**block_slot**`: 区块对应的 slot 编号。 * `**pool**`: 流动性池的唯一地址。 * `**mint_a**`: 基础代币(base token)的 mint 地址。 * `**mint_b**`: 计价代币(quote token)的 mint 地址。 * `**token_a_amount**`: 池中基础代币数量。 * `**token_b_amount**`: 池中计价代币数量。 **数据刷新频率** API **每 30 分钟**进行一次索引与更新,在该时间窗口内捕获所有新创建的池子。该周期性索引在及时性与性能之间实现平衡,保障数据的准确性与可靠性。 **注意:**为确保正常访问,请在请求头中正确携带 x-api-key。 [上一页DEX 流动性池接口chevron-left](https://astralane.gitbook.io/docs/products-wiki-zh/shu-ju-guan-dao/wo-men-de-chan-pin/dex-liu-dong-xing-chi-jie-kou) [下一页K线OHLCV接口chevron-right](https://astralane.gitbook.io/docs/products-wiki-zh/shu-ju-guan-dao/wo-men-de-chan-pin/k-xian-ohlcv-jie-kou) 最后更新于 6个月前 sun-brightdesktopmoon 复制 { "data": { "poolsData": [\ {\ "block_slot": 303089869,\ "blockTime": null,\ "pool": "8dM6UzQAq2fNaEtfQr6nNzavpTtywcE1GNBXhmGGE8rd",\ "mint_a": "So11111111111111111111111111111111111111112",\ "mint_b": "31QC34eES9xy7BZmptDgeRy5Mi1iJ51FcXszTj49qwPX",\ "token_a_amount": 30.328900364,\ "token_b_amount": 165210214.980515\ },\ {\ "block_slot": 303089853,\ "blockTime": null,\ "pool": "2o6xd3dYguhofKBT6xUNXHQggiKbSEv5vZ9LMiuymquD",\ "mint_a": "So11111111111111111111111111111111111111112",\ "mint_b": "4yzCocQbtUpd6uanGPp4nxZYiAg8Yv3aCjEMysiMpump",\ "token_a_amount": 0.012082268,\ "token_b_amount": 23547.163168\ }\ ] } sun-brightdesktopmoon --- # K线OHLCV接口 | Astralane **K线OHLCV接口**提供 Solana 代币池的完整蜡烛图数据(开盘、最高、最低、收盘、成交量),覆盖实时与历史视角。该接口面向开发者设计,便于无缝集成至交易工具、分析平台与各类金融应用。 该接口支持从秒级到日级的灵活时间粒度,便于进行精细化与定制化的市场分析。无论是构建高级图表、自动化交易机器人,还是开展深度研究,都可获得可靠、准确、及时的市场数据。 **基础地址(Base URL)** [https://graphql.astralane.io/api/v1/dataset/trade/ohlcvarrow-up-right](https://graphql.astralane.io/api/v1/dataset/trade/ohlcv) ### [hashtag](https://astralane.gitbook.io/docs/products-wiki-zh/shu-ju-guan-dao/wo-men-de-chan-pin/k-xian-ohlcv-jie-kou#get-pool_address-interval-interval-and-from-timestamp-and-to-timestamp) GET/`{pool_address}`?interval=`{interval}`&from=`{timestamp}`&to=`{timestamp}` ### [hashtag](https://astralane.gitbook.io/docs/products-wiki-zh/shu-ju-guan-dao/wo-men-de-chan-pin/k-xian-ohlcv-jie-kou#cha-xun-can-shu-query-parameters) 查询参数(Query Parameters) 参数 类型 描述 `interval` string K 线时间粒度`(e.g., 1s, 1m, 5m, 15m, 1h, etc.).` `pool` string 目标池子的地址。 `from` number 起始时间戳(UNIX 秒)。 `to` number 结束时间戳(UNIX 秒)。 ### [hashtag](https://astralane.gitbook.io/docs/products-wiki-zh/shu-ju-guan-dao/wo-men-de-chan-pin/k-xian-ohlcv-jie-kou#zhi-chi-de-shi-jian-li-du-supported-intervals) 支持的时间粒度(Supported Intervals) 简写 粒度 1s 1 SECOND 5s 5 SECONDS 15s 15 SECONDS 1m 1 MINUTE 3m 3 MINUTES 5m 5 MINUTES 15m 15 MINUTES 30m 30 MINUTES 1H 1 HOUR 4H 4 HOURS 6H 6 HOURS 8H 8 HOURS 12H 12 HOURS 1D 1 DAY circle-exclamation 参数区分大小写(Params are case-sensitive)。 ### [hashtag](https://astralane.gitbook.io/docs/products-wiki-zh/shu-ju-guan-dao/wo-men-de-chan-pin/k-xian-ohlcv-jie-kou#xiang-ying-zi-duan) 响应字段 参数 类型 描述 `time` number UNIX 时间戳 (seconds). `open` number 该周期的开盘价(以计价代币计价)。 `high` number 该周期的最高价(以计价代币计价)。 `low` number 该周期的最低价(以计价代币计价)。 `close` number 该周期的收盘价(以计价代币计价)。 `volume` number 该周期的成交量(以计价代币计量)。 `volue_usd` number 该周期的成交量(USD 计价)。 ### [hashtag](https://astralane.gitbook.io/docs/products-wiki-zh/shu-ju-guan-dao/wo-men-de-chan-pin/k-xian-ohlcv-jie-kou#shi-li-qing-qiu) 示例请求 ### [hashtag](https://astralane.gitbook.io/docs/products-wiki-zh/shu-ju-guan-dao/wo-men-de-chan-pin/k-xian-ohlcv-jie-kou#xiang-ying-shi-li) 响应示例 [上一页最新Dex流动性池接口chevron-left](https://astralane.gitbook.io/docs/products-wiki-zh/shu-ju-guan-dao/wo-men-de-chan-pin/dex-liu-dong-xing-chi-jie-kou/zui-xin-dex-liu-dong-xing-chi-jie-kou) [下一页Websocket - 代币价格chevron-right](https://astralane.gitbook.io/docs/products-wiki-zh/shu-ju-guan-dao/wo-men-de-chan-pin/websocket-dai-bi-jia-ge) 最后更新于 6个月前 * [GET/{pool\_address}?interval={interval}&from={timestamp}&to={timestamp}](https://astralane.gitbook.io/docs/products-wiki-zh/shu-ju-guan-dao/wo-men-de-chan-pin/k-xian-ohlcv-jie-kou#get-pool_address-interval-interval-and-from-timestamp-and-to-timestamp) * [查询参数(Query Parameters)](https://astralane.gitbook.io/docs/products-wiki-zh/shu-ju-guan-dao/wo-men-de-chan-pin/k-xian-ohlcv-jie-kou#cha-xun-can-shu-query-parameters) * [支持的时间粒度(Supported Intervals)](https://astralane.gitbook.io/docs/products-wiki-zh/shu-ju-guan-dao/wo-men-de-chan-pin/k-xian-ohlcv-jie-kou#zhi-chi-de-shi-jian-li-du-supported-intervals) * [响应字段](https://astralane.gitbook.io/docs/products-wiki-zh/shu-ju-guan-dao/wo-men-de-chan-pin/k-xian-ohlcv-jie-kou#xiang-ying-zi-duan) * [示例请求](https://astralane.gitbook.io/docs/products-wiki-zh/shu-ju-guan-dao/wo-men-de-chan-pin/k-xian-ohlcv-jie-kou#shi-li-qing-qiu) * [响应示例](https://astralane.gitbook.io/docs/products-wiki-zh/shu-ju-guan-dao/wo-men-de-chan-pin/k-xian-ohlcv-jie-kou#xiang-ying-shi-li) sun-brightdesktopmoon 复制 GET /api/v1/dataset/trade/ohlcv/58oQChx4yWmvKdwLLZzBi4ChoCc2fqCUWBkwMihLYQo2?interval=1m&from=1736790000&to=1736793600 复制 header:{ x-api-key: } 复制 curl --location '' \\ --header 'x-api-key: ' 复制 [\ {\ "time": 1736791800,\ "open": 177.88,\ "high": 178.12,\ "low": 177.76,\ "close": 178.00,\ "volume": 123.45,\ "volume_usd": 22000.00\ },\ {\ "time": 1736791860,\ "open": 178.00,\ "high": 178.25,\ "low": 177.95,\ "close": 178.15,\ "volume": 150.30,\ "volume_usd": 27000.50\ }\ ] sun-brightdesktopmoon --- # Websocket - 代币价格 | Astralane 该 WebSocket API 按代币维度提供实时价格更新。客户端可订阅指定代币,持续接收价格变动推送。 ### [hashtag](https://astralane.gitbook.io/docs/products-wiki-zh/shu-ju-guan-dao/wo-men-de-chan-pin/websocket-dai-bi-jia-ge#id-1.-lian-jie-liu-cheng) 1\. 连接流程 建立 WebSocket 连接:`wss://ws.price.astralane.io/price-by-token` * 在请求头中携带 `x-api-key`(你的 API Key) * 发送订阅请求,包含希望订阅的代币列表 * 监听与订阅房间类型对应的事件,接收实时价格更新 ### [hashtag](https://astralane.gitbook.io/docs/products-wiki-zh/shu-ju-guan-dao/wo-men-de-chan-pin/websocket-dai-bi-jia-ge#id-2.-shi-li-dai-ma) 2\. 示例代码 复制 const WebSocket = require('ws'); const tokens = [\ "So11111111111111111111111111111111111111112", \ "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"\ ]; const socket = new WebSocket('wss://ws.price.astralane.io/price-by-token', { headers: { 'x-api-key': 'YOUR-API-KEY' } }); let messageCount = 0; let unsubscribeTimeout; const subscribeEvent = { event: "subscribe", tokens: tokens, }; const unsubscribeEvent = { event: "unsubscribe", tokens: tokens, }; socket.on('open', function() { console.log('Connected to server'); console.log('Subscribing to tokens:', tokens); socket.send(JSON.stringify(subscribeEvent)); // 60 秒后取消订阅 unsubscribeTimeout = setTimeout(() => { console.log('Unsubscribing after 60 seconds...'); socket.send(JSON.stringify(unsubscribeEvent)); socket.close(); }, 60000); }); socket.on('message', function(data) { messageCount++; console.log(`Received message #${messageCount}`); try { const parsedData = JSON.parse(data.toString()); console.log('Parsed data:', parsedData); } catch (e) { console.log('Raw data (not JSON):', data.toString()); } }); socket.on('error', function(error) { console.error('WebSocket error:', error); clearTimeout(unsubscribeTimeout); }); socket.on('close', function(code, reason) { console.log(`Connection closed: [${code}] ${reason}`); console.log(`Total messages received: ${messageCount}`); clearTimeout(unsubscribeTimeout); }); ### [hashtag](https://astralane.gitbook.io/docs/products-wiki-zh/shu-ju-guan-dao/wo-men-de-chan-pin/websocket-dai-bi-jia-ge#id-2.1-xiang-ying-shi-li) 2.1 响应示例 ### [hashtag](https://astralane.gitbook.io/docs/products-wiki-zh/shu-ju-guan-dao/wo-men-de-chan-pin/websocket-dai-bi-jia-ge#id-3.-duan-xian-zhong-lian) **3\.** 断线重连 若发生断线,客户端需自动重连并重新订阅,确保持续接收不间断的实时更新。5 [上一页K线OHLCV接口chevron-left](https://astralane.gitbook.io/docs/products-wiki-zh/shu-ju-guan-dao/wo-men-de-chan-pin/k-xian-ohlcv-jie-kou) [下一页交易数据 - Dex 交易chevron-right](https://astralane.gitbook.io/docs/products-wiki-zh/shu-ju-guan-dao/wo-men-de-chan-pin/jiao-yi-shu-ju-dex-jiao-yi) 最后更新于 6个月前 * [1\. 连接流程](https://astralane.gitbook.io/docs/products-wiki-zh/shu-ju-guan-dao/wo-men-de-chan-pin/websocket-dai-bi-jia-ge#id-1.-lian-jie-liu-cheng) * [2\. 示例代码](https://astralane.gitbook.io/docs/products-wiki-zh/shu-ju-guan-dao/wo-men-de-chan-pin/websocket-dai-bi-jia-ge#id-2.-shi-li-dai-ma) * [2.1 响应示例](https://astralane.gitbook.io/docs/products-wiki-zh/shu-ju-guan-dao/wo-men-de-chan-pin/websocket-dai-bi-jia-ge#id-2.1-xiang-ying-shi-li) * [3\. 断线重连](https://astralane.gitbook.io/docs/products-wiki-zh/shu-ju-guan-dao/wo-men-de-chan-pin/websocket-dai-bi-jia-ge#id-3.-duan-xian-zhong-lian) sun-brightdesktopmoon 复制 { "timestamp": "1741771359", "decimals": 9, "name": "Wrapped SOL", "symbol": "SOL", "uri": "https://raw.githubusercontent.com/solana-labs/token-list/main/assets/mainnet/So11111111111111111111111111111111111111112/logo.png", "supply": 509384498.1158462, "price_in_sol": 1, "price_in_usd": 124.3285941413753, "token": "So11111111111111111111111111111111111111112" } sun-brightdesktopmoon --- # 交易数据 - Dex 交易 | Astralane DEX Trades API 会解析所有已索引的 Solana 交易,允许用户在指定的区块 slot 区间内查询并获取去中心化交易所(DEX)的成交记录。你可以通过 program\_id、start\_block 与 end\_block 过滤结果,以检索更细粒度的成交数据。 **基础地址(Base URL)** `POST` [`https://graphql.astralane.io/api/v1/dataset/dex/dex-trades/graphql`arrow-up-right](https://graphql.astralane.io/api/v1/dataset/dex/dex-trades/graphql) **支持的 DEX 列表** [`https://audacelabs.notion.site/Supported-DEXes-and-Indexed-Data-14b2d9037ca78058ab32f8207665e53e?pvs=4`arrow-up-right](https://audacelabs.notion.site/Supported-DEXes-and-Indexed-Data-14b2d9037ca78058ab32f8207665e53e?pvs=4) **Note**: 注意:单次请求支持的最大区块范围为 100 个区块(例如从 `317380000` 到 `317380100`)。 ### [hashtag](https://astralane.gitbook.io/docs/products-wiki-zh/shu-ju-guan-dao/wo-men-de-chan-pin/jiao-yi-shu-ju-dex-jiao-yi#shu-ju-ke-yong-xing-data-availability) 数据可用性(Data availability) **最早区块:**`65304730`(2021-02-14) **最新区块:**较最新区块约 15 秒平均延迟 ### [hashtag](https://astralane.gitbook.io/docs/products-wiki-zh/shu-ju-guan-dao/wo-men-de-chan-pin/jiao-yi-shu-ju-dex-jiao-yi#cha-xun-shi-li) 查询示例 复制 query DexTradeResult { dexTrades( start_block: 317380000 end_block: 317380000 program: "JUP6LkbZbjS1jKKwapdHNy74zcZ3tLUZoi5QNyVTaV4" ) { tx_id block_time block_slot signer pool_address base_mint quote_mint base_vault quote_vault base_amount quote_amount is_inner_instruction instruction_index instruction_type inner_instruction_index outer_program inner_program txn_fee_lamports } } ### [hashtag](https://astralane.gitbook.io/docs/products-wiki-zh/shu-ju-guan-dao/wo-men-de-chan-pin/jiao-yi-shu-ju-dex-jiao-yi#shi-li-xiang-ying) **示例响应:** ### [hashtag](https://astralane.gitbook.io/docs/products-wiki-zh/shu-ju-guan-dao/wo-men-de-chan-pin/jiao-yi-shu-ju-dex-jiao-yi#zi-duan-shuo-ming-response-fields) 字段说明(Response Fields) * `**block_time**`:区块时间戳。 * `**block_slot**`:区块的 slot 编号。 * `**tx_id**`:交易哈希。 * `**signer**`:交易签名者地址。 * `**pool_address**`:池子地址。 * `**base_mint**`:基础代币(base)mint 地址。 * `**quote_mint**`:计价代币(quote)mint 地址。 * `**base_vault**`:基础代币金库地址。 * `**quote_vault**`:计价代币金库地址。 * `**base_amount**`:本次成交涉及的基础代币数量。 * `**quote_amount**`:本次成交涉及的计价代币数量。 * `**is_inner_instruction**`:是否为内部指令(inner instruction)。 * `**instruction_index**`:该指令在交易中的索引。 * `**instruction_type**`:指令类型。 * `**outer_program**`:外层程序 ID。 * `**inner_program**`:内层程序 ID(如适用)。 * `**txn_fee_lamports**`:交易手续费(以 lamports 计)。 * `**signer_lamports_change**`:签名者的 lamports 变动。 * `**partition_0**`:按日期分区标记。 [上一页Websocket - 代币价格chevron-left](https://astralane.gitbook.io/docs/products-wiki-zh/shu-ju-guan-dao/wo-men-de-chan-pin/websocket-dai-bi-jia-ge) [下一页PnL 索引器chevron-right](https://astralane.gitbook.io/docs/products-wiki-zh/shu-ju-guan-dao/wo-men-de-chan-pin/pnl-suo-yin-qi) 最后更新于 6个月前 * [数据可用性(Data availability)](https://astralane.gitbook.io/docs/products-wiki-zh/shu-ju-guan-dao/wo-men-de-chan-pin/jiao-yi-shu-ju-dex-jiao-yi#shu-ju-ke-yong-xing-data-availability) * [查询示例](https://astralane.gitbook.io/docs/products-wiki-zh/shu-ju-guan-dao/wo-men-de-chan-pin/jiao-yi-shu-ju-dex-jiao-yi#cha-xun-shi-li) * [示例响应:](https://astralane.gitbook.io/docs/products-wiki-zh/shu-ju-guan-dao/wo-men-de-chan-pin/jiao-yi-shu-ju-dex-jiao-yi#shi-li-xiang-ying) * [字段说明(Response Fields)](https://astralane.gitbook.io/docs/products-wiki-zh/shu-ju-guan-dao/wo-men-de-chan-pin/jiao-yi-shu-ju-dex-jiao-yi#zi-duan-shuo-ming-response-fields) sun-brightdesktopmoon 复制 [\ {\ "block_time": "2024-08-13T00:04:09",\ "block_slot": 283239907,\ "tx_id": "3heh6YsGgM8WK1U1hEF7c26RKpMui2ZyeopmmQEX4PtwzWFRAadahJaVGWX31is9ufTHkEGN9GWwR1mxqencUS8c",\ "signer": "3eEuBoFRznqL6DUCVZpuWdJWeg7AfRdJSY3732PDSBuP",\ "pool_address": "CEGPBQJ6nYkDCiBP8AQ1LsPTj3bqhw34PKskzJiJgt6H",\ "base_mint": "So11111111111111111111111111111111111111112",\ "quote_mint": "3yvwMGa3ap49DWquMEpf7Mrvq85N4gjXsdehFPRRpump",\ "base_vault": "BW8fXFoEGbhRf1LpdX53Ems3BHWdCNaTdyAR6XxmpNQa",\ "quote_vault": "7xynyUq3VVAKVgBbgnb4ssofcMpX3EiRsiadFWsc2XmR",\ "base_amount": -0.000016546,\ "quote_amount": 87.64461,\ "is_inner_instruction": false,\ "instruction_index": 4,\ "instruction_type": "SwapBaseIn",\ "inner_instruxtion_index": 0,\ "outer_program": "675kPX9MHTjS2zt1qfr1NYHuzeLXfQM9H24wFSUt1Mp8",\ "inner_program": "",\ "txn_fee_lamports": 23990,\ "signer_lamports_change": -23990,\ "partition_0": "2024-08-13"\ }\ ] sun-brightdesktopmoon --- # PnL 索引器 | Astralane **Solana Account Indexer** 是一款专用工具,可在指定的历史或当前时间范围内,精准追踪并计算任意 Solana 账户的盈亏(PnL)。索引器采用先进先出(FIFO)会计方法,生成累计与按日维度的 PnL 指标,帮助用户同时把握长期收益/亏损与日常表现变化。 ### [hashtag](https://astralane.gitbook.io/docs/products-wiki-zh/shu-ju-guan-dao/wo-men-de-chan-pin/pnl-suo-yin-qi#gong-neng-te-xing) **功能特性** * **累计 PnL(Cumulative PnL)**:在指定时间范围内,汇总该账户所有交易的总盈亏,全景展示整体账户表现。 * **每日 PnL(Daily PnL)**:提供逐日盈亏明细,便于评估日度表现并识别短期趋势。 ### [hashtag](https://astralane.gitbook.io/docs/products-wiki-zh/shu-ju-guan-dao/wo-men-de-chan-pin/pnl-suo-yin-qi#fang-fa-lun) **方法论** **FIFO(先进先出)计算:** 将每笔资产流出(如卖出、兑换)与最早获取的持仓一一匹配,确保成本计算一致与准确。通过将交易按时间顺序系统化匹配,FIFO 能精确反映已实现盈亏,在波动行情下亦能保持清晰可解释。 **PnL 计算口径** * **已实现盈亏(Realized PnL)**:基于 FIFO,将每笔卖出/转出与最早购入的持仓匹配,准确记录处置时点的盈亏。 * **未实现盈亏(Unrealized PnL)**:将当前持有资产的市值与其历史成本对比,反映潜在收益或亏损。 * **日度跟踪(Daily Tracking)**:按日监控已实现与未实现盈亏,为当日累计财务表现提供细粒度可视化。 **技术要点(Technical Insights)** * **交易解析(Transaction Parsing):**系统化解析账户交易,准确识别充值、提现、资产兑换等活动,构建完整的交易历史。 * **价格更新(Price Updates):**为确保日度 PnL 精度,按设定时间点(如收盘/日终)获取代币价格,用于未实现盈亏估值。 * **日切(Daily Rollover):**每日滚动更新,记录新的 PnL 数据并拉取最新价格,形成连续、可靠的历史序列,便于趋势分析。 **典型场景(Use Cases)** * **个人账户分析:**全面洞察个人交易活动与绩效。 * **资产组合管理:**帮助投资经理精准监控、分析并出具每日盈亏报表。 * **税务申报:**提供详细的历史已实现盈亏数据,简化合规申报与报告。 ### [hashtag](https://astralane.gitbook.io/docs/products-wiki-zh/shu-ju-guan-dao/wo-men-de-chan-pin/pnl-suo-yin-qi#zai-xian-shi-yong-swagger-wen-dang) 在线试用(Swagger 文档) * 管理端 Admin API 文档:[https://indexer.astralane.io/api-docs#/arrow-up-right](https://indexer.astralane.io/api-docs#/) * 数据查询 Index Data API 文档:[https://graphql.astralane.io/api-docsarrow-up-right](https://graphql.astralane.io/api-docs) 该索引器提供一组 API,用于初始化索引、回填历史交易数据,并获取任意账户的累计与每日 PnL 指标。 ### [hashtag](https://astralane.gitbook.io/docs/products-wiki-zh/shu-ju-guan-dao/wo-men-de-chan-pin/pnl-suo-yin-qi#suo-yin-chuang-jian-liu-cheng-index-creation-flow) 索引创建流程(Index creation flow) 1. **创建新索引(Create New Index) POST** `{admin-base-url}/index/pnl` **用途:**初始化一个新的 PnL 跟踪索引。 2. **启动回填任务(Start Backfill Job) POST** `{admin-base-url}/index/{index_id}/backfill` **用途:**根据指定 index\_id 启动历史数据回填,补齐对应的 PnL 数据。 3. **查询回填状态(Check Backfill Status)** **GET** `{admin-base-url}/index/{index_id}/backfill` **用途:**查看该 index 的回填进度与当前状态。 4. **获取累计 PnL(Fetch Cumulative PnL Data)** **GET** `{index-dataset-url}/api/v1/dataset/cumulative-pnl/{index_id}` **用途:**按指定时间范围,返回该 index 的累计盈亏数据。 5. **获取每日 PnL(Fetch Daily PnL Data)** **GET** `{index-dataset-url}/api/v1/dataset/daily-pnl/{index_id}` **用途:**按指定时间范围,返回该 index 的逐日盈亏数据。 ### [hashtag](https://astralane.gitbook.io/docs/products-wiki-zh/shu-ju-guan-dao/wo-men-de-chan-pin/pnl-suo-yin-qi#suo-yin-chuang-jian-shi-li-index-creation-example) 索引创建示例(Index creation example) **admin-base-url:** [https://indexer.astralane.io/arrow-up-right](https://indexer.astralane.io/) **index-dataset-url:** [https://graphql.astralane.io/arrow-up-right](https://graphql.astralane.io/) ### [hashtag](https://astralane.gitbook.io/docs/products-wiki-zh/shu-ju-guan-dao/wo-men-de-chan-pin/pnl-suo-yin-qi#id-1.-chuang-jian-xin-suo-yin-createanew-index) 1\. 创建新索引(Create a New Index) **POST** `{admin-base}/index/pnl` **Headers**:`x-api-key: ` **查询示例:** **说明:**为指定账户与日期范围初始化一个新的 PnL 索引。 **示例响应:** **请求载荷说明(Payload Details)** `**name**` * **描述:**索引的人性化名称,便于后续检索与引用。 * **示例:**"My Main Wallet Portfolio" * **目的:**按账户/组合/用途清晰标注并组织索引。 `**filters**` * **描述:**过滤条件数组,定义哪些交易将被纳入索引。 * **目的:**通过指定`列`与`谓词`,实现精确的数据筛选。 * **组成:**每个过滤器包含 `column` 字段与 `predicates` 数组。 **过滤器 1:账户过滤(Account ID Filter)** * `**column**`: `**"account_id"**` * **描述**:按 `account_id` 列过滤,仅纳入该账户的交易。 * `**predicates**`: * **类型**:`"eq"`(等于)— 精确匹配指定的 `account_id` * **值**:包含用户 Solana **账户地址**的数组 * **用户要素**:账户地址唯一标识用户的钱包 * **示例值**:`"4BjxyW2GTD1qBwUk96mAR7dV1A3Pq51hPx78WLqrXegX"` * **目的**:仅纳入目标账户相关的数据。 **过滤器 2:时间过滤(Time Filter)** * `**column**`: `"``**time**``"` * **描述**:按时间列过滤,限定交易的起止时间范围。 * `**predicates**`:包含两个条件 * **1 - 大于(**`**gt**`**):** * **类型**:`"gt"` * **描述**:区间起点,Unix 时间戳(秒) * **用户自定义时间戳:**用户定义的起始日期时间。 * **示例**:`"1718148102"` * **2 - 小于(I**`**t**`**):** * **类型**:`"lt"` * **描述**:区间终点,Unix 时间戳(秒) * **用户自定义元素:**结束时间戳由用户指定,代表所需时间范围的上限。 * **示例**:"1718339227" * **目的**:仅纳入落在用户自定义时间范围内的交易。该时间窗口完全可配置,便于围绕特定时期开展定制化分析。 ### [hashtag](https://astralane.gitbook.io/docs/products-wiki-zh/shu-ju-guan-dao/wo-men-de-chan-pin/pnl-suo-yin-qi#id-2.-qi-dong-hui-tian-ren-wu) 2\. 启动回填任务 **POST** `{admin-base-url}/index/{index_id}/backfill` **Headers**:`x-api-key`: `` **URL Parameters**: `index_id`: 上一步创建索引返回的 ID **查询示例:** **说明:**为指定 index\_id 启动回填,抓取与处理历史数据以生成对应的 PnL 记录。 **Sample Response**: ### [hashtag](https://astralane.gitbook.io/docs/products-wiki-zh/shu-ju-guan-dao/wo-men-de-chan-pin/pnl-suo-yin-qi#id-3.-cha-xun-hui-tian-zhuang-tai) 3\. 查询回填状态 **GET** `{admin-base-url}/index/{index_id}/backfill` **Headers**:`x-api-key`: `` **URL Parameters**: `index_id`: 要查询回填状态的索引 ID **说明:**返回回填任务的当前状态与进度,便于跟踪直至完成。 **示例响应:** ### [hashtag](https://astralane.gitbook.io/docs/products-wiki-zh/shu-ju-guan-dao/wo-men-de-chan-pin/pnl-suo-yin-qi#id-4.-huo-qu-lei-ji-pnl) **4\.** 获取累计 PnL **GET** `{index-dataset-url}/api/v1/dataset/cumulative-pnl/{index_id}` **Headers**:`x-api-key`: `` **URL 参数:** `index_id`: 要查询的索引唯一标识 **说明:**返回指定索引在给定日期范围内的累计盈亏概览。 **示例响应:** ### [hashtag](https://astralane.gitbook.io/docs/products-wiki-zh/shu-ju-guan-dao/wo-men-de-chan-pin/pnl-suo-yin-qi#id-5.-huo-qu-ri-du-pnl) **5\.** 获取日度 PnL **GET** `{index-dataset-url}/api/v1/dataset/daily-pnl/{index_id}` **Headers**:`x-api-key`: `` **URL参数:** `index_id`: 要拉取日度 PnL 的索引 ID(唯一标识) **URL Parameters:** * **index\_id:** 要拉取日度 PnL 的索引 ID(唯一标识) * **Description:** 返回指定索引在定义日期范围内的日度 PnL 数据,提供逐日细化的绩效洞察。 **示例响应:** [上一页交易数据 - Dex 交易chevron-left](https://astralane.gitbook.io/docs/products-wiki-zh/shu-ju-guan-dao/wo-men-de-chan-pin/jiao-yi-shu-ju-dex-jiao-yi) [下一页历史代币余额索引器chevron-right](https://astralane.gitbook.io/docs/products-wiki-zh/shu-ju-guan-dao/wo-men-de-chan-pin/li-shi-dai-bi-yuesuo-yin-qi) 最后更新于 6个月前 * [功能特性](https://astralane.gitbook.io/docs/products-wiki-zh/shu-ju-guan-dao/wo-men-de-chan-pin/pnl-suo-yin-qi#gong-neng-te-xing) * [方法论](https://astralane.gitbook.io/docs/products-wiki-zh/shu-ju-guan-dao/wo-men-de-chan-pin/pnl-suo-yin-qi#fang-fa-lun) * [在线试用(Swagger 文档)](https://astralane.gitbook.io/docs/products-wiki-zh/shu-ju-guan-dao/wo-men-de-chan-pin/pnl-suo-yin-qi#zai-xian-shi-yong-swagger-wen-dang) * [索引创建流程(Index creation flow)](https://astralane.gitbook.io/docs/products-wiki-zh/shu-ju-guan-dao/wo-men-de-chan-pin/pnl-suo-yin-qi#suo-yin-chuang-jian-liu-cheng-index-creation-flow) * [索引创建示例(Index creation example)](https://astralane.gitbook.io/docs/products-wiki-zh/shu-ju-guan-dao/wo-men-de-chan-pin/pnl-suo-yin-qi#suo-yin-chuang-jian-shi-li-index-creation-example) * [1\. 创建新索引(Create a New Index)](https://astralane.gitbook.io/docs/products-wiki-zh/shu-ju-guan-dao/wo-men-de-chan-pin/pnl-suo-yin-qi#id-1.-chuang-jian-xin-suo-yin-createanew-index) * [2\. 启动回填任务](https://astralane.gitbook.io/docs/products-wiki-zh/shu-ju-guan-dao/wo-men-de-chan-pin/pnl-suo-yin-qi#id-2.-qi-dong-hui-tian-ren-wu) * [3\. 查询回填状态](https://astralane.gitbook.io/docs/products-wiki-zh/shu-ju-guan-dao/wo-men-de-chan-pin/pnl-suo-yin-qi#id-3.-cha-xun-hui-tian-zhuang-tai) * [4\. 获取累计 PnL](https://astralane.gitbook.io/docs/products-wiki-zh/shu-ju-guan-dao/wo-men-de-chan-pin/pnl-suo-yin-qi#id-4.-huo-qu-lei-ji-pnl) * [5\. 获取日度 PnL](https://astralane.gitbook.io/docs/products-wiki-zh/shu-ju-guan-dao/wo-men-de-chan-pin/pnl-suo-yin-qi#id-5.-huo-qu-ri-du-pnl) sun-brightdesktopmoon 复制 { "name": "My Main Wallet Porfolio", "filters": [\ {\ "column": "account_id",\ "predicates": [\ {\ "type": "eq",\ "value": [\ "AmTRLjX9T8KktBBnw1F78DyDb17fr6L8BNpEgCPGs5eM"\ ]\ }\ ]\ },\ {\ "column": "time",\ "predicates": [\ {\ "type": "gt",\ "value": [\ "1725148800"\ ]\ },\ {\ "type": "lt",\ "value": [\ "1730505600"\ ]\ }\ ]\ }\ ] } 复制 { "message": "Index was created", "id": "ec5b37a2-c577-4e89-b5aa-077e10771419" } 复制 { "action": "start" } 复制 { "action_type": "start", "index_id": "ec5b37a2-c577-4e89-b5aa-077e10771419" } 复制 { "index_id": "a82a9871-54ee-4adb-9bd6-5dfcd418b2ae", "start_time": "2024-10-26 20:36:28.000", "update_time": "2024-10-26 20:37:03.000", "status": "completed", "percentage": 1, "last_processed_block": 7, "starting_block": 0, "error_code": 0, "error_message": "" } 复制 { "slot_start": "297410893", "slot_end": "297518104", "time_from": "2024-10-24 00:00:00", "time_to": "2024-10-26 23:23:23", "realized_pnl_usd": 193167.09600963892, "unrealized_pnl_usd": 671366.3884107296, "tokens_traded": [\ {\ "timestamp": "2024-10-24 16:11:04",\ "block_slot": "297450632",\ "transaction_id": "qSBkprVyGvKeA64rnNycFWDhQEvzt84FKHYC97JREgQwEBivF543zS78zxDaNipSyjEx2n6tRLZnk8KDkQKvdwy",\ "mint": "So11111111111111111111111111111111111111112",\ "shares": 79.18219076,\ "trade_type": "BUY",\ "dex_name": " ",\ "price_in_usd": 176.5638905707737,\ "token_running_balance": 13980.715664502766\ },\ {\ "timestamp": "2024-10-24 21:37:06",\ "block_slot": "297493708",\ "transaction_id": "45KVtqCfwUBDDRFRGLqnypu2qdCaVpYQp2Pa6vFgnYrnbNA85Ye3KDxWoJFRe6a25nmvHcYn47wLjx52ZFoGB3P7",\ "mint": "Bz4MhmVRQENiCou7ZpJ575wpjNFjBjVBSiVhuNg1pump",\ "shares": 3683402.913021,\ "trade_type": "SELL",\ "dex_name": " ",\ "price_in_usd": 0.017859178498502083,\ "token_running_balance": 65782.55010554458\ },\ {\ "timestamp": "2024-10-24 21:37:06",\ "block_slot": "297493708",\ "transaction_id": "45KVtqCfwUBDDRFRGLqnypu2qdCaVpYQp2Pa6vFgnYrnbNA85Ye3KDxWoJFRe6a25nmvHcYn47wLjx52ZFoGB3P7",\ "mint": "So11111111111111111111111111111111111111112",\ "shares": 293.220454318,\ "trade_type": "BUY",\ "dex_name": " ",\ "price_in_usd": 177.8712714605693,\ "token_running_balance": 52155.495027788435\ },\ {\ "timestamp": "2024-10-24 21:38:54",\ "block_slot": "297493954",\ "transaction_id": "5Y2LXVRMby1HmjmUoMbKtCLicYGPgagZDwv1sMFLw7FH2K56Y4UBWN43E8nQAPKhV8dd9KwN6vm3RyPiPgcRNL56",\ "mint": "Bz4MhmVRQENiCou7ZpJ575wpjNFjBjVBSiVhuNg1pump",\ "shares": 3315062.621719,\ "trade_type": "SELL",\ "dex_name": " ",\ "price_in_usd": 0.017859178498502083,\ "token_running_balance": 59204.29509499189\ },\ {\ "timestamp": "2024-10-24 21:38:54",\ "block_slot": "297493954",\ "transaction_id": "5Y2LXVRMby1HmjmUoMbKtCLicYGPgagZDwv1sMFLw7FH2K56Y4UBWN43E8nQAPKhV8dd9KwN6vm3RyPiPgcRNL56",\ "mint": "So11111111111111111111111111111111111111112",\ "shares": 229.160980905,\ "trade_type": "BUY",\ "dex_name": " ",\ "price_in_usd": 177.8712714605693,\ "token_running_balance": 40761.155042723585\ }\ \ ], "tokens_not_traded": [\ {\ "timestamp": "2024-10-24 11:11:05",\ "block_slot": "297410893",\ "transaction_id": "3ndGPr6rPVCmakD5BjECCcknXggWMmbV4b4JaGvxMBxSaKeMdJpFQwQyiCKt9vBww8BDLkyaRk3yf5faxK3tbq7m",\ "mint": "So11111111111111111111111111111111111111112",\ "shares": 4,\ "trade_type": "SELL",\ "dex_name": " ",\ "price_in_usd": 172.2682353857461,\ "token_running_balance": 689.0729415429844\ },\ {\ "timestamp": "2024-10-24 14:31:21",\ "block_slot": "297437409",\ "transaction_id": "4mQbHRRdDhFDkyTiFaTYets7ZNYLgCM53BmopS5hQvxeSLUZr3ZbcG1oxA2U62fXURbp4eiwCjNUdrmABd7SzTYc",\ "mint": "So11111111111111111111111111111111111111112",\ "shares": 6,\ "trade_type": "SELL",\ "dex_name": " ",\ "price_in_usd": 175.5622513596877,\ "token_running_balance": 1053.373508158126\ }\ ] } 复制 [\ {\ "date": "2024-10-24",\ "realized_pnl": -1594473.0642288465,\ "unrealized_pnl": -3018.3074229327203,\ "tokens_traded": [\ \ {\ "timestamp": "2024-10-24 14:31:21",\ "block_slot": "297437409",\ "transaction_id": "4mQbHRRdDhFDkyTiFaTYets7ZNYLgCM53BmopS5hQvxeSLUZr3ZbcG1oxA2U62fXURbp4eiwCjNUdrmABd7SzTYc",\ "mint": "Bz4MhmVRQENiCou7ZpJ575wpjNFjBjVBSiVhuNg1pump",\ "shares": 45395648.422744,\ "trade_type": "BUY",\ "dex_name": " ",\ "price_in_usd": 0.0005947846472226818,\ "token_running_balance": 27000.63473256668\ },\ {\ "timestamp": "2024-10-24 14:31:21",\ "block_slot": "297437409",\ "transaction_id": "4mQbHRRdDhFDkyTiFaTYets7ZNYLgCM53BmopS5hQvxeSLUZr3ZbcG1oxA2U62fXURbp4eiwCjNUdrmABd7SzTYc",\ "mint": "So11111111111111111111111111111111111111112",\ "shares": 6,\ "trade_type": "SELL",\ "dex_name": " ",\ "price_in_usd": 175.5622513596877,\ "token_running_balance": 1053.373508158126\ },\ {\ "timestamp": "2024-10-24 16:11:04",\ "block_slot": "297450632",\ "transaction_id": "qSBkprVyGvKeA64rnNycFWDhQEvzt84FKHYC97JREgQwEBivF543zS78zxDaNipSyjEx2n6tRLZnk8KDkQKvdwy",\ "mint": "Bz4MhmVRQENiCou7ZpJ575wpjNFjBjVBSiVhuNg1pump",\ "shares": 8561619.292529,\ "trade_type": "SELL",\ "dex_name": " ",\ "price_in_usd": 0.0009076950968016275,\ "token_running_balance": 7771.339852510792\ },\ {\ "timestamp": "2024-10-24 16:11:04",\ "block_slot": "297450632",\ "transaction_id": "qSBkprVyGvKeA64rnNycFWDhQEvzt84FKHYC97JREgQwEBivF543zS78zxDaNipSyjEx2n6tRLZnk8KDkQKvdwy",\ "mint": "So11111111111111111111111111111111111111112",\ "shares": 79.18219076,\ "trade_type": "BUY",\ "dex_name": " ",\ "price_in_usd": 176.5638905707737,\ "token_running_balance": 13980.715664502766\ }\ ],\ "tokens_cost_basis": []\ },\ {\ "date": "2024-10-25",\ "realized_pnl": -1764720.7775157518,\ "unrealized_pnl": 0,\ "tokens_traded": [\ {\ "timestamp": "2024-10-25 00:36:13",\ "block_slot": "297517893",\ "transaction_id": "4v1wHSS92iahBveM8FhNXRhbkMvfEdWQ45o173MDJjkpNAbAZmMZeEkcgKoBp5raxkowtFirpCx26MBv2az4BiYU",\ "mint": "Bz4MhmVRQENiCou7ZpJ575wpjNFjBjVBSiVhuNg1pump",\ "shares": 2983556.359547,\ "trade_type": "SELL",\ "dex_name": " ",\ "price_in_usd": 0.014919479377863682,\ "token_running_balance": 44513.1075789555\ },\ {\ "timestamp": "2024-10-25 00:36:13",\ "block_slot": "297517893",\ "transaction_id": "4v1wHSS92iahBveM8FhNXRhbkMvfEdWQ45o173MDJjkpNAbAZmMZeEkcgKoBp5raxkowtFirpCx26MBv2az4BiYU",\ "mint": "So11111111111111111111111111111111111111112",\ "shares": 241.968258132,\ "trade_type": "BUY",\ "dex_name": " ",\ "price_in_usd": 176.6293329283558,\ "token_running_balance": 42738.69202369136\ }\ ],\ "tokens_cost_basis": []\ }\ ] sun-brightdesktopmoon --- # Welcome to Astralane | Astralane ![Page cover](https://astralane.gitbook.io/docs/~gitbook/image?url=https%3A%2F%2Fimages.unsplash.com%2Fphoto-1506818144585-74b29c980d4b%3Fcrop%3Dentropy%26cs%3Dsrgb%26fm%3Djpg%26ixid%3DM3wxOTcwMjR8MHwxfHNlYXJjaHwxfHxzcGVlZHxlbnwwfHx8fDE3MzgyMzk1NTJ8MA%26ixlib%3Drb-4.0.3%26q%3D85&width=1248&dpr=3&quality=100&sign=643a89f8&sv=2) At Astralane, we handle the heavy lifting of Solana infrastructure—so you can focus on innovation. With **global RPC and indexed data** , **ultra-fast transaction speeds** , and **custom solutions** tailored to your needs, we’re here to supercharge your projects. **Let us build the backbone, you change the world!** **Lets get you started ->** [NextQuickStartchevron-right](https://astralane.gitbook.io/docs/low-latency/quickstart) Last updated 1 month ago sun-brightdesktopmoon sun-brightdesktopmoon --- # 前 100 代币持有者 | Astralane **前 100 代币持有者API** 该 API 用于获取任意 SPL 代币的前 100 名持币者,依据其钱包中的当前代币余额进行排名。 **Endpoint** **基础地址(Base URL)**:[`https://graphql.astralane.io/api/v1/dataset`arrow-up-right](https://graphql.astralane.io/api/v1/dataset) **GET** `/token/topHolders/` * **token-address:**SPL 代币地址(例如 SOL 或任意有效的 SPL 代币地址)。 **描述:** 基于当前代币余额,返回持有指定 SPL 代币的前 100 个钱包地址列表。适用于代币分析、持币分布洞察和大户(whale)追踪等场景。 ### [hashtag](https://astralane.gitbook.io/docs/products-wiki-zh/shu-ju-guan-dao/wo-men-de-chan-pin/qian-100-dai-bi-chi-you-zhe#shi-li-xiang-ying) **示例响应:** 复制 { "block_slot": 326645617, "mint": "DCXqS9xMQqoD2cRpqvyu2TxpherRwtd2UDHLKTk7pump", "owner": "5Q544fKrFoe6tsEbD7S8EmxGTJYAKtTVhAW5Q5pge4j1", "post_balance": 151282094.752046, "token_account": "Gru1x7otg6Sr5wcZU2LAaqBQ7XdvRYMDJdmwhiZvxmzA", "partition_0": "2025-03-14" }, { "block_slot": 324358055, "mint": "DCXqS9xMQqoD2cRpqvyu2TxpherRwtd2UDHLKTk7pump", "owner": "FevmaA1vYkUkCJUMfVjGMfLHkKBTatD7gyP671Smy46p", "post_balance": 22719427.69204, "token_account": "7p5Lyqa7uci7Q55pFsxRLhoT9snRQKT6du58DArv3TPe", "partition_0": "2025-03-03" } [上一页历史代币余额索引器chevron-left](https://astralane.gitbook.io/docs/products-wiki-zh/shu-ju-guan-dao/wo-men-de-chan-pin/li-shi-dai-bi-yuesuo-yin-qi) [下一页代币价格接口chevron-right](https://astralane.gitbook.io/docs/products-wiki-zh/shu-ju-guan-dao/wo-men-de-chan-pin/dai-bi-jia-ge-jie-kou) 最后更新于 6个月前 sun-brightdesktopmoon sun-brightdesktopmoon --- # 钱包盈亏接口 | Astralane **钱包盈亏接口**可在自定义时间范围内返回指定钱包的详细盈亏(PnL)洞察,聚合指标包括: * **交易量(Trade Volume)** * **交易次数(Trade Count)** * **胜率(Win Rate)** * **总体盈亏(Overall PnL)** **使用场景(Use Case)** 适用于跟踪与分析单个钱包的交易表现——用于个人投资监控、研究或对标分析。 **Endpoint** `GET /api/v1/dataset/wallet-pnl` **描述** 在选定时间窗口内,返回指定钱包的详细盈亏指标:交易量、交易次数、胜率与总体 PnL,帮助全面评估该钱包的交易表现。 * * * **查询参数(Query Parameters)** * `**time**`:用于计算 PnL 的时间窗口。支持值: * `2h`:2 小时 * `3h`:3 小时 * `5h`:5 小时 * `10h`:10 小时 * `24h`:24 小时 * `**wallet**`(_必填_):要检索 PnL 数据的钱包地址(公钥)。 * * * **示例请求** 该请求返回最近 24 小时内该钱包的 PnL 指标。 **响应格式** API 返回一个 JSON 对象,包含目标钱包的关键绩效指标。 * * * **示例响应** * * * **字段说明** * `**wallet**`:请求中提供的钱包唯一地址。 * `**trade_volume**`:在指定时间窗口内该钱包执行的总交易额(USD)。 * `**trade_count**`:在指定时间窗口内的交易笔数。 * `**win_rate**`:盈利交易的百分比。计算方式: `(盈利笔数 / 卖出金额非零的总交易笔数)× 100` * `**pnl_overview**`:该时间段内的钱包净盈亏(PnL)。 * _正数表示盈利,负数表示亏损。_ * * * **应用场景(Use Cases)** * **个人表现监控:**评估钱包的长期交易表现,发现优势与改进点。 * **投资者尽调:**在投资、合作或镜像交易前,评估目标钱包的历史盈利能力。 * **交易策略分析:**基于真实表现的数据,在钱包层面优化或验证交易策略。 [上一页高收益钱包chevron-left](https://astralane.gitbook.io/docs/products-wiki-zh/shu-ju-guan-dao/wo-men-de-chan-pin/gao-shou-yi-qian-bao) [下一页交易索引器chevron-right](https://astralane.gitbook.io/docs/products-wiki-zh/shu-ju-guan-dao/wo-men-de-chan-pin/jiao-yi-suo-yin-qi) 最后更新于 6个月前 sun-brightdesktopmoon 复制 GET /api/v1/dataset/wallet-pnl?time=24h&wallet=F18ibDvGaj4Yjzk1UfWCk5jE9zoy1JYkXNTCBwPuZpyf HTTP/1.1 Authorization: Bearer YOUR_API_KEY 复制 { "wallet": "F18ibDvGaj4Yjzk1UfWCk5jE9zoy1JYkXNTCBwPuZpyf", "trade_volume": 12500.75, "trade_count": 98, "win_rate": 45, "pnl_overview": 650.32 } sun-brightdesktopmoon --- # Changelogs | Astralane * 7th Aug 2025: NY endpoint was moved to tsw due to firewal throttling and for better hardware access. Old IP 173.231.40.226 will be retired. * 12th Aug 2025: We have added 4 new tip wallet address for better optimizations. * 23rd Sept 2025: Old LAX endpoint (45.32.86.58) has been deprecated, but will be kept alive for users. [PreviousEndpoints and Configschevron-left](https://astralane.gitbook.io/docs/low-latency/endpoints-and-configs) [NextSubmit Transactionschevron-right](https://astralane.gitbook.io/docs/low-latency/submit-transactions) Last updated 6 months ago sun-brightdesktopmoon sun-brightdesktopmoon --- # 高收益钱包 | Astralane **高收益钱包 API** 基于交易活动产出最具表现的钱包洞察,聚合并计算以下关键指标: * **交易量(Trade Volume)** * **交易次数(Trade Count)** * **胜率(Win Rate)** * **总体盈亏(PnL)** 上述指标可按用户自定义时间窗口统计,提供细致的钱包绩效视图。 **使用场景:**识别高绩效交易者、开展竞品/对手盘分析、理解生态内的钱包行为特征。 **查询参数** * `**time**`(_必填_):指定统计时间窗口。支持值: * `2h`:2 小时 * `3h`:3 小时 * `5h`:5 小时 * `10h`:10 小时 * `24h`:24 小时 * `3d`:3 天 * `1W`:1 周 * `**page**`(_可选_):分页页码,**默认** 1 * `**limit**`(_可选_):每页返回的记录条数,**默认** 100 * * * **示例请求** 该请求返回过去 24 小时内最赚钱的前 50 个钱包。 * * * **响应格式** API 返回一个 JSON 数组,每个对象代表一个钱包及其相应绩效指标。 **示例响应** **字段说明(Field Descriptions)** * `**wallet**`:钱包唯一标识(通常为公钥/地址)。 * `**trade_volume**`:在所选时间范围内该钱包执行的总交易额(USD)。 * `**trade_count**`:在所选时间窗口内的总交易笔数。 * `**win_rate**`:盈利交易占比(盈利笔数 / 总笔数,百分比)。 * `**pnl_overview**`:该时间段内钱包的净盈亏(PnL)。为正表示盈利,为负表示亏损。 * * * **应用场景(Use Cases)** * **投资者分析(Investor Analysis)**:识别值得关注或镜像的高绩效钱包。 * **市场研究(Market Research)**:洞察生态中头部钱包的交易行为与表现。 * **竞争情报(Competitive Intelligence)**:比较不同钱包的盈利能力,分析策略并发现市场趋势。 * * * **分页说明(Pagination)** 为处理大数据量,API 支持分页: * `**page**`:结果集的页码。 * `**limit**`:每页返回的记录数。 * **每页最大支持的 limit 值:**100。 [上一页历史代币价格接口chevron-left](https://astralane.gitbook.io/docs/products-wiki-zh/shu-ju-guan-dao/wo-men-de-chan-pin/li-shi-dai-bi-jia-ge-jie-kou) [下一页钱包盈亏接口chevron-right](https://astralane.gitbook.io/docs/products-wiki-zh/shu-ju-guan-dao/wo-men-de-chan-pin/qian-bao-ying-kui-jie-kou) 最后更新于 6个月前 sun-brightdesktopmoon 复制 GET https://graphql.astralane.io/api/v1/dataset/profitable-wallets?time=24h&page=1&limit=50 复制 [\ {\ "wallet": "HmD1XGGXLRnYvq537jmTUuhcRgecZF3NeNoFtnBv5ERX",\ "trade_volume": 15705.95985742,\ "trade_count": 149,\ "win_rate": 40,\ "pnl_overview": 478.16333295\ }\ ] sun-brightdesktopmoon --- # 历史代币价格接口 | Astralane 该 Price API 基于已索引的链上数据,支持以 SOL 与 USD 计价获取代币的历史价格。 **基础地址(Base URL)** [`https://graphql.astralane.io`arrow-up-right](https://graphql.astralane.io/) **Endpoint** `GET /api/v1/dataset/price/history?token=&from=&to=` **参数说明** * **token:**SPL 代币的 mint 地址(原生 SOL 可填写 "SOL")。 * **from:**时间范围起点(Unix 时间戳,单位秒)。 * **to:**时间范围终点(Unix 时间戳,单位秒)。 **注意** * 单次请求支持的最大时间跨度为 100 分钟。 **描述** 在指定时间窗口内返回目标代币的历史价格数据,价格同时以 SOL 与 USD 表示。适用于绘图、分析与时间序列研究。 ### [hashtag](https://astralane.gitbook.io/docs/products-wiki-zh/shu-ju-guan-dao/wo-men-de-chan-pin/li-shi-dai-bi-jia-ge-jie-kou#cha-xun-can-shu) 查询参数 参数 类型 要求 描述 `token` `string` ✅ Yes 要查询历史价格的代币 `token`,填写 SPL 代币的 mint 地址或 "`SOL`"(原生 Solana)。 `from` integer ✅ Yes Unix 时间戳(秒) `to` integer ✅Yes Unix 时间戳(秒) ### [hashtag](https://astralane.gitbook.io/docs/products-wiki-zh/shu-ju-guan-dao/wo-men-de-chan-pin/li-shi-dai-bi-jia-ge-jie-kou#shi-li-qing-qiu) 示例请求 复制 GET /api/v1/dataset/price/history?token=So11111111111111111111111111111111111111112&from=1739577600&to=1739577620 ### [hashtag](https://astralane.gitbook.io/docs/products-wiki-zh/shu-ju-guan-dao/wo-men-de-chan-pin/li-shi-dai-bi-jia-ge-jie-kou#xiang-ying-shi-li) 响应示例 [上一页代币价格接口chevron-left](https://astralane.gitbook.io/docs/products-wiki-zh/shu-ju-guan-dao/wo-men-de-chan-pin/dai-bi-jia-ge-jie-kou) [下一页高收益钱包chevron-right](https://astralane.gitbook.io/docs/products-wiki-zh/shu-ju-guan-dao/wo-men-de-chan-pin/gao-shou-yi-qian-bao) 最后更新于 6个月前 * [查询参数](https://astralane.gitbook.io/docs/products-wiki-zh/shu-ju-guan-dao/wo-men-de-chan-pin/li-shi-dai-bi-jia-ge-jie-kou#cha-xun-can-shu) * [示例请求](https://astralane.gitbook.io/docs/products-wiki-zh/shu-ju-guan-dao/wo-men-de-chan-pin/li-shi-dai-bi-jia-ge-jie-kou#shi-li-qing-qiu) * [响应示例](https://astralane.gitbook.io/docs/products-wiki-zh/shu-ju-guan-dao/wo-men-de-chan-pin/li-shi-dai-bi-jia-ge-jie-kou#xiang-ying-shi-li) sun-brightdesktopmoon 复制 [\ {\ "time": 1739577600,\ "value": 199.42621602747087\ }\ ] sun-brightdesktopmoon --- # QuickStart | Astralane Low latency infrastructure delivering sub-slot transaction propagation for Solana's most demanding operators - from HFTs requiring minimal wire latency to market makers needing reliable execution during peak congestion. Along with leader path optimization, our binary-optimized mesh network provides sub-slot precision data streams. Our dynamic priority system intelligently allocates resources for high-priority operations, backed by enterprise-grade reliability and 24/7 support. Jump to Main sections [wrenchEndpoints and Configschevron-right](https://astralane.gitbook.io/docs/low-latency/endpoints-and-configs) [paper-planeSubmit Transactionschevron-right](https://astralane.gitbook.io/docs/low-latency/submit-transactions) ### [hashtag](https://astralane.gitbook.io/docs/low-latency/quickstart#core-infrastructure) Core Infrastructure * Dual relay system: Transaction + Shred relays * Direct validator integration via SwQoS-enabled connections and direct stake peering * Advanced txn execution system for high txns with tips * Global private fiber network with dynamic leader-aware routing * Binary protocol optimized for minimal serialization overhead ### [hashtag](https://astralane.gitbook.io/docs/low-latency/quickstart#performance-metrics) Performance Metrics * 500ms latency improvement vs standard RPC nodes * 40-50ms overhead reduction in processed transaction receipts * Zero dropped transactions with automatic retry mechanisms * Real-time streaming of account changes within current slot ### [hashtag](https://astralane.gitbook.io/docs/low-latency/quickstart#who-should-use-it-on-solana) **Who Should Use It on Solana:** Astralane provides specialized solutions tailored to the needs of Solana teams: * **Fast Transaction Sending:** Essential for HFTs and Searchers who need fast transaction landing, support for multi-tx batching, rapid transaction execution. * **More Landing Rates:** Essential for Market Makers and Solvers who want reliable transaction execution even during high network congestion times. * **Low Latency Data Streams:** Sub-slot access to raw or parsed transaction data via redundant global paths, with support for shred-based early detection systems. Essential for bot developers seeking optimal signal detection and opportunity capture. * **Cost Efficient Trading Setups:** Essential for trading operations seeking cost-efficient, high-throughput execution with usage-based pricing, delivering enterprise-grade performance at competitive rates. * * * #### [hashtag](https://astralane.gitbook.io/docs/low-latency/quickstart#custom-tpu-client) **Custom TPU client** Instead of going through normal RPC pipeline for transactions, we use a fast and lightweight TPU client that tracks leader schedule and sends transactions directly to the leaders also utilizing staked connection to the leaders. **Dynamic Routing Module:** All traffic that comes to our network are carefully analyzed and dynamically routed to our partner peers which are closest to the leader and utilize on our distributed staked network peers effectively, This is done along dedicated low latency routes which ensures the fastest propagation for the transactions. **Smart Fee Data (Analysis)** We help our clients optimize their transactions, through our enhanced monitoring systems which provides detailed information on how your transactions performed against different leaders, slot latency metrics. **Retries** By default we listen to all transactions confirmations from the network and handle transaction retries on our end to improve the landing rate, These can be modified as well to use custom retry logic as needed by clients. **Higher Priority Txns:** Our high-priority endpoint takes a tip to Astralane address, which in turn routes the transaction through both Jito and our staked peers and races them for the minimum possible latency, even when the current leader is running Jito validator or the native agave client **Atomicity and Tip Refunds:** Custom endpoints to give you a transaction hash which expires in X slots, to ensure transactions are landed within the desired slot for clients. [PreviousWelcome to Astralanechevron-left](https://astralane.gitbook.io/docs) [NextEndpoints and Configschevron-right](https://astralane.gitbook.io/docs/low-latency/endpoints-and-configs) Last updated 1 month ago * [Core Infrastructure](https://astralane.gitbook.io/docs/low-latency/quickstart#core-infrastructure) * [Performance Metrics](https://astralane.gitbook.io/docs/low-latency/quickstart#performance-metrics) * [Who Should Use It on Solana:](https://astralane.gitbook.io/docs/low-latency/quickstart#who-should-use-it-on-solana) sun-brightdesktopmoon sun-brightdesktopmoon --- # Tip Refunds | Astralane Astralane Iris users are automatically eligible to receive SOL tip refunds, if the transactions sent to our middleware executes successfully on chain for a lower price. Tip refunds do not change how transactions are executed and users do not need to make any changes to be eligible for them. [hashtag](https://astralane.gitbook.io/docs/low-latency/submit-transactions/tip-refunds#what-is-a-tip-rebate) What is a Tip rebate? ---------------------------------------------------------------------------------------------------------------------------------------- Due to validator client segmentation in Solana (primarily between **Jito,** **Agave and FD**), many users struggle to determine whether they should prioritize higher priority fees or higher tips to reliably land transactions. With network competition at an all time high, users often overspend by sending unnecessarily high SOL tips. In many cases, these same transactions could have been executed just as quickly at a fraction of the SOL tip amount. Using Astralane’s validator sidecar network, users are now able to capture back some of these cost inefficiencies in the form of a Tip rebate. Astralane’s system is designed to minimize overpayment. Every transaction sent through our infrastructure is routed via our internal SwQoS network, which improves landing probability and issues rebates for transactions that overpay relative to what was required to land that transaction onchain. [hashtag](https://astralane.gitbook.io/docs/low-latency/submit-transactions/tip-refunds#which-transactions-receive-rebates) Which Transactions Receive Rebates ------------------------------------------------------------------------------------------------------------------------------------------------------------------- Rebates are applied to transactions that successfully land in a slot through Astralane’s swqos network. Eligibility depends on several dynamic factors that vary per block, including: * How much network congestion and competition there was * Whether Astralane's internal iris network made a profit on the txn and how much * If the transaction was sent directly to Astralane Iris, or shared with other RPCs and landing services circle-info If you are an existing Astralane Iris user, or planning to use on your existing setup - kindly reach out to us on discord and we will enable it for you. Join our discord server here for support [https://discord.gg/2UfWGtUDtNarrow-up-right](https://discord.gg/2UfWGtUDtN) . [hashtag](https://astralane.gitbook.io/docs/low-latency/submit-transactions/tip-refunds#how-to-maximize-both-rebates-and-speed) How to maximize both rebates and speed --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Transactions which are sent directly to Astralane without using advanced nonce or not getting broadcasted by the user to other RPCs or landing services, will qualify for higher rebate tiers. This is because they maximize the probability of Astralane’s internal network successfully landing them, allowing us to distribute larger rebates. circle-info Usually sending txns via our `sendTransaction` method results in faster execution and higher rewards, as it skips the auction time and lands through our internal swqos network. Other methods like `sendBundle` and `sendPaladin` and `sendIdeal` also quality for Tip rebates - however depends on the configs used for those methods. Since transaction sending is always latency sensitive, in order to improve inclusion in blocks, we recommend users to get a collocated server with us. [hashtag](https://astralane.gitbook.io/docs/low-latency/submit-transactions/tip-refunds#other-optional-privileges) Other optional privileges: -------------------------------------------------------------------------------------------------------------------------------------------------- We offer different types of incentives based on transaction flow and tip volume, including: * Discounted / Waiving off monthly fees * Free access to higher TPS capacity * Free access to our beta products for traders (gRPC, shreds, topOfBlock, etc) [hashtag](https://astralane.gitbook.io/docs/low-latency/submit-transactions/tip-refunds#tracking-rebates) Tracking Rebates ------------------------------------------------------------------------------------------------------------------------------- Rebates are tracked based on your Iris API key provided by us. You can use the API key to fetch and check the rebates you are eligible for in our platform (currently in progress). And you will be able to withdraw the rebates from this at the end of every month. [PreviousPro Tipschevron-left](https://astralane.gitbook.io/docs/low-latency/submit-transactions/pro-tips) [NextShredschevron-right](https://astralane.gitbook.io/docs/low-latency/shreds) Last updated 19 days ago * [What is a Tip rebate?](https://astralane.gitbook.io/docs/low-latency/submit-transactions/tip-refunds#what-is-a-tip-rebate) * [Which Transactions Receive Rebates](https://astralane.gitbook.io/docs/low-latency/submit-transactions/tip-refunds#which-transactions-receive-rebates) * [How to maximize both rebates and speed](https://astralane.gitbook.io/docs/low-latency/submit-transactions/tip-refunds#how-to-maximize-both-rebates-and-speed) * [Other optional privileges:](https://astralane.gitbook.io/docs/low-latency/submit-transactions/tip-refunds#other-optional-privileges) * [Tracking Rebates](https://astralane.gitbook.io/docs/low-latency/submit-transactions/tip-refunds#tracking-rebates) sun-brightdesktopmoon sun-brightdesktopmoon --- # 代币价格接口 | Astralane 代币价格接口允许用户基于最新可用的市场数据,实时获取代币以 SOL 与 USD 计价的价格。 **基础地址(Base URL)** [https://graphql.astralane.ioarrow-up-right](https://graphql.astralane.io/) **Endpoint** `GET /api/v1/price-by-token?tokens=token1,token2,token3` **描述:** 通过在 `tokens` 查询参数中提供以逗号分隔的代币 mint 地址列表(最多 50 个),返回这些代币的最新价格。价格同时以 SOL 与 USD 返回。 **注意:**单次请求最多支持查询 50 个代币 mint 地址。 ### [hashtag](https://astralane.gitbook.io/docs/products-wiki-zh/shu-ju-guan-dao/wo-men-de-chan-pin/dai-bi-jia-ge-jie-kou#cha-xun-can-shu) 查询参数 参数 类型 必要性 描述 `tokens` `string` ✅ Yes 以逗号分隔的代币 mint 地址列表,用于获取其最新价格。 ### [hashtag](https://astralane.gitbook.io/docs/products-wiki-zh/shu-ju-guan-dao/wo-men-de-chan-pin/dai-bi-jia-ge-jie-kou#shi-li-qing-qiu) 示例请求 复制 GET /api/v1/price-by-token?tokens=6Eh3zBrDPvGX3efeC4azjGy7zdKKrwGKuAwZQUzRpump,5heso9fVSTJ2vWwxBDuJUyKCeunTfvn5H5eV1kiJpump,H6EnL9x9ycxcNdQ8YnuxfE4iCnQFcKADC7eoGd9npump,DDEXoWMyDHpCNCyvg5Pakz5u9AmFzmBjjcs92Ux7pump,F9TgEJLLRUKDRF16HgjUCdJfJ5BK6ucyiW8uJxVPpump,So11111111111111111111111111111111111111112 ### [hashtag](https://astralane.gitbook.io/docs/products-wiki-zh/shu-ju-guan-dao/wo-men-de-chan-pin/dai-bi-jia-ge-jie-kou#xiang-ying-shi-li) 响应示例 复制 [\ {\ "timestamp": "1737148622",\ "price_in_usd": 218.45145294,\ "token": "So11111111111111111111111111111111111111112",\ "decimals": 9,\ "name": "Wrapped SOL",\ "symbol": "SOL",\ "uri": "https://raw.githubusercontent.com/solana-labs/token-list/main/assets/mainnet/So11111111111111111111111111111111111111112/logo.png",\ "marketCap": 0,\ "supply": 0\ },\ {\ "timestamp": "1737148622",\ "token": "H6EnL9x9ycxcNdQ8YnuxfE4iCnQFcKADC7eoGd9npump",\ "price_in_sol": 0.000005035749216120721,\ "price_in_usd": 0.0011000667329030378,\ "decimals": 6,\ "name": "Telegram Engine",\ "symbol": "AIGRAM",\ "uri": "https://ipfs.io/ipfs/QmTwymvcXWrDoseVU9PfHmE79e4FCdXi84CGEQprjRwgUn",\ "marketCap": 1100042.67698022,\ "supply": 999978132.305888\ },\ ] [上一页前 100 代币持有者chevron-left](https://astralane.gitbook.io/docs/products-wiki-zh/shu-ju-guan-dao/wo-men-de-chan-pin/qian-100-dai-bi-chi-you-zhe) [下一页历史代币价格接口chevron-right](https://astralane.gitbook.io/docs/products-wiki-zh/shu-ju-guan-dao/wo-men-de-chan-pin/li-shi-dai-bi-jia-ge-jie-kou) 最后更新于 6个月前 * [查询参数](https://astralane.gitbook.io/docs/products-wiki-zh/shu-ju-guan-dao/wo-men-de-chan-pin/dai-bi-jia-ge-jie-kou#cha-xun-can-shu) * [示例请求](https://astralane.gitbook.io/docs/products-wiki-zh/shu-ju-guan-dao/wo-men-de-chan-pin/dai-bi-jia-ge-jie-kou#shi-li-qing-qiu) * [响应示例](https://astralane.gitbook.io/docs/products-wiki-zh/shu-ju-guan-dao/wo-men-de-chan-pin/dai-bi-jia-ge-jie-kou#xiang-ying-shi-li) sun-brightdesktopmoon sun-brightdesktopmoon --- # Pro Tips | Astralane [hashtag](https://astralane.gitbook.io/docs/low-latency/submit-transactions/pro-tips#keep-alive-connections) Keep-Alive Connections ---------------------------------------------------------------------------------------------------------------------------------------- Keep-Alive, also known as persistent connections, is a feature used in networking protocols like HTTP and TCP to maintain an open connection between a client and server for multiple requests and responses, rather than creating a new connection for each interaction. ### [hashtag](https://astralane.gitbook.io/docs/low-latency/submit-transactions/pro-tips#purpose) Purpose The main goal of Keep-Alive is to reduce latency and overhead by avoiding the need to repeatedly open and close connections. This is particularly useful in high-performance systems or when handling multiple short-lived requests. We provide different type of Get health method to ensure smooth integration with your http clients ### [hashtag](https://astralane.gitbook.io/docs/low-latency/submit-transactions/pro-tips#get-health) Get Health JSON RPC GET method /irisb /iris2 Copy curl --location 'http://fr.gateway.astralane.io/iris' \ --header 'api_key: APIKEY' \ --header 'Content-Type: application/json' \ --data '{ "jsonrpc": "2.0", "id": 1, "method": "getHealth" } ' Copy curl --location 'http://fr.gateway.astralane.io/gethealth' Copy curl --location --request POST 'http://fr.gateway.astralane.io/irisb?api-key=APIKEY&method=getHealth' Copy curl --location --request POST 'http://fr.gateway.astralane.io/iris2?api-key=APIKEY&method=getHealth' ### [hashtag](https://astralane.gitbook.io/docs/low-latency/submit-transactions/pro-tips#key-features) Key Features * Connection Reuse: A single TCP connection is reused for multiple requests, eliminating the setup and teardown cost of new connections. * Reduced Latency: Avoids the round-trip time needed to establish new TCP handshakes, improving overall response time. * Improved Throughput: Keeps the pipeline open, allowing for more requests to be served efficiently over the same connection. * Lower Resource Consumption: Reduces CPU and memory usage on both client and server by minimizing connection churn. * Heartbeat or Ping Mechanism: Many implementations use periodic signals to keep the connection from being considered idle or closed by intermediate network devices. Here is the [full source with examplearrow-up-right](https://github.com/Astralane/keep-Alive-Example/blob/main/src/main.rs) [hashtag](https://astralane.gitbook.io/docs/low-latency/submit-transactions/pro-tips#wallet-rotation) Wallet Rotation -------------------------------------------------------------------------------------------------------------------------- Tip wallets are prone to write locks, which may result in landing of your transactions being delayed. We recommend rotating our tip wallets to avoid this issue. [PreviousSend in Binarychevron-left](https://astralane.gitbook.io/docs/low-latency/submit-transactions/send-in-binary) [NextTip Refundschevron-right](https://astralane.gitbook.io/docs/low-latency/submit-transactions/tip-refunds) Last updated 19 days ago * [Keep-Alive Connections](https://astralane.gitbook.io/docs/low-latency/submit-transactions/pro-tips#keep-alive-connections) * [Purpose](https://astralane.gitbook.io/docs/low-latency/submit-transactions/pro-tips#purpose) * [Get Health](https://astralane.gitbook.io/docs/low-latency/submit-transactions/pro-tips#get-health) * [Key Features](https://astralane.gitbook.io/docs/low-latency/submit-transactions/pro-tips#key-features) * [Wallet Rotation](https://astralane.gitbook.io/docs/low-latency/submit-transactions/pro-tips#wallet-rotation) sun-brightdesktopmoon Copy async fn send_txn_with_keep_alive() -> Result<(), Box> { let client = reqwest::Client::builder() .pool_idle_timeout(Some(Duration::from_secs(85))) // Keep connections alive for 85 .build()?; sun-brightdesktopmoon --- # 历史代币余额索引器 | Astralane **Historical Portfolio Index** 是一款面向钱包级别的历史余额索引器,可在指定时间范围内检索某个钱包的历史代币余额。在多个时间点给出资产构成与价值变化,支持按日收盘(EOD)、月末(EOM)、年末(EOY)以及自定义时间区间的余额快照,便于开展灵活、细致的历史分析。 ### [hashtag](https://astralane.gitbook.io/docs/products-wiki-zh/shu-ju-guan-dao/wo-men-de-chan-pin/li-shi-dai-bi-yuesuo-yin-qi#gong-neng-te-xing) 功能特性 * **基于时间窗口的灵活余额跟踪(Flexible Timeframe-Based Balance Tracking):** 在用户定义的日期范围内检索钱包的历史代币余额,支持 EOD/EOM/EOY 快照,便于周期性与精确评估。 * **历史洞察(Historical Insights):** 在所选时间窗内返回特定时间点的余额数据,支持对资产组合表现、资产配置与历史价值趋势进行深度分析。 ### [hashtag](https://astralane.gitbook.io/docs/products-wiki-zh/shu-ju-guan-dao/wo-men-de-chan-pin/li-shi-dai-bi-yuesuo-yin-qi#fang-fa-lun) 方法论 1. **通过过滤器创建索引(Index Creation with Filters)** * 索引在初始化时可配置自定义过滤条件,用于限定数据范围: * **Account ID:**指定进行历史分析的目标钱包地址。 * **Time Range:**通过起止时间戳设定分析时间窗,支持按日收盘(EOD)、月末(EOM)、年末(EOY)的余额快照。 * **Backfilling Historical Data:** 索引创建后会触发回填流程,通过查询链上数据填充历史代币余额。该流程在指定期间内抓取持仓快照,并将转账、交易、质押等所有影响余额的事件纳入计算。 * **Data Retrieval:** 用户可随时通过 API 端点获取聚合后的历史余额数据。数据既可按累计总额返回,也可按日拆分,并按代币组织,提供资产构成与余额波动的细粒度视图。 **技术要点(Technical Insights)** * **数据采集(Data Collection):**在设定时间窗内解析链上记录与交易历史,确保对钱包活动的准确、全面跟踪。 * **基于时间的余额追踪(Time-Based Balance Tracking):**支持在所选区间内生成每日、每月、每年末的余额快照,形成结构化、周期性的组合洞察。 * **价格关联(Price Correlation):**通过连续记录代币余额,用户可结合历史价格数据分析组合价值变化并评估绩效趋势。 **应用场景(Use Cases)** * **历史资产组合分析(Historical Portfolio Analysis):**回顾历史资产构成,识别持仓变化模式或结构迁移。 * **绩效跟踪(Performance Tracking):**评估特定区间内单币种或整体组合的历史表现与增长。 * **税务与合规报告(Tax and Compliance Reporting):**提供精确的历史余额记录,支持审计、纳税申报与合规要求。 ### [hashtag](https://astralane.gitbook.io/docs/products-wiki-zh/shu-ju-guan-dao/wo-men-de-chan-pin/li-shi-dai-bi-yuesuo-yin-qi#api-wen-dang-api-documentation) API 文档(API Documentation) **admin-base-url**:[https://indexer.astralane.io/arrow-up-right](https://indexer.astralane.io/) **index-dataset-url:** [https://graphql.astralane.io/arrow-up-right](https://graphql.astralane.io/) ### [hashtag](https://astralane.gitbook.io/docs/products-wiki-zh/shu-ju-guan-dao/wo-men-de-chan-pin/li-shi-dai-bi-yuesuo-yin-qi#shou-quan-authorization) 授权(Authorization) 每个请求都必须在请求头中包含 `x-api-key` 用于鉴权。请将 `` 替换为你的实际 API Key。 **索引创建流程(Index Creation Flow)** 1. **创建新索引(Create New Index)** `POST {admin-base}/index/account` **用途:**为指定钱包初始化历史资产组合索引,用于开始跟踪代币余额。 2. **启动回填任务(Start Backfill Job)** `POST {admin-base}/backfill/{index_id}` **用途:**为指定 index\_id 启动回填任务,抓取并填充历史余额数据。 3. **查询回填状态(Check Backfill Status)** `GET {admin-base}/backfill/{index_id}` **用途:**获取回填进度与当前状态,便于监控任务执行。 4. **获取历史资产组合数据(Fetch Historical Portfolio Data)** `POST {index-dataset-url}/api/v1/portfolio/{index_id}/graphql` **用途:**在所选时间范围内返回指定 index\_id 的历史代币余额数据。 5. **Create New Index** `POST {admin-base}/index/account` **Headers:** `x-api-key: ` **请求体(Request Body)** **示例配置 1(Example Config 1):** 该配置为指定钱包建立索引,并在定义的时间范围内为每一天生成日终(EOD)余额快照。 **示例配置 2(Example Config 2)** 该配置为指定钱包建立索引,在给定时间范围内按天生成日终(EOD)余额快照。 **说明:** 为指定账户初始化一个用于跟踪历史资产组合数据的新索引。 **示例响应:** **2\. 启动回填任务(Start Backfill Job**) `POST {admin-base}/backfill/{index_id}` **Headers:** `x-api-key: ` **URL 参数:** * **index\_id:** 上一步创建的索引唯一标识。 **请求体(Request Body):** **说明:**为指定的 index\_id 启动回填流程,在定义的时间范围内填充历史代币余额数据。 **示例响应:** **3\. 查询回填状态(Check Backfill Status)** `GET {admin-base}/backfill/{index_id}` **Headers:** `x-api-key: ` **URL 参数:** * **index\_id:** 需要查询回填状态的索引唯一标识。 **说明**:获取回填任务的当前状态,包括进度更新与预计完成时间。 **示例响应:** **4\. 获取历史资产组合数据(Fetch Historical Portfolio Data)** `POST {index-dataset-url}/api/v1/portfolio/{index_id}/graphql` 或在浏览器中使用 GraphQL Playground(将 `{index_id}` 替换为实际索引 ID): **GraphQL Playground URL:** `https://graphql.astralane.io/api/v1/portfolio/{index_id}/graphql` **Headers:** `x-api-key: ` **URL 参数:** * **index\_id:** 要检索历史资产组合数据的索引唯一标识。 **说明:** 获取指定 index 在定义日期范围内的历史资产组合数据。返回的内容包含随时间变化的各代币余额,便于对资产组合变化进行细致分析。 **示例查询**(sample Query): **按日收盘(EOD)代币余额的示例响应** **月末(EOM)代币余额的示例响应** Demo : [https://www.loom.com/share/f9419d418c504eb6a048937ce25e227earrow-up-right](https://www.loom.com/share/f9419d418c504eb6a048937ce25e227e) [上一页PnL 索引器chevron-left](https://astralane.gitbook.io/docs/products-wiki-zh/shu-ju-guan-dao/wo-men-de-chan-pin/pnl-suo-yin-qi) [下一页前 100 代币持有者chevron-right](https://astralane.gitbook.io/docs/products-wiki-zh/shu-ju-guan-dao/wo-men-de-chan-pin/qian-100-dai-bi-chi-you-zhe) 最后更新于 6个月前 * [功能特性](https://astralane.gitbook.io/docs/products-wiki-zh/shu-ju-guan-dao/wo-men-de-chan-pin/li-shi-dai-bi-yuesuo-yin-qi#gong-neng-te-xing) * [方法论](https://astralane.gitbook.io/docs/products-wiki-zh/shu-ju-guan-dao/wo-men-de-chan-pin/li-shi-dai-bi-yuesuo-yin-qi#fang-fa-lun) * [API 文档(API Documentation)](https://astralane.gitbook.io/docs/products-wiki-zh/shu-ju-guan-dao/wo-men-de-chan-pin/li-shi-dai-bi-yuesuo-yin-qi#api-wen-dang-api-documentation) * [授权(Authorization)](https://astralane.gitbook.io/docs/products-wiki-zh/shu-ju-guan-dao/wo-men-de-chan-pin/li-shi-dai-bi-yuesuo-yin-qi#shou-quan-authorization) sun-brightdesktopmoon 复制 { "name": "My Main Wallet Portfolio", "filters": [\ {\ "column": "account_id",\ "predicates": [\ {\ "type": "eq",\ "value": ["BQgboAHJKPnankxDw9GG8n9tnE2L6KA1mWiVLWnPAVma"]\ }\ ]\ },\ {\ "column": "time",\ "predicates": [\ {\ "type": "eq",\ "value": ["EOM"] // Choose from **EOM**(End of month), **EOY**(End of year)\ }\ ]\ }\ ] } 复制 { "name": "My Main Wallet Portfolio", "filters": [\ {\ "column": "account_id",\ "predicates": [\ {\ "type": "eq",\ "value": ["BQgboAHJKPnankxDw9GG8n9tnE2L6KA1mWiVLWnPAVma"]\ }\ ]\ },\ {\ "column": "time",\ "predicates": [\ {\ "type": "gt",\ "value": ["1730246400"]\ },\ { \ "type": "lt",\ "value": ["1731196800"]\ }\ ]\ }\ ] } 复制 { "message": "Account index was created", "id": "ea60d5d2-85d7-4bd2-82f3-c0d7fe934e33" } 复制 { "action": "start" } 复制 { "action_type": "start", "index_id": "ea60d5d2-85d7-4bd2-82f3-c0d7fe934e33" } 复制 json { "index_id": "a82a9871-54ee-4adb-9bd6-5dfcd418b2ae", "start_time": "2024-10-26 20:36:28.000", "update_time": "2024-10-26 20:37:03.000", "status": "completed", "percentage": 1, "last_processed_block": 7, "starting_block": 0, "error_code": 0, "error_message": "" } 复制 query BalanceData { balanceData { date total_balance_usd tokens { timestamp balance mint balance_usd } } } 复制 { "data": { "balanceData": [\ {\ "date": "2024-10-01",\ "total_balance_usd": 97442.96595799158,\ "tokens": [\ {\ "timestamp": "2024-10-01 00:00:00",\ "balance": 912.255539,\ "mint": "2b1kV6DkPAnxd5ixfnxCpjxmKwqjjaYmCZfHsFu24GXo",\ "balance_usd": 912.1079505163582\ },\ {\ "timestamp": "2024-10-01 00:00:00",\ "balance": 350917.146019,\ "mint": "bobaM3u8QmqZhY1HwAtnvze9DLXvkgKYk3td3t8MLva",\ "balance_usd": 228.8904975123627\ },\ \ ]\ },\ {\ "date": "2024-10-02",\ "total_balance_usd": 94190.14343633992,\ "tokens": [\ {\ "timestamp": "2024-10-02 00:00:00",\ "balance": 2611.5364,\ "mint": "HZ1JovNiVvGrGNiiYvEozEVgZ58xaU3RKwX8eACQBCt3",\ "balance_usd": 840.5278588025184\ },\ {\ "timestamp": "2024-10-02 00:00:00",\ "balance": 0.19602522900000002,\ "mint": "jucy5XJ76pHVvtPZb5TKRcGQExkwit2P5s4vY8UzmpC",\ "balance_usd": 29.091447467872708\ }\ ]\ },\ {\ "date": "2024-10-03",\ "total_balance_usd": 91889.01628388994,\ "tokens": [\ {\ "timestamp": "2024-10-03 00:00:00",\ "balance": 96000,\ "mint": "7atgF8KQo4wJrD5ATGX7t1V2zVvykPJbFfNeVf1icFv1",\ "balance_usd": 0.04259115659076336\ },\ {\ "timestamp": "2024-10-03 00:00:00",\ "balance": 2.579127254,\ "mint": "MNDEFzGvMt87ueuHvVU9VcTqsAP5b3fTGPsHuuPA5ey",\ "balance_usd": 0.27138132087748235\ }\ ]\ }\ ] } } 复制 { "data": { "balanceData": [\ \ {\ "date": "2024-09-30",\ "total_balance_usd": 102344.14134378362,\ "tokens": [\ {\ "timestamp": "2024-09-30 00:00:00",\ "balance": 0.37321068900000004,\ "mint": "J1toso1uCk3RLmjorhTtrVwY9HJ7X8V9yYac6Y7kGCPn",\ "balance_usd": 64.911234431185\ },\ {\ "timestamp": "2024-09-30 00:00:00",\ "balance": 4.602259,\ "mint": "EKpQGSJtjMFqKZ9KQanSqYXRcF8fBopzLHYxdM65zcjm",\ "balance_usd": 11.330136288092994\ }\ ]\ },\ {\ "date": "2024-10-31",\ "total_balance_usd": 108291.15598369065,\ "tokens": [\ {\ **"timestamp": "2024-10-31 00:00:00",\ "balance": 0.199743006,\ "mint": "he1iusmfkpAdwvxLNGV8Y1iSbj4rUy6yMhEA3fotn9A",\ "balance_usd": 35.163866912937515\ },\ {\ "timestamp": "2024-10-31 00:00:00",\ "balance": 296.22111298,\ "mint": "hntyVP6YFm1Hg25TN9WGLqM12b8TQmcknKrdu1oxWux",\ "balance_usd": 1868.362032881505\ },\ ]\ },\ {\ "date": "2024-11-30",\ "total_balance_usd": 132234.13328501736,\ "tokens": [\ {\ "timestamp": "2024-11-30 00:00:00",\ "balance": 4.602259,\ "mint": "EKpQGSJtjMFqKZ9KQanSqYXRcF8fBopzLHYxdM65zcjm",\ "balance_usd": 11.516714801692155\ },\ {\ "timestamp": "2024-11-30 00:00:00",\ "balance": 42168.796381,\ "mint": "GQdF6BctM9JsoUqxjgMBpnzRDhvVEBPJK9SG7ykopump",\ "balance_usd": 2.114111146960422\ },\ \ ]\ }\ ] } } 复制 { "data": { "balanceData": [\ {\ "date": "2024-12-31",\ "total_balance_usd": 132317.44254361294,\ "tokens": [\ {\ "timestamp": "2024-12-31 00:00:00",\ "balance": 200,\ "mint": "3UfknvCm4No13GHBPwNvXqJt9kroZcPv3psWswqpzixt",\ "balance_usd": 0.042376126026558644\ },\ {\ "timestamp": "2024-12-31 00:00:00",\ "balance": 0.0064,\ "mint": "HZ1JovNiVvGrGNiiYvEozEVgZ58xaU3RKwX8eACQBCt3",\ "balance_usd": 0.0027155486819310844\ },\ {\ "timestamp": "2024-12-31 00:00:00",\ "balance": 537.444440265,\ "mint": "bSo13r4TkiE4KumL71LsHTPpL2euBYLFx6h9HP3piy1",\ "balance_usd": 129025.68011636613\ }\ ]\ }\ ] } } sun-brightdesktopmoon --- # QUIC Transaction Submission | Astralane Astralane's QUIC endpoint provides a faster, more efficient path for submitting Solana transactions compared to traditional HTTP/JSON-RPC. ### [hashtag](https://astralane.gitbook.io/docs/low-latency/submit-transactions/quic-transaction-submission#available-endpoints) Available Endpoints * Location IP Address MEV Protected IP address Frankfurt (Recommended) `185.191.117.97:7000` `185.191.117.97:9000` Frankfurt `45.139.132.160:7000` `45.139.132.160:9000` San Francisco `74.118.142.151:7000` `74.118.142.151:9000` Tokyo `189.1.164.31:7000` `189.1.164.31:9000` New York `64.130.45.19:7000` `64.130.45.19:9000` Amsterdam (Recommended) `64.130.43.43:7000` `64.130.43.43:9000` Amsterdam `84.32.186.73:7000` `84.32.186.73:9000` Limburg `162.19.222.232:7000` `162.19.222.232:9000` Singapore `67.209.54.176:7000` `67.209.54.176:9000` Lithuania `84.32.97.47:7000` `84.32.97.47:9000` ### [hashtag](https://astralane.gitbook.io/docs/low-latency/submit-transactions/quic-transaction-submission#json-rpc-vs-quic) JSON-RPC VS QUIC Parameter HTTP/JSON-RPC QUIC **Latency** HTTP overhead + JSON serialization/deserialization Direct binary stream, sub-millisecond send **Connection** New TCP connection per request (or keep-alive with limits) Single persistent QUIC connection, multiplexed streams **Concurrency** Sequential requests or multiple connections Up to 64 concurrent streams on a single connection **Serialization** JSON-RPC wrapping + base64/base58 encoding Raw bincode bytes; no encoding overhead **Reconnection** Manual retry logic required Automatic transparent reconnection built into the client **Protocol overhead** TCP + TLS handshake per connection 0-RTT capable, built-in encryption ### [hashtag](https://astralane.gitbook.io/docs/low-latency/submit-transactions/quic-transaction-submission#why-use-astralane-quic-client) Why Use `astralane-quic-client`? * **Zero-config authentication** : TLS certificate with your API key is generated automatically * **Automatic reconnection** : transparent recovery from timeouts and server restarts * **Fire-and-forget** : no response parsing or callback handling needed * **Connection keep-alive** : persistent connection with automatic 25s keep-alive pings, no repeated handshakes * **Built-in backpressure :** stream limits are handled gracefully without dropping your connection Only **authentication errors** (`UNKNOWN_API_KEY`) require manual intervention, verify your API key is correct and active. ### [hashtag](https://astralane.gitbook.io/docs/low-latency/submit-transactions/quic-transaction-submission#getting-started) Getting Started The recommended way to interact with Astralane's QUIC endpoint is through the official [astralane-quic-clientarrow-up-right](https://github.com/Astralane/astralane-quic-client) . #### [hashtag](https://astralane.gitbook.io/docs/low-latency/submit-transactions/quic-transaction-submission#installation) Installation #### [hashtag](https://astralane.gitbook.io/docs/low-latency/submit-transactions/quic-transaction-submission#quick-example) Quick Example * * * ### [hashtag](https://astralane.gitbook.io/docs/low-latency/submit-transactions/quic-transaction-submission#server-limits) Server Limits Parameter Value Description Max connections per API key 10 Create multiple client instances for more connections Max concurrent streams per connection 64 Streams beyond this limit will block until a slot frees up Stream read timeout 750 ms Server closes the stream if transaction bytes aren't received in time Max transaction size 1232 bytes Standard Solana transaction size limit Idle timeout 30 s Connection closes if no activity; client sends keep-alive every 25s * * * ### [hashtag](https://astralane.gitbook.io/docs/low-latency/submit-transactions/quic-transaction-submission#error-codes) Error Codes The server may close your connection with these application-level error codes: Code Name When It Happens 0 `OK` Normal closure (client or server initiated) 1 `UNKNOWN_API_KEY` API key not recognized (check your API key is valid and active) 2 `CONNECTION_LIMIT` Too many connections for this API key (close unused connections or contact support for a higher limit) #### [hashtag](https://astralane.gitbook.io/docs/low-latency/submit-transactions/quic-transaction-submission#rate-limiting) Rate Limiting When the rate limit is exceeded, the server **silently drops** excess transactions. The connection stays alive - no error is returned to the client. Monitor your transaction landing rate to detect if you're being rate limited. #### [hashtag](https://astralane.gitbook.io/docs/low-latency/submit-transactions/quic-transaction-submission#stream-limits) Stream Limits When the concurrent stream limit (64) is reached, the client will block (backpressure) until a stream slot frees up. The server does not close the connection, your send call will simply take longer to return. [PreviousSubmit Transactionschevron-left](https://astralane.gitbook.io/docs/low-latency/submit-transactions) [NextWebSocket Transaction Submissionchevron-right](https://astralane.gitbook.io/docs/low-latency/submit-transactions/websocket-transaction-submission) Last updated 15 days ago * [Available Endpoints](https://astralane.gitbook.io/docs/low-latency/submit-transactions/quic-transaction-submission#available-endpoints) * [JSON-RPC VS QUIC](https://astralane.gitbook.io/docs/low-latency/submit-transactions/quic-transaction-submission#json-rpc-vs-quic) * [Why Use astralane-quic-client?](https://astralane.gitbook.io/docs/low-latency/submit-transactions/quic-transaction-submission#why-use-astralane-quic-client) * [Getting Started](https://astralane.gitbook.io/docs/low-latency/submit-transactions/quic-transaction-submission#getting-started) * [Server Limits](https://astralane.gitbook.io/docs/low-latency/submit-transactions/quic-transaction-submission#server-limits) * [Error Codes](https://astralane.gitbook.io/docs/low-latency/submit-transactions/quic-transaction-submission#error-codes) sun-brightdesktopmoon Copy [dependencies] astralane-quic-client = { git = "https://github.com/Astralane/astralane-quic-client" } Copy use astralane_quic_client::AstralaneQuicClient; let client = AstralaneQuicClient::connect("lim.gateway.astralane.io:7000", "your-api-key").await?; // Build and serialize your Solana transaction let tx_bytes = bincode::serialize(&transaction)?; // Send (fire-and-forget, auto-reconnects on failure) client.send_transaction(&tx_bytes).await?; // Small delay before close to let the server read in-flight streams tokio::time::sleep(Duration::from_millis(100)).await; client.close().await; sun-brightdesktopmoon --- # Send in Plain Text | Astralane Key Improvements Include: * No CORS preflight checks * Plain text instead of a JSON payload * Reduced body size, which means reduced bandwidth and network overhead > Key points > > * Request should only have one header as `Content-Type : text/plain` > > * Txn should be in Base64 encoded > > * Compulsory to add `api-key` and `method` in URI params > > * Send request on endpoint `/iris2` > #### [hashtag](https://astralane.gitbook.io/docs/low-latency/submit-transactions/send-in-plain-text#uri-params) URI Params Param Type Description `api-key` String **Mandatory**, to set api key for authentication `method` String **Mandatory**, to set method `mev-protect` Boolean **Optional**, To set mev protect, default is `false` `swqos-only` Boolean **Optional**, if set `true`, txn will be only send via swqos, default is `false` #### [hashtag](https://astralane.gitbook.io/docs/low-latency/submit-transactions/send-in-plain-text#methods) Methods Method REST Method Description `sendTransaction` `POST` To send base64 encoded transaction `sendBatch` `POST` To send batch of up to 25 txns in Plain text `getHealth` `POST` To keep alive connection [hashtag](https://astralane.gitbook.io/docs/low-latency/submit-transactions/send-in-plain-text#send-transaction) Send Transaction -------------------------------------------------------------------------------------------------------------------------------------- #### [hashtag](https://astralane.gitbook.io/docs/low-latency/submit-transactions/send-in-plain-text#example-request) Example Request Rust TypeScript Javascript Go Lang #### [hashtag](https://astralane.gitbook.io/docs/low-latency/submit-transactions/send-in-plain-text#expected-response) Expected Response Status Code Description 200 Request is successful 400 Request might have some issues [hashtag](https://astralane.gitbook.io/docs/low-latency/submit-transactions/send-in-plain-text#send-batch) Send Batch -------------------------------------------------------------------------------------------------------------------------- #### [hashtag](https://astralane.gitbook.io/docs/low-latency/submit-transactions/send-in-plain-text#example-request-1) Example Request #### [hashtag](https://astralane.gitbook.io/docs/low-latency/submit-transactions/send-in-plain-text#expected-response-1) Expected Response Status Code Description 200 Request is successful 400 Request might have some issues [PreviousWebSocket Transaction Submissionchevron-left](https://astralane.gitbook.io/docs/low-latency/submit-transactions/websocket-transaction-submission) [NextSend in Binarychevron-right](https://astralane.gitbook.io/docs/low-latency/submit-transactions/send-in-binary) Last updated 15 days ago * [Send Transaction](https://astralane.gitbook.io/docs/low-latency/submit-transactions/send-in-plain-text#send-transaction) * [Send Batch](https://astralane.gitbook.io/docs/low-latency/submit-transactions/send-in-plain-text#send-batch) sun-brightdesktopmoon Copy curl --location 'https://lim.gateway.astralane.io/iris2?api-key=APIKEY&method=sendTransaction' \ --header 'Content-Type: text/plain' \ --data 'base64_encoded_txn' Copy #[tokio::main] async fn main() -> Result<(), Box> { let client = reqwest::Client::builder() .build()?; let mut headers = reqwest::header::HeaderMap::new(); headers.insert("Content-Type", "text/plain".parse()?); let data = "base64_encoded_txn"; let request = client.request(reqwest::Method::POST, "https://lim.gateway.astralane.io/iris2?api-key=APIKEY&method=sendTransaction") .headers(headers) .body(data); let response = request.send().await?; let body = response.text().await?; println!("{}", body); Ok(()) } Copy import { Transaction, VersionedTransaction } from "@solana/web3.js"; /** * Sends a base64-encoded Solana transaction as plain text * to the Astralane Iris2 gateway. */ async function sendTransaction( transaction: Transaction | VersionedTransaction, apiKey: string ): Promise { const url = new URL("https://lim.gateway.astralane.io/iris2"); url.searchParams.set("api-key", apiKey); url.searchParams.set("method", "sendTransaction"); // Serialize and base64-encode the transaction const base64Tx = Buffer.from(transaction.serialize()).toString("base64"); const response = await fetch(url.toString(), { method: "POST", headers: { "Content-Type": "text/plain", }, body: base64Tx, }); if (!response.ok) { throw new Error( `sendTransaction failed: ${response.status} ${response.statusText}` ); } } // Usage // ... build and sign your transaction ... await sendTransaction(signedTransaction, "YOUR_API_KEY"); Copy const axios = require('axios'); let data = 'base64_encoded_txn'; let config = { method: 'post', maxBodyLength: Infinity, url: 'https://lim.gateway.astralane.io/iris2?api-key=APIKEY&method=sendTransaction', headers: { 'Content-Type': 'text/plain' }, data : data }; axios.request(config) .then((response) => { console.log(JSON.stringify(response.data)); }) .catch((error) => { console.log(error); }); Copy package main import ( "fmt" "strings" "net/http" "io" ) func main() { url := "https://lim.gateway.astralane.io/iris2?api-key=APIKEY&method=sendTransaction" method := "POST" payload := strings.NewReader(`base64_encoded_txn`) client := &http.Client { } req, err := http.NewRequest(method, url, payload) if err != nil { fmt.Println(err) return } req.Header.Add("Content-Type", "text/plain") res, err := client.Do(req) if err != nil { fmt.Println(err) return } defer res.Body.Close() body, err := io.ReadAll(res.Body) if err != nil { fmt.Println(err) return } fmt.Println(string(body)) } Copy { "result": "5KtPn1LGuxhFiwjxErkxTb7XxtLVjFW9QjMpv3Y7gW1x..." } Copy curl --location 'https://lim.gateway.astralane.io/iris2?api-key=APIKEY&method=sendBatch' \ --header 'Content-Type: text/plain' \ --data 'base64_encoded_txn1,base64_encoded_txn2,base64_encoded_txn3' // coma seperated values Copy { "result": ["sig1", "sig2" ....] } sun-brightdesktopmoon --- # Send in Binary | Astralane Key Improvements Include: 1. No Base64 Encoding/Decoding Overhead 2. No Packet Splitting due to reduced data size 3. Reduced Transmission time > Key points > > * Create Transaction in raw binary format > > * Header is optional > > * Mandatory to add `api-key` and `method` in URI params > > * Send request on endpoint `/irisb` > [hashtag](https://astralane.gitbook.io/docs/low-latency/submit-transactions/send-in-binary#uri-params) URI Params ---------------------------------------------------------------------------------------------------------------------- Param Type Description `api-key` String **Mandatory**, To set api key for authentication `method` String **Mandatory**, To set method `mev-protect` Boolean **Optional**, To set mev protect, default is `false` `swqos-only` Boolean **Optional**, if set `true`, txn will be only send via swqos, default is `false` [hashtag](https://astralane.gitbook.io/docs/low-latency/submit-transactions/send-in-binary#methods) Methods ---------------------------------------------------------------------------------------------------------------- Method REST Method Description `sendTransaction` `POST` To send binary transaction `sendBatch` `POST` To send batch of up to 25 txns in binary `getHealth` `POST` To keep connection alive [hashtag](https://astralane.gitbook.io/docs/low-latency/submit-transactions/send-in-binary#send-transaction) Send Transaction ---------------------------------------------------------------------------------------------------------------------------------- #### [hashtag](https://astralane.gitbook.io/docs/low-latency/submit-transactions/send-in-binary#example-request) Example Request Code Example : Rust TypeScript #### [hashtag](https://astralane.gitbook.io/docs/low-latency/submit-transactions/send-in-binary#expected-response) Expected Response Status Code Description 200 Request is successful 400 Request might have some issues * * * [hashtag](https://astralane.gitbook.io/docs/low-latency/submit-transactions/send-in-binary#send-batch) Send Batch ---------------------------------------------------------------------------------------------------------------------- #### [hashtag](https://astralane.gitbook.io/docs/low-latency/submit-transactions/send-in-binary#request-body-format) Request Body Format The body is a raw binary stream (`Content-Type: application/octet-stream`). Each transaction is framed as: Transactions are concatenated back-to-back with no separators or envelope: **Headers required:** * `Content-Type: application/octet-stream` #### [hashtag](https://astralane.gitbook.io/docs/low-latency/submit-transactions/send-in-binary#example) Example Rust Typescript #### [hashtag](https://astralane.gitbook.io/docs/low-latency/submit-transactions/send-in-binary#response) Response The server returns JSON. The `result` field is an **array of signatures**, one per transaction in the order they were sent: * Array length matches the number of transactions sent. * Signatures are in the same order as the transactions in the request body. [PreviousSend in Plain Textchevron-left](https://astralane.gitbook.io/docs/low-latency/submit-transactions/send-in-plain-text) [NextPro Tipschevron-right](https://astralane.gitbook.io/docs/low-latency/submit-transactions/pro-tips) Last updated 19 days ago * [URI Params](https://astralane.gitbook.io/docs/low-latency/submit-transactions/send-in-binary#uri-params) * [Methods](https://astralane.gitbook.io/docs/low-latency/submit-transactions/send-in-binary#methods) * [Send Transaction](https://astralane.gitbook.io/docs/low-latency/submit-transactions/send-in-binary#send-transaction) * [Send Batch](https://astralane.gitbook.io/docs/low-latency/submit-transactions/send-in-binary#send-batch) sun-brightdesktopmoon Copy curl --location 'https://lim.gateway.astralane.io/irisb?api-key=APIKEY&method=sendTransaction' \ --data-binary @transaction.bin Copy #[tokio::main] async fn main() -> Result<(), Box> { let client = reqwest::Client::builder() .build()?; let mut headers = reqwest::header::HeaderMap::new(); headers.insert("Content-Type", "application/octet-stream".parse()?); //Optional let irisb_transaction_bytes = bincode::serialize(&irisb_transaction) .context("Failed to serialize IrisB transaction to binary")?; let request = client.request(reqwest::Method::POST, "https://lim.gateway.astralane.io/irisb?api-key=APIKEY&method=sendTransaction") .headers(headers) .body(irisb_transaction_bytes); let response = request.send().await?; let body = response.text().await?; println!("{}", body); Ok(()) } Copy import { Transaction, VersionedTransaction } from "@solana/web3.js"; /** * Sends a serialized Solana transaction as raw binary (application/octet-stream) * to the Astralane IrisB gateway. */ async function sendBinaryTransaction( transaction: Transaction | VersionedTransaction, apiKey: string ): Promise { const txBytes: Uint8Array = transaction.serialize(); const url = `https://.gateway.astralane.io/irisb?api-key=${apiKey}&method=SendTransaction`; const response = await fetch(url, { method: "POST", headers: { "Content-Type": "application/octet-stream", }, body: txBytes, }); if (!response.ok) { throw new Error( `sendBinaryTransaction failed: ${response.status} ${response.statusText}` ); } } // Usage // ... build and sign your transaction ... await sendBinaryTransaction(signedTransaction, "YOUR_API_KEY"); Copy { "result": "5KtPn1LGuxhFiwjxErkxTb7XxtLVjFW9QjMpv3Y7gW1x..." } Copy [ 2 bytes: tx length (big-endian u16) ][ N bytes: bincode-serialized transaction ] Copy +--------+----------+--------+----------+-----+ | len_0 | tx_0 | len_1 | tx_1 | ... | | u16 BE | bincode | u16 BE | bincode | | +--------+----------+--------+----------+-----+ Copy use bincode; use reqwest::Client; use solana_sdk::{signature::Signature, transaction::Transaction}; use std::str::FromStr; fn build_binary_body(transactions: &[Transaction]) -> Vec { let mut body = Vec::new(); for tx in transactions { let tx_bytes = bincode::serialize(tx).expect("failed to serialize transaction"); let len = tx_bytes.len() as u16; body.extend_from_slice(&len.to_be_bytes()); body.extend_from_slice(&tx_bytes); } body } #[tokio::main] async fn main() -> anyhow::Result<()> { let url = "https://lim.gateway.astralane.io/irisb?api-key=APIKEY&method=sendBatch"; // Build your Vec however you like let transactions: Vec = vec![/* tx1, tx2, ... */]; let binary_body = build_binary_body(&transactions); let client = Client::new(); let response = client .post(url) .header("content-type", "application/octet-stream") .body(binary_body) .send() .await?; let status = response.status(); let body_text = response.text().await?; if !status.is_success() { anyhow::bail!("request failed ({}): {}", status, body_text); } // Parse signatures from the response let parsed: serde_json::Value = serde_json::from_str(&body_text)?; let sig_array = parsed["result"] .as_array() .or_else(|| parsed.as_array()) .expect("unexpected response format"); let signatures: Vec = sig_array .iter() .map(|v| { let s = v.as_str().expect("signature must be a string"); Signature::from_str(s).expect("invalid signature") }) .collect(); for (i, sig) in signatures.iter().enumerate() { println!("tx[{}] signature: {}", i, sig); } Ok(()) } Copy import { Transaction } from "@solana/web3.js"; function buildBinaryBody(transactions: Transaction[]): Buffer { const chunks: Buffer[] = []; for (const tx of transactions) { const txBytes = tx.serialize(); const lenBuf = Buffer.alloc(2); lenBuf.writeUInt16BE(txBytes.length, 0); chunks.push(lenBuf, txBytes); } return Buffer.concat(chunks); } async function sendBinaryBatch( url: string, transactions: Transaction[] ): Promise { const body = buildBinaryBody(transactions); const response = await fetch(url, { method: "POST", headers: { "content-type": "application/octet-stream", }, body, }); if (!response.ok) { throw new Error(`request failed (${response.status}): ${await response.text()}`); } const json = await response.json(); const signatures: string[] = json.result ?? json; signatures.forEach((sig, i) => console.log(`tx[${i}] signature: ${sig}`)); return signatures; } // Usage const transactions: Transaction[] = [/* tx1, tx2, ... */]; await sendBinaryBatch("https://lim.gateway.astralane.io/irisb?api-key=APIKEY&method=sendBatch", transactions); Copy { "result": [\ "5KtPn1LGuxhFiwjxErkxTb7XxtLVjFW9QjMpv3Y7gW1x...",\ "3RmHNpos7e4Bs3Y8j4Q1fGj5M5kPnxUeFNkMWv2jZrw5..."\ ] } sun-brightdesktopmoon --- # 交易索引器 | Astralane **Transaction Indexer 概览** 该交易索引器通过 **Geyser gRPC** 捕获并存储最近两个 epoch 内已最终确认(finalized)的 Solana 区块链交易。索引后的数据通过 **GraphQL API** 提供给开发者与分析师使用,使其无需直接对接 Solana 的 RPC 端点即可高效查询与分析交易。 * * * **关键特性(Key Features)** * **实时交易索引(Real-Time Transaction Indexing)**:使用 Geyser gRPC 实时摄取并处理最终确认的交易。 * **高效数据存储(Efficient Data Storage)**:将交易结构化后存储于 ClickHouse,支持高性能查询。 * **GraphQL API 访问(GraphQL API Access)**:提供强大灵活的 GraphQL 查询接口,支持筛选与分页。 * * * **架构(Architecture)** * **数据摄取(Data Ingestion)** * **来源:**通过 Geyser gRPC 从 Solana 区块链获取 * **处理:**对交易进行解析、结构化与索引 * **批处理:**批量写入并周期性 flush 以优化性能 * **数据存储(Data Storage)** * 数据库:ClickHouse(因其速度与可扩展性被选用) * **GraphQL API** * 可查询的交易数据端点 * 内置解析器支持分页、过滤以及对交易的深度检查 * * * #### [hashtag](https://astralane.gitbook.io/docs/products-wiki-zh/shu-ju-guan-dao/wo-men-de-chan-pin/jiao-yi-suo-yin-qi#graphql-api) **GraphQL API** * **基础地址(Base URL):** `https://graphql.astralane.io/api/v1/dataset/transactions` * * * **查询示例——带分页的交易查询** * * * **应用场景** * 钱包活动的实时监控与索引 * 构建自定义交易浏览器 * 历史交易分析与代币流向追踪 * 面向 Solana 链上数据的开发者工具与看板 * * * ### [hashtag](https://astralane.gitbook.io/docs/products-wiki-zh/shu-ju-guan-dao/wo-men-de-chan-pin/jiao-yi-suo-yin-qi#cha-xun-guolxiang) 查询过滤项 字段 类型 描述 `limit` Integer 默认 100;最大拉取行数。 `page` Integer 默认 1;页码。 `block` Integer 按区块槽位过滤,例如`307771651` `start_block_time` Integer 开始时间的 Unix 时间戳(秒),例如 `1734312900` `end_block_time` Integer 结束时间的 Unix 时间戳(秒),例如 `1734313900` `account_key` string 要检索的账户公钥。 `start_block` Ineger 起始区块槽位。 `end_block` Integer 起始区块槽位。 [上一页钱包盈亏接口chevron-left](https://astralane.gitbook.io/docs/products-wiki-zh/shu-ju-guan-dao/wo-men-de-chan-pin/qian-bao-ying-kui-jie-kou) 最后更新于 6个月前 sun-brightdesktopmoon 复制 query Transaction { transaction( limit: 1, page: 1, start_block_time: 1734312900, end_block_time: 1734323700, account_key: "BRnAAgctCz19YZw6q7maRsXHXP1j4oeqC93PGzjE5Si8" ) { block blockTime blockHeight parentSlot previousBlockhash signature transaction { signatures message { accountKeys recentBlockhash header { numReadonlySignedAccounts numReadonlyUnsignedAccounts numRequiredSignatures } instructions { accounts data programIdIndex } } meta { fee preBalances postBalances logMessages innerInstructionsNone rewards loadedWritableAddresses loadedReadonlyAddresses returnDataNone computeUnitsConsumed innerInstructions { index instructions { accounts data programIdIndex } } preTokenBalances { accountIndex mint owner programId uiTokenAmount { uiAmount decimals amount uiAmountString } } postTokenBalances { accountIndex mint owner programId uiTokenAmount { uiAmount decimals amount uiAmountString } } } } blockHash } } sun-brightdesktopmoon --- # WebSocket Transaction Submission | Astralane Astralane's WebSocket endpoint provides a fast, browser-native path for submitting Solana transactions. Designed for frontends and trading terminals where QUIC (mTLS) isn't available. ### [hashtag](https://astralane.gitbook.io/docs/low-latency/submit-transactions/websocket-transaction-submission#available-endpoints) Available Endpoints Location Endpoint Frankfurt (Recommended) `wss://fr.gateway.astralane.io:5500` Frankfurt `wss://fr2.gateway.astralane.io:5500` San Francisco `wss://la.gateway.astralane.io:5500` Tokyo `wss://jp.gateway.astralane.io:5500` New York `wss://ny.gateway.astralane.io:5500` Amsterdam (Recommended) `wss://ams.gateway.astralane.io:5500` Amsterdam 2 `wss://ams2.gateway.astralane.io:5500` Limburg `wss://lim.gateway.astralane.io:5500` Singapore `wss://sg.gateway.astralane.io:5500` Lithuania `wss://lit.gateway.astralane.io:5500` ### [hashtag](https://astralane.gitbook.io/docs/low-latency/submit-transactions/websocket-transaction-submission#available-paths) Available Paths Path Description `/iris` Standard transaction submission `/mev-protect` MEV-protected transaction submission Example URLs: Copy wss://fr.gateway.astralane.io:5500/iris?api_key=your-api-key wss://fr.gateway.astralane.io:5500/mev-protect?api_key=your-api-key ### [hashtag](https://astralane.gitbook.io/docs/low-latency/submit-transactions/websocket-transaction-submission#http-json-rpc-vs-websocket) HTTP/JSON-RPC vs WebSocket Parameter HTTP/JSON-RPC WebSocket **Latency** HTTP overhead + JSON serialization per request Single handshake, then raw binary frames **Connection** New round trip per transaction Persistent - one connection, unlimited transactions **Serialization** JSON-RPC wrapping + base64 encoding Raw binary transaction bytes, no encoding **CORS** Requires CORS headers, preflight requests No CORS restrictions - works from any domain **Response model** Synchronous - client waits for JSON-RPC response Fire-and-forget - no response, no blocking **Browser support** `fetch()` API Native `new WebSocket()` **Dead connection** Not detected - ephemeral connections Auto-detected via ping/pong heartbeat **Protocol overhead** HTTP headers (~500 bytes) per request ~6 bytes WebSocket framing per message ### [hashtag](https://astralane.gitbook.io/docs/low-latency/submit-transactions/websocket-transaction-submission#why-use-websocket) Why Use WebSocket? * **Browser-native**: Works directly from any browser with `new WebSocket()` - no libraries, no backend proxy needed * **Zero CORS issues**: WebSocket connections bypass CORS entirely, unlike HTTP endpoints * **Persistent connection**: One handshake, then send unlimited transactions with minimal framing overhead * **Raw binary**: Send serialized Solana transaction bytes directly - no base64 encoding, no JSON-RPC wrapping * **Fire-and-forget**: Send and move on, no response parsing needed * **Dead connection detection**: Server sends ping every 25s, automatically cleans up dead connections ### [hashtag](https://astralane.gitbook.io/docs/low-latency/submit-transactions/websocket-transaction-submission#important-fire-and-forget) Important: Fire-and-Forget Unlike JSON-RPC endpoints (e.g., `/iris`) which return a transaction signature in the response, the WebSocket endpoint does **not** return any response. Transactions are forwarded silently — no signature, no acknowledgment, no error message is sent back to the client. This means: * **You must track signatures client-side** — since you sign the transaction before sending, you already have the signature. * **Rate-limited transactions are silently dropped** — the connection stays alive, but excess transactions are not forwarded. Monitor your transaction landing rate to detect if you're being rate limited. * **Invalid transactions are silently dropped** — transactions exceeding the size limit or failing validation are discarded without notification. ### [hashtag](https://astralane.gitbook.io/docs/low-latency/submit-transactions/websocket-transaction-submission#getting-started) Getting Started Rust TypeScript / React Javascript Python * * * ### [hashtag](https://astralane.gitbook.io/docs/low-latency/submit-transactions/websocket-transaction-submission#keep-alive-ping-pong) Keep-Alive / Ping-Pong The server sends a WebSocket Ping frame every 25 seconds. Your client **must** respond with a Pong frame within 30 seconds, or the connection will be closed. * **Browser (JavaScript)**: Handled automatically, no code needed. * **Python (**`**websockets**`**)**: Handled automatically, the library responds to pings by default. * **Rust (**`**tokio-tungstenite**`**)**: Pong responses are queued automatically but only flushed when you **read** from the stream. If your code only sends (fire-and-forget), you must spawn a separate task to read from the stream so pongs get flushed. Refer to the Rust example. If you're using a library that does **not** auto-respond to pings, you must manually send a Pong frame when you receive a Ping. Consult your library's documentation. * * * ### [hashtag](https://astralane.gitbook.io/docs/low-latency/submit-transactions/websocket-transaction-submission#server-limits) Server Limits Parameter Value Description Max transaction size 1232 bytes Standard Solana transaction size limit Pong timeout 30 s Server sends a ping every 25s; connection closed if no pong received within 30s Idle timeout 300 s Connection closed if no transaction sent within 5 minutes Handshake timeout 5 s WebSocket upgrade must complete within this window Max connections per API key 5000 Total concurrent connections allowed per API key Max connections per IP 2 Total concurrent connections allowed per client IP * * * ### [hashtag](https://astralane.gitbook.io/docs/low-latency/submit-transactions/websocket-transaction-submission#error-handling) Error Handling The server may close your connection for these reasons: Reason When It Happens Missing API key No `api_key` query parameter in the URL Unknown API key API key not recognized or inactive Connection limit Too many connections for this API key or IP Pong timeout Client stopped responding to ping frames (dead connection) Idle timeout No transaction sent within the idle timeout window Unknown path Requested path is not `/iris` or `/mev-protect` (rejected during handshake with 404) [PreviousQUIC Transaction Submissionchevron-left](https://astralane.gitbook.io/docs/low-latency/submit-transactions/quic-transaction-submission) [NextSend in Plain Textchevron-right](https://astralane.gitbook.io/docs/low-latency/submit-transactions/send-in-plain-text) Last updated 7 minutes ago * [Available Endpoints](https://astralane.gitbook.io/docs/low-latency/submit-transactions/websocket-transaction-submission#available-endpoints) * [Available Paths](https://astralane.gitbook.io/docs/low-latency/submit-transactions/websocket-transaction-submission#available-paths) * [HTTP/JSON-RPC vs WebSocket](https://astralane.gitbook.io/docs/low-latency/submit-transactions/websocket-transaction-submission#http-json-rpc-vs-websocket) * [Why Use WebSocket?](https://astralane.gitbook.io/docs/low-latency/submit-transactions/websocket-transaction-submission#why-use-websocket) * [Important: Fire-and-Forget](https://astralane.gitbook.io/docs/low-latency/submit-transactions/websocket-transaction-submission#important-fire-and-forget) * [Getting Started](https://astralane.gitbook.io/docs/low-latency/submit-transactions/websocket-transaction-submission#getting-started) * [Keep-Alive / Ping-Pong](https://astralane.gitbook.io/docs/low-latency/submit-transactions/websocket-transaction-submission#keep-alive-ping-pong) * [Server Limits](https://astralane.gitbook.io/docs/low-latency/submit-transactions/websocket-transaction-submission#server-limits) * [Error Handling](https://astralane.gitbook.io/docs/low-latency/submit-transactions/websocket-transaction-submission#error-handling) sun-brightdesktopmoon Copy use tokio_tungstenite::connect_async; use tungstenite::Message; use futures_util::{SinkExt, StreamExt}; let (ws_stream, _) = connect_async("wss://fr.gateway.astralane.io:5500/iris?api_key=your-api-key") .await .expect("Failed to connect"); let (mut sender, mut receiver) = ws_stream.split(); // Spawn a read task — this is required so that tungstenite flushes // automatic pong responses to the server's pings. tokio::spawn(async move { while let Some(_) = receiver.next().await {} }); // Build and serialize your Solana transaction let tx_bytes = bincode::serialize(&transaction)?; // Send raw binary (fire-and-forget) sender.send(Message::Binary(tx_bytes.into())).await?; Copy import { Transaction, Connection, Keypair } from '@solana/web3.js'; function createAstralaneWs(endpoint: string, apiKey: string, path: string = '/iris'): WebSocket { const ws = new WebSocket(`wss://${endpoint}:5500${path}?api_key=${apiKey}`); ws.binaryType = 'arraybuffer'; return ws; } // Connect const ws = createAstralaneWs('fr.gateway.astralane.io', 'your-api-key'); ws.onopen = () => { // Send transactions as raw binary const tx = buildTransaction(); // your transaction builder ws.send(tx.serialize()); }; Copy const ws = new WebSocket('wss://fr.gateway.astralane.io:5500/iris?api_key=your-api-key'); ws.binaryType = 'arraybuffer'; ws.onopen = () => { // Build and serialize your Solana transaction const transaction = new Transaction(); // ... add instructions, sign ... const serializedTx = transaction.serialize(); // Send raw binary (fire-and-forget) ws.send(serializedTx); }; ws.onclose = (event) => { console.log(`Connection closed: code=${event.code}`); }; Copy import asyncio import ssl import websockets async def send_transaction(tx_bytes: bytes): uri = "wss://fr.gateway.astralane.io:5500/iris?api_key=your-api-key" async with websockets.connect(uri) as ws: await ws.send(tx_bytes) sun-brightdesktopmoon --- # Shreds | Astralane ### [hashtag](https://astralane.gitbook.io/docs/low-latency/shreds#what-are-shreds) What are Shreds? On Solana, blocks are never transmitted as a complete unit. Instead, the leader **streams the block as it is being produced**, splitting it into small packets called **shreds**. These are broadcast over UDP to the network and reassembled by validators in real time. ### [hashtag](https://astralane.gitbook.io/docs/low-latency/shreds#why-it-matters) Why it matters Latency on Solana is not a single event—it splits into two distinct phases: 1. **Transaction → Leader** (getting included) 2. **Leader → Network (via shreds)** (state becoming observable) Most systems focus on phase (1). But for latency-sensitive strategies, phase (2) is where edge is gained or lost. Shreds propagate over a **fanout-based UDP network (Turbine)**, meaning: * Packets take different paths * Arrival order is not guaranteed * Timing varies across peers As a result: * Validators reconstruct blocks at **different wall-clock times** * Earlier reconstruction = earlier access to: * account state * program outputs * orderbook changes Even a few milliseconds here is material. ### [hashtag](https://astralane.gitbook.io/docs/low-latency/shreds#who-this-is-for) Who this is for Astralane Shred Delivery is designed for: * MEV searchers * Market makers * High-frequency traders * Validator operators * Infrastructure providers If your strategy depends on reacting to state changes as early as possible, shred delivery is a must. ### [hashtag](https://astralane.gitbook.io/docs/low-latency/shreds#how-astralane-shreds-work) **How Astralane Shreds work** Astralane provides **raw UDP shred streams** optimized for: * Low-latency propagation * Consistent shred arrival * Efficient duplicate handling Shreds are delivered directly over UDP to minimize overhead and avoid additional transport latency. This allows clients to: * Receive shreds earlier in the propagation cycle * Reconstruct state faster * Reduce dependency on slower or congested peers ### [hashtag](https://astralane.gitbook.io/docs/low-latency/shreds#get-access-to-shreds) Get Access to Shreds To access Astralane Shred Delivery: 1. Sign up on : [https://portal.astralane.io/dashboardarrow-up-right](https://portal.astralane.io/dashboard) 2. Provide endpoint details (IP + UDP port) ![](https://astralane.gitbook.io/docs/~gitbook/image?url=https%3A%2F%2F3735316443-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252Fg4FFsaLytHIct61zl8o6%252Fuploads%252FdsKR2G5Qwv8W7jX5hwsz%252Fimage.png%3Falt%3Dmedia%26token%3Dfbc5f475-b5ac-4ef2-8f03-fc53d8b22efe&width=768&dpr=3&quality=100&sign=c0b03ffe&sv=2) ![](https://astralane.gitbook.io/docs/~gitbook/image?url=https%3A%2F%2F3735316443-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252Fg4FFsaLytHIct61zl8o6%252Fuploads%252Fa79h3ga9qc8ur0zsXGEB%252Fd9e4ad53-e6a3-4093-9ea4-64a6a275521e.png%3Falt%3Dmedia%26token%3Dea07877a-9764-4e07-9df2-a80554c99c0e&width=768&dpr=3&quality=100&sign=2a53231c&sv=2) ![](https://astralane.gitbook.io/docs/~gitbook/image?url=https%3A%2F%2F3735316443-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252Fg4FFsaLytHIct61zl8o6%252Fuploads%252FzS3nRE8o8MFpUV4XiA3O%252Fimage%25201.png%3Falt%3Dmedia%26token%3D1b3af7f6-3eeb-4582-ab98-347d617dee21&width=768&dpr=3&quality=100&sign=8f2d6164&sv=2) ### [hashtag](https://astralane.gitbook.io/docs/low-latency/shreds#libraries-required) Libraries Required Crate Version Why `solana-ledger` `3.1.12` Provides `Shred` type, parsing, and `new_from_serialized_shred()`. Must enable the `agave-unstable-api` feature since the shred module is gated behind it in v3. `solana-packet` `3.x` Provides `PACKET_DATA_SIZE` (1232 bytes) — the max size of a Solana UDP packet. Use this as your receive buffer size. `solana-clock` `3.x` Provides the `Slot` type alias (`u64`). #### [hashtag](https://astralane.gitbook.io/docs/low-latency/shreds#optional) Optional Crate Why `solana-entry` Needed if you want to deserialize deshredded data into `Entry` objects (contains transactions). `bincode` Needed to deserialize the raw deshredded bytes into `Vec`. `solana-streamer` High-performance packet receiver using `recvmmsg`. Useful if you need multi-threaded reception at scale, but overkill for basic usage. `solana-perf` Provides `Deduper` (bloom filter) for deduplicating shreds. Only needed at scale. #### [hashtag](https://astralane.gitbook.io/docs/low-latency/shreds#cargo.toml) Cargo.toml **Note on GCC 15+**: `solana-ledger` pulls in RocksDB which fails to compile on GCC 15 due to missing `` includes. Add this workaround: ### [hashtag](https://astralane.gitbook.io/docs/low-latency/shreds#shred-wire-format) Shred Wire Format Every shred starts with a fixed common header at these byte offsets: You don't need to parse this manually — `Shred::new_from_serialized_shred()` does it for you. ### [hashtag](https://astralane.gitbook.io/docs/low-latency/shreds#code-structure) Code Structure #### [hashtag](https://astralane.gitbook.io/docs/low-latency/shreds#id-1.-bind-a-udp-socket) 1\. Bind a UDP socket Use `PACKET_DATA_SIZE` (1232 bytes) as your receive buffer — this is the maximum size of any Solana UDP packet. #### [hashtag](https://astralane.gitbook.io/docs/low-latency/shreds#id-2.-receive-packets-in-a-loop) 2\. Receive packets in a loop Each call to `recv_from` gives you exactly one shred. #### [hashtag](https://astralane.gitbook.io/docs/low-latency/shreds#id-3.-parse-the-shred) 3\. Parse the shred This validates the packet and returns a `Shred` enum (either data or code variant). #### [hashtag](https://astralane.gitbook.io/docs/low-latency/shreds#id-4.-read-shred-fields) 4\. Read shred fields #### [hashtag](https://astralane.gitbook.io/docs/low-latency/shreds#minimal-complete-example) Minimal complete example code : [https://github.com/Astralane/Shred\_example/tree/mainarrow-up-right](https://github.com/Astralane/Shred_example/tree/main) [PreviousTip Refundschevron-left](https://astralane.gitbook.io/docs/low-latency/submit-transactions/tip-refunds) Last updated 2 days ago * [What are Shreds?](https://astralane.gitbook.io/docs/low-latency/shreds#what-are-shreds) * [Why it matters](https://astralane.gitbook.io/docs/low-latency/shreds#why-it-matters) * [Who this is for](https://astralane.gitbook.io/docs/low-latency/shreds#who-this-is-for) * [How Astralane Shreds work](https://astralane.gitbook.io/docs/low-latency/shreds#how-astralane-shreds-work) * [Get Access to Shreds](https://astralane.gitbook.io/docs/low-latency/shreds#get-access-to-shreds) * [Libraries Required](https://astralane.gitbook.io/docs/low-latency/shreds#libraries-required) * [Shred Wire Format](https://astralane.gitbook.io/docs/low-latency/shreds#shred-wire-format) * [Code Structure](https://astralane.gitbook.io/docs/low-latency/shreds#code-structure) sun-brightdesktopmoon Copy [dependencies] solana-ledger = { version = "=3.1.12", features = ["agave-unstable-api"] } solana-packet = "3" solana-clock = "3" Copy # .cargo/config.toml [env] CXXFLAGS = "-include cstdint" Copy Offset Size Field ------ ---- ----- 0 64 Signature (ed25519) 64 1 ShredVariant (identifies type: legacy data/code, merkle data/code) 65 8 Slot (u64 LE) — which slot this shred belongs to 73 4 Index (u32 LE) — position within the slot 77 2 Version (u16 LE) — shred version 79 4 FEC Set Index (u32 LE) — which FEC erasure coding group Copy use std::net::UdpSocket; use solana_packet::PACKET_DATA_SIZE; let socket = UdpSocket::bind("0.0.0.0:20000") .expect("Failed to bind"); Copy let mut buf = [0u8; PACKET_DATA_SIZE]; loop { let (size, src) = socket.recv_from(&mut buf)?; // `buf[..size]` is one raw shred } Copy use solana_ledger::shred::Shred; let shred = Shred::new_from_serialized_shred(buf[..size].to_vec())?; Copy shred.slot() // u64 — which slot shred.index() // u32 — position in the slot shred.shred_type() // ShredType::Data or ShredType::Code shred.fec_set_index() // u32 — FEC erasure coding group shred.data_complete() // bool — last shred in a data segment shred.last_in_slot() // bool — final shred of the entire slot shred.payload() // &Payload (Deref) — raw bytes Copy use std::net::UdpSocket; use solana_ledger::shred::Shred; use solana_packet::PACKET_DATA_SIZE; fn main() { let socket = UdpSocket::bind("0.0.0.0:20000").unwrap(); let mut buf = [0u8; PACKET_DATA_SIZE]; let mut count: u64 = 0; loop { let (size, src) = match socket.recv_from(&mut buf) { Ok(r) => r, Err(e) => { eprintln!("recv error: {e}"); continue; } }; count += 1; match Shred::new_from_serialized_shred(buf[..size].to_vec()) { Ok(shred) => { println!( "[#{count}] from={src} slot={} index={} type={:?} fec_set={}", shred.slot(), shred.index(), shred.shred_type(), shred.fec_set_index(), ); } Err(e) => eprintln!("[#{count}] from={src} bad shred: {e}"), } } } sun-brightdesktopmoon --- # Submit Transactions | Astralane Astralane provides a multitude of options for your needs, here are some of RPC methods we offer for Transaction sending. * * * [hashtag](https://astralane.gitbook.io/docs/low-latency/submit-transactions#sendtransaction) sendTransaction ----------------------------------------------------------------------------------------------------------------- circle-info 🚀 For the fastest transaction execution, we recommend using our `sendTransaction` method. This RPC call is fully compatible with all Solana libraries, making it a simple drop-in replacement for your existing workflows. It routes through our partner **SWQoS** clients, including **Jito** and **Paladin** (higher min tip), and provides direct routing to leading **block builders** like **Harmonic** and **BAM**. Additionally, it supports integration with **custom schedulers** such as **Rakurai**, ensuring optimized transaction processing, reduced latency, and maximum reliability across the network. Just insert the URL where you would place a RPC URL and send your txns how you send normally. The only change is to add an instruction to tip. #### [hashtag](https://astralane.gitbook.io/docs/low-latency/submit-transactions#uri-params) URI Params Param Type Description `api-key` String **Mandatory**, to set api key for authentication `mev-protect` Boolean **Optional**, To set mev protect, default is `false` `swqos-only` Boolean **Optional**, if set `true` , txn will be only sent via swqos, default is `false` Example : Copy https://fra.gateway.astralane.io/iris?api-key=APIKEY&mev-protect=true #### [hashtag](https://astralane.gitbook.io/docs/low-latency/submit-transactions#json-rpc-params) JSON-RPC params Parameter Type Description Encoded Transaction String A base64 encoded transaction. Transaction Configuration JSON Object Its recommended to put - `encoding` as `base64` - `skipPreflight` as `true` MeV Protect JSON Object Optional, setting it true will enable mev protect, Default is false. Example : Example Request JSON : Example Success Response JSON : Example Error Response JSON : Rust circle-info Please do note that the sendTransaction endpoint supports **max\_retries** feature which is useful for traders which don't want our staked nodes to retry their txns. Reach out to us for more info on ideal use cases. * * * [hashtag](https://astralane.gitbook.io/docs/low-latency/submit-transactions#sendbundle) sendBundle ------------------------------------------------------------------------------------------------------- If your operation depends on atomic txn execution then use our sendBundle endpoint to send atomically executing transactions. Send up to **4 transactions** in a single atomic bundle. These transactions are executed **sequentially** , ensuring precision and reliability. If any transaction fails, the entire bundle is reverted—guaranteeing consistency and eliminating partial failures. Parameter Type Description Boolean Optional, If a bundle only has 1 txn with this parameter as `false`, then it will also sent via `sentTransaction` pipeline. Default is `false` Rust Golang _Code example for sendIdeal endpoint usage in Go given below:_ For further explanation please refer Rust docs on step by step details on whats happening. **Request:** **Response:** List of signatures for your transaction circle-info Note: MAX\_TRANSACTIONS\_IN\_BUNDLE = 4 _For enhanced MEV Protection on bundles use any valid Solana public key starting with_ `_jitodontfront_` _and_ `_dontbund1e_`_. Txns containing these instruction will be rejected by Jito/Harmonic block engines unless its at index zero._ _Read more about it here:_ [_Jito_arrow-up-right](https://docs.jito.wtf/lowlatencytxnsend/#sandwich-mitigation) _,_ [_Harmonic_arrow-up-right](https://docs.harmonic.gg/searchers/bundle-control-accounts) * * * [hashtag](https://astralane.gitbook.io/docs/low-latency/submit-transactions#sendideal) sendIdeal ----------------------------------------------------------------------------------------------------- Perfect for snipers! Due to the segregation in validators as JITO validators and normal ones, traders are often conflicted between spending more on jito tips vs more in priority fees. Durable nonces offer a way to mitigate this issue. Our sendIdeal RPC method accepts two transactions: * One with a **high priority fee + min tip** * Another with a **high tip + lower priority fee** We route them through our advanced **SWQoS and bundling pipelines**. Using **durable nonces**, once one transaction lands, the other is automatically canceled—ensuring optimal efficiency and cost savings. if you don't want to manage the durable nonce accounts on your own we also provide a managed service for this, We create a nonce account for each api-key you use and you can query them using our **getNonce** rpc call. Follow the below integration steps for best utilization of this feature: Rust Typescript #### [hashtag](https://astralane.gitbook.io/docs/low-latency/submit-transactions#step-1-generate-nonce-instruction) **Step 1 : Generate Nonce instruction** circle-info if you already have an existing nonce account, you can just pass in your nonce account, you can simply pass in your nonce account public key instead of the API key. The response will still include your parsed nonce. To use this nonce, just include an **advance nonce instruction** as the first instruction in your transactions. #### [hashtag](https://astralane.gitbook.io/docs/low-latency/submit-transactions#step-2-generate-your-txn-and-partial-sign-it-before-submission) **Step 2 : Generate your txn and Partial Sign it before submission** circle-info When using Astralane's managed nonce accounts, ensure that you use the **partial\_sign** method to sign your transactions. If you are not utilizing managed nonce accounts, proceed with the standard sign method. _Code example for sendIdeal endpoint usage in TypeScript given below:_ For further explanation please refer Rust docs on step by step details on whats happening. **Request:** **Response:** The latency performance for your transactions will depend on current network dynamics. Kindly reach out to us on telegram for recommendations on ideal setup for your operation * * * [hashtag](https://astralane.gitbook.io/docs/low-latency/submit-transactions#sendbatch) sendBatch ----------------------------------------------------------------------------------------------------- Submits a batch of serialized transactions for processing. Returns the transaction signatures upon successful submission. > Note : > > Only available on request ### [hashtag](https://astralane.gitbook.io/docs/low-latency/submit-transactions#request) Request **Method:** `sendBatch` #### [hashtag](https://astralane.gitbook.io/docs/low-latency/submit-transactions#parameters) Parameters Type Required Description `string[]` Yes Array of base64-encoded serialized transactions. Maximum batch size is **25** transactions. Each transaction must include a valid tip. `object` No Optional configuration object. **Configuration Object** Field Type Default Description `mevProtect` `boolean` `false` When `true`, enables MEV protection for all transactions in the batch. ### [hashtag](https://astralane.gitbook.io/docs/low-latency/submit-transactions#response) Response Returns `string[]` — an array of base58-encoded transaction signatures, in the same order as the input transactions. ### [hashtag](https://astralane.gitbook.io/docs/low-latency/submit-transactions#errors) Errors Code Message Description `-32600` `request size {n} exceeded max batch size {max}` Batch exceeds the maximum allowed size. `-32600` `contains duplicate signature` Two or more transactions in the batch share the same signature. `-32600` `Transaction sanitization errors` A transaction is malformed or does not meet the minimum tip requirement. `-32603` `failed to send batch, internal error` Internal dispatch failure. ### [hashtag](https://astralane.gitbook.io/docs/low-latency/submit-transactions#example) Example #### [hashtag](https://astralane.gitbook.io/docs/low-latency/submit-transactions#request-1) Request #### [hashtag](https://astralane.gitbook.io/docs/low-latency/submit-transactions#response-1) Response #### [hashtag](https://astralane.gitbook.io/docs/low-latency/submit-transactions#code-example) Code Example TypeScript Javascript ### [hashtag](https://astralane.gitbook.io/docs/low-latency/submit-transactions#notes) Notes * All transactions in the batch must meet the minimum tip requirement. * Duplicate signatures within a batch will cause the entire request to fail. * Transactions are processed individually after submission; a successful response means the transactions were accepted, not confirmed on-chain. * * * **Need Help?** Join our [**Discord**arrow-up-right](https://discord.gg/2UfWGtUDtN) for technical guides, integration support, and live updates. [PreviousChangelogschevron-left](https://astralane.gitbook.io/docs/low-latency/endpoints-and-configs/changelogs) [NextQUIC Transaction Submissionchevron-right](https://astralane.gitbook.io/docs/low-latency/submit-transactions/quic-transaction-submission) Last updated 19 days ago * [sendTransaction](https://astralane.gitbook.io/docs/low-latency/submit-transactions#sendtransaction) * [sendBundle](https://astralane.gitbook.io/docs/low-latency/submit-transactions#sendbundle) * [sendIdeal](https://astralane.gitbook.io/docs/low-latency/submit-transactions#sendideal) * [sendBatch](https://astralane.gitbook.io/docs/low-latency/submit-transactions#sendbatch) * [Request](https://astralane.gitbook.io/docs/low-latency/submit-transactions#request) * [Response](https://astralane.gitbook.io/docs/low-latency/submit-transactions#response) * [Errors](https://astralane.gitbook.io/docs/low-latency/submit-transactions#errors) * [Example](https://astralane.gitbook.io/docs/low-latency/submit-transactions#example) * [Notes](https://astralane.gitbook.io/docs/low-latency/submit-transactions#notes) sun-brightdesktopmoon Copy "params" : [ // params is an array\ ,\ ,\ \ ] Copy { "id": 1, "jsonrpc": "2.0", "method": "sendTransaction", "params": [\ "base64_encoded_txn1",\ {\ "encoding": "base64",\ "skipPreflight": true\ },\ { "mevProtect": true }\ ] } Copy { "jsonrpc": "2.0", "id": 1, "result": "Signature" } Copy { "jsonrpc": "2.0", "id": 1, "error": { "code": -32600, "message": "Error message" } } Copy const TIP: Pubkey = pubkey!("astra4uejePWneqNaJKuFFA8oonqCE1sqF6b45kDMZm"); // Use tip wallet depending on region of access const MIN_TIP_AMOUNT: u64 = 10000; // added for spam prevention fn send_tx_tipped( ixs: &mut Vec, signer: &Keypair, rpc_client: &RpcClient, // https://api.mainnet-beta.solana.com astralane_txn_sender: &RpcClient // Astralane RPC ) { let tip_ix = system_instruction::transfer(&signer.pubkey(), &TIP, MIN_TIP_AMOUNT); ixs.push(tip_ix); let blockhash = rpc_client.get_latest_blockhash().unwrap(); let tx = Transaction::new_signed_with_payer(ixs, Some(&signer.pubkey()), &[signer], blockhash); let encoded_tx = base64::prelude::BASE64_STANDARD.encode(&bincode::serialize(tx).unwrap()); let response = client .post(url) .header("api_key", "xxx") .json(&json! ({ "jsonrpc": "2.0", "id": 1, "method": "sendTransaction", "params": [\ encoded_tx, \ {\ "encoding": "base64",\ "skipPreflight": true,\ },\ { "mevProtect": true }// Mev protect enable, Optional, Default is false\ ] })) .send() .await; } } Copy revertProtection Copy const TIP: Pubkey = pubkey!("astra4uejePWneqNaJKuFFA8oonqCE1sqF6b45kDMZm"); // Use tip wallet depending on region of access const MIN_TIP_AMOUNT: u64 = 10000; // added for spam prevention async fn send_bundle( ixs: &mut Vec, signer: &Keypair, client: reqwest::Client, blockhash: Hash, url: String, ) { let tip_ix = system_instruction::transfer(&signer.pubkey(), &TIP, MIN_TIP_AMOUNT); ixs.push(tip_ix); let tx = Transaction::new_signed_with_payer(ixs, Some(&signer.pubkey()), &[signer], blockhash); let encoded_tx = base64::prelude::BASE64_STANDARD.encode(&bincode::serialize(tx).unwrap()); let response = client .post(url) .header("api_key", "xxx") .json(&json! ({ "jsonrpc": "2.0", "id": 1, "method": "sendBundle", "params": [[encoded_tx]], })) .send() .await; } Copy package main import ( "bytes" "context" "encoding/base64" "encoding/json" "fmt" "github.com/davecgh/go-spew/spew" "github.com/gagliardetto/solana-go/programs/system" "log" "net/http" "time" "github.com/gagliardetto/solana-go" "github.com/gagliardetto/solana-go/rpc" ) func main() { payerPrivateKeyBase58 := "YOUR_WALLET_PRIVATE_KEY" astralaneTipAddressBase58 := "astra4uejePWneqNaJKuFFA8oonqCE1sqF6b45kDMZm" rpcEndpoint := "DM_US_FOR_TRIAL_RPC_ENDPOINTS" astralaneEndpoint := "http://fr.gateway.astralane.io/iris?api-key=YOUR_ASTRALANE_API_KEY" signer, err := solana.PrivateKeyFromBase58(payerPrivateKeyBase58) if err != nil { log.Fatalf("Failed to load private key: %v", err) } client := rpc.New(rpcEndpoint) recentBlockhash, err := client.GetLatestBlockhash(context.Background(), rpc.CommitmentFinalized) if err != nil { log.Fatalf("Failed to get recent blockhash: %v", err) } astralaneTipAddress, err := solana.PublicKeyFromBase58(astralaneTipAddressBase58) if err != nil { log.Fatalf("Failed to decode astralane tip address: %v", err) } tx, err := solana.NewTransaction( []solana.Instruction{ system.NewTransferInstruction( 200_000, signer.PublicKey(), astralaneTipAddress, ).Build(), }, recentBlockhash.Value.Blockhash, solana.TransactionPayer(signer.PublicKey()), ) if err != nil { log.Fatalf("Failed to create transaction: %v", err) } if _, err := tx.Sign(func(key solana.PublicKey) *solana.PrivateKey { return &signer }); err != nil { log.Fatalf("Failed to sign transaction: %v", err) } spew.Dump(tx) out, err := tx.MarshalBinary() if err != nil { log.Fatalf("Marshaling to binary failed: %v", err) } encodedTx := base64.StdEncoding.EncodeToString(out) decoded, err := base64.StdEncoding.DecodeString(encodedTx) if err != nil { log.Fatalf("Sanity check decode failed: %v", err) } if !bytes.Equal(decoded, out) { log.Fatalf("Sanity check failed: decoded transaction does not match original binary") } payload := map[string]interface{}{ "jsonrpc": "2.0", "id": 1, "method": "sendBundle", "params": []interface{}{ []string{encodedTx}, }, } response, err := sendBundleRequest(astralaneEndpoint, payload) if err != nil { log.Fatalf("Bundle RPC failed: %v", err) } log.Printf("Bundle RPC response: %s", response) } func sendBundleRequest(endpoint string, payload map[string]interface{}) (string, error) { jsonData, err := json.Marshal(payload) if err != nil { return "", fmt.Errorf("Failed to marshal JSON: %w", err) } client := &http.Client{Timeout: 15 * time.Second} resp, err := client.Post(endpoint, "application/json", bytes.NewBuffer(jsonData)) if err != nil { return "", fmt.Errorf("Request to Bundle RPC failed: %w", err) } defer resp.Body.Close() var result map[string]interface{} if err := json.NewDecoder(resp.Body).Decode(&result); err != nil { return "", fmt.Errorf("Failed to decode Bundle RPC response: %w", err) } responseBytes, _ := json.MarshalIndent(result, "", " ") return string(responseBytes), nil } Copy { "id": 1, "jsonrpc": "2.0", "method": "sendBundle", "params": [\ [\ "base64_encoded_txn1",\ "base64_encoded_txn2",\ "base64_encoded_txn3"\ ],\ {\ "encoding": "base64",\ "mevProtect": true,\ "revertProtection": false\ }\ ] } Copy { "jsonrpc": "2.0", "id": 1, "result": [\ "37Dxw2nJYw3T8JVqenPQMf39VJ9CNZYCyQm67b6nRj6fa6UjQ1UuLqFvh3wJ2G7LcMuZn4oq5kDt2A2CEXfi8D8"\ ] } Copy use solana_sdk::hash::Hash; use solana_sdk::pubkey::Pubkey; use solana_sdk::signature::{EncodableKey, Keypair, Signer}; async fn get_nonce( client: reqwest::Client, url: String, auth_key: String, ) { let response = client .post(url) .header("api_key", "xxx") .json(&json! ({ "jsonrpc": "2.0", "id": 1, "method": "getNonce", "params": [api_key], // provided during onboarding })) .send() .await; let result = response["result"].clone(); let nonce = result["nonce"].as_str().unwrap(); let nonce_account = Pubkey::from_str(result["nonceAccount"].as_str().unwrap()).unwrap(); let nonce_authority = Pubkey::from_str(result["nonceAuthority"].as_str().unwrap()).unwrap(); let nonce_as_hash = Hash::from_str(nonce).unwrap(); } Copy const TIP: Pubkey = pubkey!("astra4uejePWneqNaJKuFFA8oonqCE1sqF6b45kDMZm"); // Use tip wallet depending on region of access const MIN_TIP_AMOUNT: u64 = 10000; // added for spam prevention async fn send_ideal( signer: &Keypair, client: reqwest::Client, nonce: Hash, instructions: Vec, nonce_authority: &Pubkey, nonce_account: &Pubkey, ) { // add advance nonce instruction let advance_nonce = solana_sdk::system_instruction::advance_nonce_account(nonce_account, nonce_authority); let low_tip_high_fee_ixs = vec![\ advance_nonce.clone(),\ solana_sdk::compute_budget::ComputeBudgetInstruction::set_compute_unit_price(\ 10 * MICRO_LAMPORTS_PER_LAMPORTS,\ ),\ // add your instructions here\ solana_sdk::system_instruction::transfer(&signer.pubkey(), &TIP, MIN_TIP_AMOUNT),\ ]; let high_tip_low_fee_ixs = vec![\ advance_nonce,\ solana_sdk::compute_budget::ComputeBudgetInstruction::set_compute_unit_price(\ 100,\ ),\ // add your instructions here\ solana_sdk::system_instruction::transfer(&signer.pubkey(), &TIP, 100 * MIN_TIP_AMOUNT),\ ]; //add high transaction priority fee and min tip let mut low_tip_high_fee_tx = Transaction::new_with_payer(&low_tip_high_fee_ixs, Some(&signer.pubkey())); low_tip_high_fee_tx.partial_sign(&[&signer], nonce); let mut high_tip_low_fee_tx = Transaction::new_with_payer(&high_tip_low_fee_ixs, Some(&signer.pubkey())); high_tip_low_fee_tx.partial_sign(&[&signer], nonce); let low_tip_high_fee_tx_encoded = base64::prelude::BASE64_STANDARD.encode(&bincode::serialize(low_tip_high_fee_tx).unwrap()); let high_tip_low_fee_tx_encoded = base64::prelude::BASE64_STANDARD.encode(&bincode::serialize(high_tip_low_fee_tx).unwrap()); let response = client .post(url) .json(&json! ({ "jsonrpc": "2.0", "id": 1, "method": "sendIdeal", "params": [[low_tip_high_fee_tx_encoded, high_tip_low_fee_tx_encoded]], })) .send() .await; } Copy import { Connection, Keypair, PublicKey, SystemProgram, Transaction, LAMPORTS_PER_SOL, ComputeBudgetProgram, } from '@solana/web3.js'; import * as bs58 from 'bs58'; async sendTransTest() { try { const result = await fetch( `http://fr.gateway.astralane.io/iris?api-key=`, { method: 'POST', headers: { 'Content-Type': 'application/json', }, body: JSON.stringify({ jsonrpc: '2.0', id: 1, method: 'getNonce', params: [\ 'api-key',\ ], }), }, ); const res = await result.json(); const data = res as any; const nonceAccount = new PublicKey(data.result.nonceAccount); const nonceAuthority = new PublicKey(data.result.nonceAuthority); const nonce = data.result.nonce; const advanceNonce = SystemProgram.nonceAdvance({ noncePubkey: nonceAccount, authorizedPubkey: nonceAuthority, }); const secretKey = Keypair.fromSecretKey( bs58.default.decode( 'wallet-private-key', ), ); const wallet = secretKey; //Tip account const toPublicKey = new PublicKey( 'astra4uejePWneqNaJKuFFA8oonqCE1sqF6b45kDMZm', ); const MIN_TIP_AMOUNT = 10000; const lowTipHighFeeIx = [\ advanceNonce,\ ComputeBudgetProgram.setComputeUnitPrice({\ microLamports: 1 * 100000,\ }),\ SystemProgram.transfer({\ fromPubkey: wallet.publicKey,\ toPubkey: toPublicKey,\ lamports: MIN_TIP_AMOUNT,\ }),\ ]; const HighTipLowFeeIx = [\ advanceNonce,\ ComputeBudgetProgram.setComputeUnitPrice({\ microLamports: 1 * 100,\ }),\ SystemProgram.transfer({\ fromPubkey: wallet.publicKey,\ toPubkey: toPublicKey,\ lamports: 100 * MIN_TIP_AMOUNT,\ }),\ ]; const htlfTransaction = new Transaction().add(...HighTipLowFeeIx); htlfTransaction.recentBlockhash = nonce; htlfTransaction.feePayer = wallet.publicKey; htlfTransaction.partialSign(wallet); const highTipLowFeeEncoded = Buffer.from( htlfTransaction.serialize({ requireAllSignatures: false, verifySignatures: false, }), ).toString('base64'); const lthfTransaction = new Transaction().add(...lowTipHighFeeIx); lthfTransaction.recentBlockhash = nonce; lthfTransaction.feePayer = wallet.publicKey; lthfTransaction.partialSign(wallet); const lowTipHighFeeEncoded = Buffer.from( lthfTransaction.serialize({ requireAllSignatures: false, verifySignatures: false, }), ).toString('base64'); const final = await fetch( `http://fr.gateway.astralane.io/iris?api-key=`, { method: 'POST', headers: { 'Content-Type': 'application/json', }, body: JSON.stringify({ jsonrpc: '2.0', id: 1, method: 'sendIdeal', params: [[highTipLowFeeEncoded, lowTipHighFeeEncoded]], }), }, ); const finalResult = await final.json(); console.log(finalResult); return lowTipHighFeeEncoded; } catch (error) { console.log(error); } } Copy { "id": 1, "jsonrpc": "2.0", "method": "sendIdeal", "params": [[\ "transction_with_large_tip_low_priority_fee",\ "transaction_with_large_priority_fee_low_tip"\ ]] } Copy { "jsonrpc": "2.0", "id": 1, "result": [\ "",\ ""\ ] } Copy const response = await fetch(RPC_URL, { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ jsonrpc: "2.0", id: 1, method: "sendBatch", params: [\ [\ "4hXTCkRzt9WyecNzV1XPgCDfGAZzQKNxLXgynz5QDuWWPSAZBZSHptvWRL3BjCvzUXRdKvHL2b7yGrRQcWyaqsaBCncVG7BFggS8w9snUts67BSh3EqKpXLUm5UMHfD7ZBe9GhARjbNQMLJ1QD3Spr6oMTBU6EhdB4RD8CP2xUxr2u3d6fos36PD98XS6oX8TQjLpsMwncs5DAMiD4nNnR8NBfyghGCWvCVifVwvA8B8TJxE1aiyiv9eL5MKs6",\ "5jKVoAQRSqLzundGBFXmP3MqL5HEytHHijCN2sJFueRqgGQqJSLarjNDQRNJbG3ADFaDj1LE3z..."\ ],\ {\ "mevProtect": true\ }\ ] }) }); const result = await response.json(); console.log(result); Copy { "jsonrpc": "2.0", "id": 1, "result": [\ "5VERv8NMhKqATzGBGFst5oBZoJN8sW2azHjfYFWRnMC9bYg2nFQrpRNr3zetGhKRKXnR8L1m7fBHU9bVNFRFcxk2",\ "2xPkqLFhNk8iFhKt7MAqGumnaYSJdETxr5L4sKbqgjAeZR3ynk14Y6RCf4vUGDJ9dM2kT3qXMGJY9x5vNR1QWCW"\ ] } Copy interface SendBatchOptions { /** When `true`, enables MEV protection for all transactions in the batch. @default false */ mevProtect?: boolean; } interface JsonRpcResponse { jsonrpc: "2.0"; id: number; result?: T; error?: { code: number; message: string }; } async function sendBatch( rpcUrl: string, transactions: string[], // base58-encoded serialized Solana transactions options: SendBatchOptions = {} ): Promise { // returns transaction signatures const params: [string[], SendBatchOptions?] = [transactions]; if (Object.keys(options).length > 0) { params.push(options); } const response = await fetch(rpcUrl, { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ jsonrpc: "2.0", id: 1, method: "sendBatch", params, }), }); const data: JsonRpcResponse = await response.json(); if (data.error) { throw new Error(`sendBatch failed: ${data.error.message}`); } return data.result!; } // Usage const signatures: string[] = await sendBatch( "https://your-rpc-endpoint.com", [serializedTx1, serializedTx2], { mevProtect: true } ); Copy async function sendBatch(rpcUrl, transactions, options = {}) { const params = [transactions]; if (Object.keys(options).length > 0) { params.push(options); } const response = await fetch(rpcUrl, { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ jsonrpc: "2.0", id: 1, method: "sendBatch", params, }), }); const data = await response.json(); if (data.error) { throw new Error(`sendBatch failed: ${data.error.message}`); } return data.result; // string[] } // Usage const signatures = await sendBatch( "https://your-rpc-endpoint.com", [serializedTx1, serializedTx2], { mevProtect: true } ); sun-brightdesktopmoon --- # 快速上手 | Astralane 本站使用 cookie 来提供服务并分析流量。浏览本站,即表示您接受[隐私政策](https://policies.gitbook.com/privacy/cookies) 。 close 接受拒绝 ---