# 10Inch Exchange > Aggregation as a service As DeFi starts using arbitrage/frontrunning models to do several things, it can be rightly assumed that there will be parties solely created to “watch” the pending tx pool and extract value out of them. There can be so many things done just by watching the pool, the pending tx pool represents the future state changes. **Why not make watchig the Tx Pool a common and incentivsed function and extract a lot of value out of it.** Maybe we can reach a point where frontrunning bots can generate enough *assured revenue* that they dont need to do risky frontrunning. ## How it works 1. You create a transaction where you do a flash loan, open CDP, lend, swap tokens, sell a cow, buy a cat etc. 2. There are several avenues to swap tokens, how does the contract know the most optimal way to swap tokens. 3. The transaction you created which combines multiple money legos can be sent to the tx pool at 1/8th of the current lowest gas price, just enough so that it enters the txpool. 4. The order will contain normal payload(signed data) with a **defaultPath** that anyone can submit to the AAS smart contract and get the fees as msg.sender. 5. You offer a flat fees which works in a way that the more optimised the swap is the more part of fees the relayer/frontrunner gets. So the frontrunner is incentivised to find you the best swap by choosing the **most optimised path** 6. Frontrunner, Arb and several watcher bots see this "pending" transaction with signed data on it find the most optimal way across DEX's to swap the tokens in the most profitable way and try to bag as much as fees as possible. 7. With the **optimised route** they send the transaction on-chain thus doing everything you wanted in the most profitable way as possible while keeping balancing pools and selecting the best trade for you. 8. If your gas cost is not enough for a miner to pick it up you just did a normal token swap not a frontrunned token swap, so no loss. ## Why to do this 1. Composable, can do this from a smart contract with no cost for finding the optimal path. 2. Optimises for best swap and balancing pools as a sideeffect. 3. Generates reveue for watching the pool and creates value for ethereum real time data providers. 4. Cheaper swap costs wrt current on-chain swap mechanism 5. Meta by default, you can pay fee in any token and use ETH to just get into the tx pool. ## Cost to user 1. Gas lockup cost to get the transaction into the txpool (which could be returned when the pending transactions are pruned) 2. Small fee > In totatality should be just a tad bit more than 1Inch or other off-chain aggregators and will be at-least as good as current on-chain swapping systems (Not sure yet about this claim) ## Cost to frontrunner 1. Just keeping an updated path of all optimised trades for different markets ## Ideas This mechanism allows contracts to "outsource" work to frontrunners by putting up a bounty on it and ensures behaviour by designing incentives. Creating white hat frontrunners and creating new markets. Another interesting idea would be: - [A frontrunneed DEX](https://hackmd.io/bBxj5YfJR0KEdM21zWwmRw?view) ## Inspired from - [MEV](https://ethresear.ch/t/mev-auction-auctioning-transaction-ordering-rights-as-a-solution-to-miner-extractable-value/6788) - [Surrogeth](https://ethresear.ch/t/surrogeth-tricking-frontrunners-into-being-transaction-relayers/6937) - [FlashBoys](http://www.pdaian.com/flashboys2.pdf) ## Known Issues 1. Free Rider Problem: After a bot frontruns and adds the correct most optimal path, another person could frontrun him and take all the fees for which he did no work. But this problem is not new, exists in eth today. Looking forward to hearing some solutions.