本文介绍 Skip Go API 的 Smart Relay 功能。这是在 Skip Go 支持的任意桥上,将用户尽可能快速且可靠地送达目标位置的方式。Smart Relay 是公共桥中继器的替代方案,旨在让用户以更少的交易获得更多可用的兑换与转账路径,并提升速度与可靠性。
我们强烈建议所有希望提供一流用户体验的集成方启用 Smart Relay。如果不使用 Smart Relay,你的表现会受到影响:
  • 很多路径将不可用(例如从 Solana 桥接到 Base,或从 Solana 到任意 Cosmos 链)
  • 很多路径将需要更多交易(例如将 USDC 从 Ethereum 桥接到 Osmosis 时,需要 2 笔交易,而不是 1 笔)
  • 转账更容易卡住
你只需在 /msgs_direct 或 /route 中设置 smart_relay=true 即可启用。
本文涵盖:
  • 什么是 Smart Relay
  • Smart Relay 当前支持哪些桥(以及接下来会支持什么)
  • 如何使用 Smart Relay
  • 影响 Smart Relay 价格的因素
什么是中继?广义上,中继是指通过构造跨链证明,并向目标链与源链提交完成消息投递所需的 burn/mint/wrap/ack 证明交易,从而执行跨链消息或动作。所有桥和通用消息传递协议(IBC、Axelar、Wormhole、CCTP 等)都有某种形式的中继机制,只是有时名称不同。

背景

Smart Relay 是一种具备意图感知、以用户为中心、通用性的中继器;对于我们支持的所有桥和路径,它都能提供比公共中继器更好的性能保障。我们以较小的终端用户成本提供这项服务,对开发者或集成方则不收费。简而言之,无论用户与目标之间隔着多少条桥或多少条链,Smart Relay 都能帮助他们通过比公共中继器更少的交易、更快的速度,到达更多目的地。 Smart Relay 相比现有中继系统是一次巨大改进,而这得益于它与 Skip Go 路由能力的智能集成:
  • 意图感知:传统中继器通常只知道转账路径的第一跳,并不了解用户最终想完成什么;但实际中,转账往往只是更大一串兑换、转账和链上操作的一部分。Smart Relayer 拥有用户端到端跨链意图的上下文,因此可以利用这些信息优化执行计划。
    • 例如,Smart Relay 可以在投递第一座桥的数据包时,自动触发路径中的第二座桥,从而减少用户需要签名的交易数量(例如在 CCTP 之后触发 IBC)。
    • 它还可以利用这些信息,提前为用户的目标地址做好接收准备(例如即使无法执行原子兑换,也能预充少量 gas,或在 Solana 上初始化 token 账户等)。
  • 以用户为中心:传统中继器通常围绕特定“通道”或“桥”工作,只负责把某一条桥路径上的所有数据包从一条链转到另一条链。完成后,它们就认为任务结束了。相比之下,Smart Relayer 优先考虑的是用户,而不是桥。它不会一次只清理一座桥上的数据包,而是会跨多座桥或多跳,把与某个用户相关的所有数据包都转运完成,以确保用户高效抵达目标。
    • 它还为用户提供了高度简化、面向多跳场景设计的支付体验:用户只需在源链上、用自己正在转移的那个代币支付一次,之后整条路径的每一段都能获得高质量的中继服务。
  • 通用性:传统中继器通常一次只为单一桥支持 1 到 2 条链或生态,这使跨生态转账充满不确定性。很多路径根本没有中继器,或者覆盖很不稳定。Smart Relay 从一开始就是为支持所有生态和所有桥而设计的。目前它已经支持 EVM、Solana/SVM、Cosmos 和模块化生态,并会持续增加更多链、桥和路径。
Smart Relay 的成本会根据下文介绍的因素动态决定。其中,路径涉及的 gas 价格与桥费用是决定成本的主要因素。

Smart Relay 当前状态

目前,Smart Relay 支持:
  • CCTP
我们正在构建对以下桥的支持:
  • IBC
  • Hyperlane
  • Axelar
