Overview
The Across Protocol flow consists of seven key stages that enable fast, secure cross-chain token transfers. This guide walks through each stage with code examples and detailed explanations.1. Deposit
User Initiates Transfer
A user (depositor) initiates a cross-chain transfer by callingdeposit() on the origin chain’s SpokePool:
What Happens
Token Lock
Token Lock
The SpokePool transfers
inputAmount of inputToken from the depositor and locks it in the contract. If the input token is WETH, the user can optionally send native ETH.Deposit ID Assignment
Deposit ID Assignment
The contract increments
numberOfDeposits to generate a unique deposit ID. This ID combined with the origin chain ID uniquely identifies the deposit.Event Emission
Event Emission
A
FundsDeposited event is emitted containing all deposit parameters. Relayers monitor these events to find profitable deposits to fill.Validation Checks
Validation Checks
quoteTimestampmust be withindepositQuoteTimeBufferof current timefillDeadlinemust be withinfillDeadlineBufferof current timeinputAmountandoutputAmountmust be ≤MAX_TRANSFER_SIZE(1e36)- Deposits must not be paused
Fee Mechanism
The fee paid to relayers is captured in the spread betweeninputAmount and outputAmount:
- User deposits 1000 USDC on Arbitrum
- User requests 998 USDC on Base
- Relayer earns 2 USDC fee for fulfilling this deposit
- Destination chain gas costs
- Relayer’s opportunity cost of capital during the optimistic challenge window
- LP fee charged by the protocol
- Relayer’s desired profit margin
Speed Up Deposits
Depositors can reduce the output amount to incentivize faster fills:2. Fill
Relayer Fulfills Deposit
Off-chain relayers monitorFundsDeposited events and evaluate profitability. If profitable, they call fillRelay() on the destination chain:
What Happens
Validation
- Check fill deadline hasn’t passed
- Check exclusivity period (if any)
- Verify deposit hasn’t already been filled
Record Fill
Calculate relay hash from deposit parameters and mark as filled in
fillStatuses mapping.- Relayer fronts
outputAmounton destination chain - Relayer receives
inputAmountrefund on their chosen chain - Net profit =
inputAmount - outputAmount - gasCosts - lpFee
Exclusivity Period
Deposits can specify an exclusive relayer and exclusivity deadline:- Before exclusivityDeadline: Only the
exclusiveRelayercan fill - After exclusivityDeadline: Any relayer can fill
3. Bundle Proposal
Data Worker Aggregates Activity
Data workers are off-chain agents that:- Monitor all SpokePools for
FundsDepositedandFilledRelayevents - Validate that fills match deposits
- Calculate net token flows for pool rebalancing
- Construct three merkle trees
- Propose a root bundle on the HubPool
Three Merkle Trees
Each root bundle contains three merkle roots:Pool Rebalance Root
Instructions for sending tokens from HubPool to each SpokePool. Each leaf specifies chain, tokens, and amounts.
Relayer Refund Root
Merkle proofs for relayer refunds on each chain. Relayers can claim refunds by providing merkle proofs.
Slow Relay Root
Merkle proofs for slow fills. Used when no relayer filled a deposit before the deadline.
Bond Mechanism
Data workers must stake a bond when proposing:- ✅ Valid proposal: Bond returned after all leaves executed
- ❌ Invalid proposal: Bond slashed if disputed and UMA oracle confirms invalid
4. Challenge Period
Optimistic Verification Window
After a bundle is proposed, it enters a challenge period (default 2 hours, configurable):- ✅ Anyone can dispute the bundle by calling
disputeRootBundle() - ✅ Disputer must also stake a bond
- ✅ If disputed, UMA’s Optimistic Oracle resolves the dispute
- ❌ Bundle cannot be executed until challenge period ends
Dispute Process
UMA Oracle Resolution
If disputed, UMA’s Optimistic Oracle resolves:Invalid Bundle
- Proposer’s bond slashed and sent to disputer
- Disputer receives their bond back plus reward
- Proposer can submit a corrected bundle
5. Execution
Execute Root Bundle
After the challenge period passes without dispute, anyone can execute the pool rebalance leaves:What Happens
Pool Rebalancing
Tokens are sent from HubPool to SpokePools:6. Refund
Relayers Claim Refunds
After roots are relayed to SpokePools, relayers can claim refunds:Refund Calculation
Relayer refunds account for:- inputAmount: Original deposit amount
- lpFee: Fee paid to LPs for providing liquidity
- protocolFee: Fee captured by the protocol
7. Slow Fill
Fallback for Unfilled Deposits
If no relayer fills a deposit before thefillDeadline, the protocol can fulfill it using a slow fill:
Slow Fill Characteristics
No Relayer
No relayer is credited with a refund for slow fills. The protocol fulfills from SpokePool reserves.
No Fee
Slow fills use
outputAmount equal to inputAmount, meaning no fee is charged.Guaranteed Delivery
Users are guaranteed to receive their funds even if no relayer fills.
Slower
Slow fills only occur after the optimistic challenge window, typically 2+ hours.
Complete Flow Diagram
Related Documentation
Architecture
System architecture overview
Hub-and-Spoke
Hub-and-spoke model details
Roles
Participant roles and responsibilities