Suppose an exchange is made along a route that includes two or more networks. Such a route can take quite a long time, considering the transfer of assets through bridges. One bridge transfer can take up to 15-30 minutes, depending on the technology and the time of a block confirmation in each network. Thus, the manual control of this process can be quite tedious.
Relay nodes serve to provide complete automation of the exchange process, eliminating the need to be online throughout the entire exchange and confirm each step. Specifically, such steps as confirmation of transactions, gas payments, search for routes, and processing of intermediate assets are performed automatically without user interaction.
This solution will offer the possibility of automated liquidity management and execution of various tasks, such as the purchase and sale of goods and services, trading strategies, and NFT transfer in games and marketplaces.
Initiation of the automatic exchange requires only allowance to the exchanged token's balance at the beginning of the exchange and user-signed route data. After providing a signature to the relay network, it is safe to leave the app without waiting for the exchange to be fully complete.
Relay nodes schedule jobs to monitor the receipt of the exchanged asset on the balance and send signals to the network of nodes.
After the user signs the route and confirms the exchange, the rest of the work is taken over by Relay Nodes Network. The nodes launch smart contracts with the allowance to the balances of the tokens involved in the exchange.
As a result, the exchange takes place in a completely automatic mode.
At the same time, users no longer need to worry about gas since all gas fees are charged from the exchanged asset, making the process of calculating the rate and the final amount received more transparent.
The nodes act as executors of smart contracts and transaction relays, excluding direct interaction with liquidity and account balances. Funds are securely protected by validation mechanisms in Kinetex Advanced Router’s smart contract. Assets are sent only to the points indicated in a user-signed route (DEXes, bridges) and returned directly to the user's balance after an exchange.
Automation is currently supported on the following networks: Ethereum, BNB Chain, Polygon, Arbitrum, Optimism, Avalanche, Fantom, Gnosis Chain, Cronos, Moonriver and Moonbeam.
The standard scenario for making a one-click exchange is to use bridges that can make a callback to the target network simultaneously with the token transfer. Thus, using the capabilities of the cross-chain messaging protocol for transferring liquidity and data in one transaction, it is possible to pass further instructions for the exchange.
However, this approach has several disadvantages:
Exchange uses a limited set of bridges that support the ability to transfer data along with liquidity;
There are additional gas costs since the data transmitted to the target network is stored in on-chain storage;
The entire exchange route is initially available to third parties, simplifying and stimulating MEV attacks.
Automation through relayers has enabled us to eliminate all of the above problems. Relay nodes help interact with funds coming from any bridge to a user-owned minimal proxy smart contract.
Relayer's next task is to launch the subsequent steps of the exchange following the route signed by the user. The route is divided into as many parts as networks it combines to avoid disclosing the full route during exchange initialization. Then, each part is given to the corresponding network as the exchange continues (see Security section for more details).