对于 Smart Relay 当前尚不支持的桥,Skip Go 会使用公共中继器或协议内置中继器,并按照它们通常向用户提供服务时的成本执行。(IBC 通常免费,其他桥则可能带有一定费用。)用户需要承担的所有成本,都会在相关端点响应中明确展示。

如何使用 Smart Relay

如何启用 Smart Relay

  1. 在 /route 或 /msgs_direct 中传入 smart_relay=true
  2. 如果使用 /msgs,请确保将 /route 响应中 cctp_transfer 操作提供的 smart_relay_fee_quote 对象传回 /msgs 请求中。
    • 如果你使用的是 @skip-go/client 库,0.8.0 及以上版本会自动支持这一点。如果你是直接集成 API,并且会先解码 /route 响应中的操作再传回 msgs,只需确保正确解码这个新字段并将其原样传回。
  3. 像平常一样签名交易,然后照常通过 /track 或 /submit 将已签名交易提交给 Skip Go API
    • 注意:我们强烈建议使用 /submit 将 Smart Relay 交易提交上链,以避免交易已经提交到链上,但没有发送到 /track 端点而产生的问题。
就是这样。Smart Relay 会负责在它当前支持的所有桥上执行你的跨链操作。

如何判断 Smart Relay 会向用户收取多少费用

在 /route、/msgs_direct 和 /msgs 的响应中,Smart Relay 的成本会出现在 estimated_fees 数组里,其中 fee_type 会被设置为 SMART_RELAY。关于 estimated_fees 的更多信息,请参阅 获取费用信息。 对于多交易路径,用户每笔交易最多可能支付 1 次 Smart Relay 费用。 每笔交易对应的这笔费用,覆盖该交易中所有 Smart Relay 操作。这能避免 Smart Relay 过早收款去执行后续交易中的操作,因为后续交易可能并不会被签名或执行。 你可以使用 estimated_fees 条目中的 tx_index 属性,识别某笔 Smart Relay 费用对应路径中的哪一笔交易。(例如 tx_index=0 表示这是该路径第一笔交易的费用。)

Smart Relay 费用由什么决定

Smart Relay 会产生用户成本,因为它需要真实地向多条链提交交易,并因此承担交易手续费。
  • 操作内容:一条路径的中继成本取决于其中包含哪些操作,因为这些操作会影响 Smart Relay 消耗的 gas 数量(例如包含兑换的路径会需要更多 gas,也会带来更高的中继成本)
  • gas 成本:大多数网络都有动态手续费市场,在网络负载较高时,gas 价格会上涨。Smart Relay 在生成报价时会将这一点考虑在内
  • 代币汇率:用户支付费用所用的代币,可能与 Smart Relay 支付 gas 费用所用的代币不同,因此汇率会影响终端用户实际感受到的价格。(例如,如果用户在一条终点为 Ethereum 主网的路径中使用 OSMO 支付费用,Smart Relay 则需要用 ETH 支付手续费,因此用户支付的 OSMO 数量会取决于 OSMO/ETH 的现货价格。)

如何正确使用 Smart Relay Fee Quote

Skip Go 会根据底层实时成本,动态计算应支付的 Smart Relay 费用。 虽然你应该使用 estimated_fees 数组中的信息来做展示,但 cctp_transfer 还会包含一个 smart_relay_fee_quote,用于提供正确使用这套动态中继费用系统所需的必要信息。具体来说,smart_relay_fee_quote 对象包含需要支付的 smart relay 费用,以及报价何时过期(过期后,所报金额可能不再有效,交易也可能无法被成功中继)。 如果你使用 /msgs 端点,请确保将 /route 响应中 cctp_transfer 操作提供的 smart_relay_fee_quote 对象传回 /msgs 请求。这对于确保 API 生成的交易与 /route 请求中的报价一致是必要的。如果没有将该报价传回 /msgs 请求,那么 /msgs 调用中会重新生成一个新报价,而它可能与先前 /route 请求中的报价不同。@skip-go/client 库的 0.8.0 及以上版本会自动支持这一点。如果你是直接集成 API,并且会先解码 /route 响应中的操作再传回 /msgs,只需确保正确解码这个新字段并将其原样传回。请参见下方的 SmartRelayFeeQuote:
export type SmartRelayFeeQuote = {
  feeAmount: string;
  feeDenom: string;
  feePaymentAddress: string;
  relayerAddress: string;
  expiration: Date;
}

