The Relay solver is a production-grade relayer currently supporting Relay. The solver acts as a trusted party that performs cross-chain relays and order validation.
When a user wishes to bridge, they submit an order and a transfer to the Relay solver, who validates the order and sends the funds to the user on the destination chain. Relay maintains a balance on all chains in order to make executions, and then periodically rebalances to ensure there is sufficient liquidity on all chains. In the rare case of a transaction failure, Relay refunds the user directly as soon as possible.While this model requires trust in Relay as a service provider, it reduces the costs of executing cross-chain actions to an absolute minimum. Since each cross-chain action is simply an origin chain transfer and a destination chain transfer (42000 gas total), it is substantively cheaper than bridging on other bridges.
The current state of Relay, which requires trust in Relay’s solver, is an important part of the protocol development process. It is not intended as a final state of the system, but as a way to introduce the core concepts, and learn from users, developers, and relayers about what is most important in the future decentralized system. If you are interested in learning more about where Relay is headed, you can read the protocol overview here.
When a user wishes to Relay, the application receives an order (quote) from the Relay SDK/API. The quote returns both a cost for execution, and an expected time. The quote is a total value required by the user for the action to proceed. The quote encompasses the execution value, the estimated destination chain gas fee, and the relayer fee. This quote covers the gas cost on the destination chain. The transfer call data for order acceptance is also included in the returned data.
When the user accepts the order, they submit a transfer to the solver. An order ID associated with the quote is appended in the tx calldata. This order ID will be used on the destination chain to link fills across chains.
Upon validation of the inbound transfer transaction, the Relay solver will fill the order on the destination chain. Included in the fill transaction is the order ID associated with the quote. Relay maps the origin and destination chain transactions together by order ID to ensure the transaction is filled appropriately.
The Relay solver uses a robust rebalancing algorithm to make sure funds are as available as possible for cross-chain executions. The user is not responsible for any rebalancing activity. If the Relay solver becomes “off-balance”, the capacity for instant relaying may be limited.
If for some reason the quoted execution is no longer available by the time of relay submission, the user may be refunded. Refunds are as instant as possible and are refunded on the destination chain by default, and the origin chain otherwise. The refundOnOrigin param can be passed into the bridge/call apis and sdk actions to override the refund logic.
If the user submits the transfer event after quote expiration, the relayer may not be able to fill the order at the quoted price if gas prices on the destination chain have increased substantially. In this case, the relayer will attempt to fill the order at the best possible price, and give the rest of the bridged value to the user.
Due to the trusted nature of the current Relay design, disputes (i.e. cases where a user did not receive the expected outcome and was not refunded) should be brought directly to the Relay support team.