Skip to content

Files

Latest commit

0e39175 · Jul 1, 2024

History

History
99 lines (61 loc) · 7.41 KB

smart-relay.mdx

File metadata and controls

99 lines (61 loc) · 7.41 KB
title description
Smart Relay
This page covers Smart Relay -- Skip API's universal cross-chain data & token delivery service

This document introduces Skip API’s Smart Relay functionality — the fastest & most reliable way to get your users where they’re going over any bridge Skip API supports. Smart Relay is an alternative to public bridge relayers, which we've designed to enable users to access more swap and transfer routes in fewer transactions more quickly & reliably.

**We strongly advise all integrators who want to offer top-notch user experiences to activate Smart Relay.**

If you do not use Smart Relay, you will suffer worse performance in a variety of ways:

  • 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 aintent-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 API's routing capabilities.:

  • Intent-aware: Traditional relayers are unaware of what the user is trying to accomplish beyond performing 1 single 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 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 "channel" or "bridge" centric. They just try to move all of the packets for a single route of a bridge from one chain to another, then they view their job as done. Smart Relayer is built around users, not bridges. This means that it instead of moving all of the packets in 1 bridge until that bridge is cleared, it moves all of the packets for 1 user across multiple bridges/hops -- until that user reaches their destination.
    • It also offers a deeply simplified payment experience for users thats 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 after.
  • Universal: Traditional relayers support 1 or 2 chains or ecosystems at a time for a single bridge. Cross-ecosystem transfers are fraught as a result. 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 coming shortly.

The cost of Smart Relay is determined dynamically based on several factors covered below gas prices on every chain and bridge fees involved in the route.

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 API 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. Sign the transaction as usual, and submit the signed transaction to Skip API via /track or /submit as normal
    1. NOTE: We HIGHLY recommend using /submit to submit Smart Relay transactions on chain to avoid any errors with submitting a transaction on chain but not sending 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 Fees 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 might not get signed / 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 fee costs 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 times 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.)
**Want to help us get better? Have questions or feedback?**

You can reach us easily by joining our Discord and grabbing the "Skip API Developer" role.