This document introduces Skip Go API’s Smart Relay functionality — the fastest & most reliable way to get your users where they’re going over any bridge supported by Skip Go. Smart Relay is an alternative to public bridge relayers. It’s designed to enable users to access more swap and transfer routes in fewer transactions with greater speed and reliability.
We strongly advise all integrators who want to offer top-notch user experiences to activate Smart Relay.If you do not use Smart Relay, your performance will suffer:
  • Many routes will not be available (e.g. Bridging Solana to Base, Solana to any Cosmos chain)
  • Many routes will require more transactions (e.g. Bridging USDC from Ethereum to Osmosis will require 2 transactions, instead of 1)
  • Transfers will get stuck more frequently
You turn it on simply by setting smart_relay=true in /msgs_direct or /route.
This document covers:
  • What Smart Relay is
  • The bridges Smart Relay supports today (& whats next)
  • How to use Smart Relay
  • The factors that affect the price of Smart Relay
What is relaying?In general, relaying refers to the act of executing a cross-chain message/action by constructing the cross-chain proofs and submitting the burn/mint/wrap/ack proof transactions to the destination & source chains that are required to deliver the message.All bridges and general message passing protocols (IBC, Axelar, Wormhole, CCTP, etc…) have some notion of relaying but sometimes it goes by different names.

Background

Smart Relay is a intent-aware, user-centric, universal relayer with better performance guarantees than public relayers for all bridges and routes we support. We offer it at a small cost to the end-user and no cost to the developer/integrator. In short, Smart Relay helps users get to more destinations, in fewer transactions, and at faster speeds than via public relayers — no matter how many bridges or chains stand between them and their destination. Smart Relay is huge improvement over existing relaying systems, made possible by intelligent integration with Skip Go’s routing capabilities.:
  • Intent-aware: Traditional relayers are unaware of what the user is trying to accomplish beyond the first hop of a transfer, but usually transfers are a part of a broader sequence of swaps, transfers, and actions. Smart Relayer has the context of the user’s end-to-end cross-chain intent, and it can use this information to optimize its execution plan.
    • For example, Smart Relay can reduce the number of transactions a user must sign in a route by automatically triggering the second bridge in a route when delivering the packet for the first bridge (e.g. Triggering IBC from CCTP).
    • It can also use this information to prepare the user’s destination address to receive the transfer (e.g. Dust it with gas even if there’s no way to perform an atomic swap, or initialize a token account on Solana, etc…).
  • User-centric: Traditional relayers are focused on specific “channels” or “bridges,” simply transferring all packets for a single bridge route from one chain to another. Once that task is complete, they consider their job done. In contrast, Smart Relayers prioritize the user, not the bridge. Instead of clearing packets on one bridge at a time, they transfer all packets associated with a specific user across multiple bridges or hops, ensuring the user reaches their destination efficiently.
    • It also offers a deeply simplified payment experience for users that’s designed for multi-hop: pay once in the source chain, in the token you’re transferring, and receive high quality relaying at every leg of the route thereafter.
  • Universal: Traditional relayers only support 1 or 2 chains or ecosystems at a time for a single bridge, making cross-ecosystem transfers fraught. Many routes have no relayers or just spotty coverage. Smart Relay was designed to support all ecosystems and all bridges from the start. It already supports EVM, Solana/SVM, Cosmos, and modular — with more chains, bridges, and routes routinely added.
The cost of Smart Relay is determined dynamically based on the factors covered below. The gas prices and bridge fees involved in a route are the principal determinants of that cost.

State of Smart Relay

Today, Smart Relay supports:
  • CCTP
