How to Become a Cross-chain Filler?
category
Application
date
Oct 21, 2024
slug
how-to-become-a-cross-chain-filler
type
Post
lang
en
status
Published
Author: tomoki
Many thanks to Across team for reviews.
Titania Research has begun participating in the market as a Filler, and this post will explain what is necessary to become cross-chain filler on Across. In the previous article, we explained Uniswap X Filler.
You can operate a Relayer for Across using this repository.
What is a Cross-chain Intent?
A Cross-chain Intent allows users to express their desire to perform transactions like bridging or swapping assets, or executing arbitrary transactions between different blockchains. For example, you could submit an intent like, "Please bridge 1000 USDC from Ethereum to Arbitrum as quickly as possible."
Difference between Cross-chain bridge and Cross-chain swap
- Cross-chain bridge: The process of transferring a specific asset from one chain to another without changing the asset type (e.g., bridging ETH from Ethereum to Arbitrum)
- Cross-chain swap: Exchanging different assets across different chains (e.g., swapping Ethereum's ETH for Arbitrum's USDC)
Differences from Single chain:
- Filler holds assets across multiple chains: Particularly with Cross-chain bridging, Fillers must hold assets on multiple chains to execute users' intents
- Settlement is not atomic: Repayment to the Filler is not synchronous
- Speed competition: Many current Cross-chain bridges prioritize execution speed over price, leading to a first-come-first-served (FCFS) competition where faster Fillers win the trades
Three stages of Cross-chain Intent:
- Intent Initiation (Expression): Users express their desired transaction as an intent.
- Intent Execution: A Filler receives and executes the necessary bridge, swap, or transaction.
- Intent Settlement: The final settlement process completes the asset transfer or payment.
Across Transaction Lifecycle
Across is one of the representative intent-based bridges. Following the three stages of Cross-chain Intent mentioned earlier, the process is as follows:
- Intent Initiation
- User deposits assets into the Src chain's SpokePool (in the diagram above, it shows signing an order, but this is not currently supported)
- An event is triggered regarding the deposit to the SpokePool
- Intent Execution
- The Relayer monitors the deposit event from the SpokePool
- Retrieve events and send assets directly to the user through the Destination chain's SpokePool
- A Fill event is triggered in the SpokePool
- Intent Settlement
- Over 60 minutes, Data workers gather deposit events, match them with valid Fill events, and bundle them for submission to the HubPool on Ethereum for verification
- If there is no dispute during the 60 minutes, the Data workers execute the bundle on the HubPool
- The HubPool instructs the repayment to the SpokePool
- The Relayer receives repayment from the SpokePool
With Across’s Hub-Spoke model, which uses a base layer for settlement, Relayers can receive repayments on any chain, reducing the cost of rebalancing.
However, due to the optimistic model, the time until the Relayer receives repayment is longer, reducing capital efficiency.
Currently, Across adopts an auction-based FCFS system, where Fill speed competition takes place.
Solver Implementation
Anyone can participate in Across as its Relayer is permissionless. Let's implement a basic Relayer.
If you want to operate a Relayer with more complex configurations, you can use the official repository provided by Across.
Prerequisites
RPC endpoint
You need an RPC endpoint to monitor events from the Src chain’s SpokePool and send assets to the Destination chain’s SpokePool.
Any assets
You need to hold assets on any chain to fill intents. For larger volumes, it is recommended to hold WETH or USDC on Base or Arbitrum.
Step 1: Fetching Intent
To fetch intents, monitor the Deposit events from the Src chain’s SpokePool.
Filter the events based on the following conditions to get specific intents:
Src chain
: The chain receiving the event
Destination chain
: The chain where the intent will be filled
Token Address
: Corresponding token
Min and Max Amount
: The token amount for which the intent will be executed
Polling Interval
: How frequently to check for intents (ms)
Confirmation
: How many blocks to wait based on the token amount
You can configure these conditions as follows:
The received deposit events are defined in the following format:
destinationChainId
: The chain receiving the assets
depositId
: A unique ID storing deposit information
depositor
: The address that deposited the assets
inputToken
: The address of the deposited asset
outputToken
: The address of the asset the depositor will receive
inputAmount
: The amount of the deposited asset
outputAmount
: The amount of asset the depositor will receive
quoteTimestamp
: The time theoutputAmount
was quoted
fillDeadline
: The deadline by which the Fill must be executed
exclusiveRelayer
: The address of the Relayer that can exclusively fill the intent (if not specified, it is set to the zero address)
exclusivityDeadline
: The deadline by which the exclusive Relayer must execute the intent
recipient
: The address that will receive the final asset
message
: Any calldata to be executed after the asset is bridged
You can check the actual code here
Step 2: Fulfilling Intent
Fulfill the filtered intents. When executing, specify the chain ID of the destination chain to receive repayment on any chain.
If another Relayer has already executed the intent, a
RelayFilled
error will be returned.You can check executed intents using the following Dune query:
You can also check Across’s Relayer data on the following dashboard:
Future work
- Using faster RPC endpoints or full nodes: To win the speed competition, it is necessary to retrieve SpokePool events faster
- Calculating gas fees: Setting gas fees is an important factor in winning the intent competition while ensuring profitability