We are currently building out support for:
  • IBC
  • Hyperlane
  • Axelar
For the bridges that Smart Relay does not support today, Skip Go uses public or enshrined relayers — at whatever cost they’re typically made available to users. (These are free for IBC and have some fee associated with them for others). All costs users will incur will always be made transparent in the relevant endpoint responses.

How to Use Smart Relay

How to activate Smart Relay

  1. On /route or /msgs_direct, pass smart_relay=true
  2. If using /msgs, ensure that you are passing the smart_relay_fee_quote object provided in the cctp_transfer operation from the /route response into your /msgs request.
    • If you’re using the @skip-go/client library, version 0.8.0 and above supports this automatically. If you’re integrating the API directly and decoding the /route response operations before passing them back into msgs, simply ensure you’re decoding this new field properly and passing it back through!
  3. Sign the transaction as usual, and submit the signed transaction to the Skip Go API via /track or /submit as normal
    • NOTE: We HIGHLY recommend using /submit to submit Smart Relay transactions on chain to avoid issues incurred by submitting a transaction on chain but not sending it to the /track endpoint.
That’s it! Smart Relay will take care of executing your cross-chain actions across all bridges it currently supports.

How to determine what Smart Relay will cost the user

In the response to /route , /msgs_direct and /msgs, the cost of Smart Relay will appear in the estimated_fees array with fee_type set to SMART_RELAY. See Getting Fee Info for more info about estimated_fees For multi-tx routes, the user may pay up to 1 Smart Relay fee per transaction. The fee for each transaction pays for all Smart Relay operations in that particular transaction. This prevents Smart Relay from accepting payment prematurely to perform operations for the latter transactions, since the latter transactions may not get signed or executed. You can use the tx_index attribute on the estimated_fees entries to identify which Smart Relay fee corresponds to which transaction in the route. (e.g. tx_index=0 indicates this is the fee for the first transaction in the route)

What Determines the Cost of Smart Relaying

Smart Relay incurs a user cost because Smart Relay involves actually submitting transactions to various chains and incurring transaction fees as a result.
  • Operations: The cost of relaying a route depends on the operations in the route, since these affect the amount of gas Smart Relay consumes (e.g. routes that include swaps will require higher gas amounts & involve more expensive relaying)
  • The cost of gas: Most networks have dynamic fee markets, where the price of gas increases during periods of high network load. Smart Relay takes this into account when generating a quote
  • Token Exchange Rates: The token the user pays their fee in and the token Smart Relaying pays gas fees in may differ, so exchange rates affect the price the end user experiences. (e.g. If the user pays in OSMO for a route that terminates on Ethereum mainnet, Smart Relay will need to pay fees in ETH, so the amount of OSMO the user pays will depend on the OSMO/ETH spot price.)

How to properly use the Smart Relay Fee Quote

Skip Go dynamically calculates the Smart Relay fee to be paid based on the underlying costs in real-time. Although you should use the information in the estimated_fees array for display purposes, cctp_transfer includes a smart_relay_fee_quote, providing necessary information for proper use of the dynamic relaying fee system. Specifically, the smart_relay_fee_quote object contains information about the smart relay fee to be paid and when the quote expires (after which the quoted amount may no longer be valid and the transaction may not be succesfully relayed). If you’re using the /msgs endpoint, ensure that you are passing the smart_relay_fee_quote object provided in the cctp_transfer operation from the /route response into your /msgs request. This is necessary to ensure the transaction generated by the API matches the fee quoted in the /route request. If the quote is not passed back into the /msgs request, a new quote will be generated in the /msgs call that may be different than what was quoted previously in the /route request. Version 0.8.0 and above of the @skip-go/client library supports this automatically. If you’re integrating the API directly and decoding the /route response operations before passing them back into /msgs, simply ensure you’re decoding this new field properly and passing it back through! See the SmartRelayFeeQuote below:
export type SmartRelayFeeQuote = {
  feeAmount: string;
  feeDenom: string;
  feePaymentAddress: string;
  relayerAddress: string;
  expiration: Date;
}