You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Nov 17, 2025. It is now read-only.
### **1. Identifying and Executing Arbitrage Opportunities with the Fastlane Bot**
4
+
-**Question:** How does the Fastlane Bot identify and execute arbitrage opportunities?
5
+
-**Answer:** The bot searches for arbitrage opportunities between DEXes. When it finds an opportunity, the bot submits a transaction to the Fast Lane contract, which takes a flashloan and subsequently executes trades that close the arbitrage opportunity.
6
+
7
+
### **2. Using a Private Node or Infura with the Fastlane Bot**
8
+
-**Question:** Can a private node or Infura be used with the Fastlane Bot?
9
+
-**Answer:** Yes. The bot can use any RPC. This can be edited in the fastlane_bot/config/providers file - search for: self.RPC_URL. Note that some functions require an Alchemy API key, making it necessary unless the functions themselves are modified. These functions are in fastlane_bot/helpers/txhelpers, and include get_access_list, submit_private_transaction, and get_max_priority_fee_per_gas_alchemy.
10
+
11
+
### **3. Arbitraging Specific Tokens using the Fastlane Bot**
12
+
-**Question:** How can I search for arbitrage for specific tokens using the Fastlane Bot?
13
+
-**Answer:** The bot includes two Click Options - flashloan_tokens & target_tokens - that enable searching only pools that include specific tokens.
14
+
15
+
### **4. Tax Token Handling in the Fastlane Bot**
16
+
-**Question:** Can the bot trade tax tokens?
17
+
-**Answer:** No. The bot currently does not support tax tokens.
18
+
19
+
### **5. Fastlane Bot as a Web Application**
20
+
-**Question:** Can the Fastlane Bot operate as a web application?
21
+
-**Answer:** The Fastlane Bot is not designed as a web app. It functions as a backend framework for identifying and executing arbitrage trades using the Fast Lane smart contract on the blockchain.
22
+
23
+
### **6. Addressing 'Gas Required Exceeds Allowance' Error in the Fastlane Bot**
24
+
-**Question:** What steps should be taken if the bot displays a 'gas required exceeds allowance' error during transaction building?
25
+
-**Answer:** This error can have several causes, the most common of which is simply that the transaction is expected to revert. Another cause of this can be not having enough ETH on the address used by the bot to execute transactions.
26
+
27
+
### **7. Addressing 'Reverted SafeMath: subtraction overflow' Error in the Fastlane Bot**
28
+
-**Question:** I see the error: "Reverted SafeMath: subtraction overflow" when my bot tries to build a transaction, what's wrong?
29
+
-**Answer:** This typically happens due to the a tax token being included in the arbitrage route. Tax tokens are not supported by the bot and transactions that include them will typically fail.
Typically only one bot-operator is able to close each arbitrage opportunity, making bot operation competitive in nature. The purpose of this document is to provide ideas on ways to improve your own bot.
6
+
7
+
### Gas Priority Fee Optimization
8
+
In config/network.py there is a constant: DEFAULT_GAS_PRICE_OFFSET. This is a multiplier that increases the priority fee paid by your TX. The higher it is, the more likely your TX will get executed, but the more the TX costs. It’s set to increase by 9% by default, which is likely insufficient to be competitive. You could also design a custom function to modify the priority fee based on profit - this could likely make you competitive, but would require some work.
9
+
10
+
### Data Throughput
11
+
Faster data means faster cycles for the arbitrage bot. The easiest way to achieve this is by using a premium plan from a data provider such as Alchemy.
12
+
13
+
Another way to achieve this is by running an Ethereum node locally. The bot can be connected to a local Ethereum node fairly easily by changing the RPC_URL in the fastlane_bot/config/providers file. Note that some functions require an Alchemy API key, making Alchemy necessary unless the functions themselves are modified.
14
+
15
+
These functions are in fastlane_bot/helpers/txhelpers, and include:
16
+
***get_access_list:** this function is optional - using it saves around 5000 gas on average per transaction.
17
+
***submit_private_transaction:** this function is not optional, however it's possible to submit transactions directly to Flashbots. See the Flashbots Documentation for more details: https://docs.flashbots.net/flashbots-auction/advanced/rpc-endpoint
18
+
***get_max_priority_fee_per_gas_alchemy:** this function is not optional, but could be replaced with custom priority fee logic.
19
+
20
+
### New Arbitrage Modes
21
+
Currently the bot is geared towards closing pariwise & triangular arbitrage on Bancor V3 & Carbon, but it can easily be generalized for all the exchanges it supports. To do this, you would need to create a new Arb Mode file, and design the combinations that are fed into the Optimizer. A lot of the heavy lifting here is already handled, but there may be a few specific changes you would need to make to get it to work.
Copy file name to clipboardExpand all lines: README.md
+66-6Lines changed: 66 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,10 +6,26 @@ The Fastlane Bot requires an Ethereum private key. **Your funds are AT RISK when
6
6
7
7
## Overview
8
8
9
-
The Fastlane Arbitrage Bot identifies and executes arbitrage opportunities between Carbon, Bancor, and the broader market, enhancing market efficiency by aligning Carbon and Bancor with market trends.
9
+
Arbitrage opportunities occur when token prices between DEXes are imbalanced, and can be closed by making specific trades on the imbalanced DEXes.
10
+
11
+
The Fastlane is an open-source system that anyone can run, consisting of the Fastlane smart contract, and the Fastlane Arbitrage Bot.
12
+
13
+
The Fastlane Arbitrage Bot identifies arbitrage opportunities and closes them by executing trades using the Fastlane Smart Contract. The bot can search for opportunities between Carbon and Carbon forks, Bancor, and other DEXes. This enhances market efficiency by aligning Carbon, Carbon forks, and Bancor with market trends.
14
+
15
+
The system works by executing atomic transactions that take flashloans to fulfill the capital requirements of trades, meaning only gas costs are required to submit transactions.
10
16
11
17
Permanent URL for this repository: [github.com/bancorprotocol/fastlane-bot][repo]
12
18
19
+
For frequently asked questions, see [FAQ](FAQ.md).
20
+
21
+
### Profit Split
22
+
Any profit from an arbitrage trade is split between the contract caller & the Protocol.
23
+
24
+
### Competition
25
+
26
+
The Fastlane Arbitrage Bot is competitive in nature. Bot operators compete to close arbitrage opportunities. There are many ways to improve a bot's competitiveness; the following document contains a short list of ideas on how to make a bot more competitive: [How to make your bot competitive](How_to_make_your_bot_competitive.md).
You can configure the Fastlane Arbitrage Bot using the options in the `@click.option` section of `main.py`. An overview of options is provided below:
111
127
112
128
-**cache_latest_only** (bool): Whether to cache only the latest events.
129
+
-**backdate_pools** (bool): If True, the bot will collect pool data from pools that were not traded on within the number of blocks specified in alchemy_max_block_fetch. This is useful to search pools that are traded infrequently.
130
+
-**static_pool_data_filename** (str): The name of the static pool data file. **Recommended not to modify.**
113
131
-**arb_mode** (str): Specifies the arbitrage mode.
114
132
-**Types of arbitrage**:
115
133
-**Pairwise**: This includes arbitrage trades between two liquidity pools that contain the same tokens. For example: USDC > LINK, LINK > USDC
@@ -120,17 +138,37 @@ You can configure the Fastlane Arbitrage Bot using the options in the `@click.op
120
138
-**multi** Pairwise arbitrage between **multiple** Carbon curves and one other exchange curve.
121
139
-**triangle**: Triangular arbitrage between one Carbon curve and two other exchange curves.
122
140
-**multi_triangle**: Triangular arbitrage between **multiple** Carbon curves and two other exchange curves.
123
-
-**bancor_v3**: Triangular arbitrage between two Bancor v3 pools and one other exchange curve.
124
141
-**b3_two_hop**: Triangular arbitrage - the same as bancor_v3 mode but more gas-efficient.
125
142
-**multi_pairwise_pol**: Pairwise multi-mode that always routes through the Bancor protocol-owned liquidity contract.
126
143
-**multi_pairwise_bal**: Pairwise multi-mode that always routes through Balancer.
127
144
-**multi_pairwise_all**: **(Default)** Pairwise multi-mode that searches all available exchanges for pairwise arbitrage.
128
-
-**flashloan_tokens** (str): Tokens the bot can use for flash loans. Specify tokens as a comma-separated string in TKN-ADDR format (e.g., BNT-FF1C, WETH-6Cc2).
129
-
-**exchanges** (str): Comma-separated string of exchanges to include.
130
-
-**polling_interval** (int): Bot's polling interval for new events.
145
+
-**flashloan_tokens** (str): Tokens the bot can use for flash loans. Specify token addresses as a comma-separated string (e.g., 0x1F573D6Fb3F13d689FF844B4cE37794d79a7FF1C, 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2).
146
+
-**n_jobs** (int): The number of parallel jobs to run. The default, -1, will use all available cores for the process.
147
+
-**exchanges** (str): Comma-separated string of exchanges to include. To include all known forks for Uniswap V2/3, use "uniswap_v2_forks" & "uniswap_v3_forks".
148
+
-**polling_interval** (int): Bot's polling interval for new events in seconds.
131
149
-**alchemy_max_block_fetch** (int): Maximum number of blocks to fetch in a single request.
132
150
-**reorg_delay** (int): Number of blocks to wait to avoid reorgs.
151
+
-**logging_path** (str): The path for log files. **Recommended not to modify.**
133
152
-**loglevel** (str): Logging level, which can be DEBUG, INFO, WARNING, or ERROR.
153
+
-**use_cached_events** (bool): **Testing option.** This option runs the bot using historical cached events.
154
+
-**run_data_validator** (bool): This option validates that pool data hasn't changed from the time an opportunity was found. This can be useful if the bot has slow cycles, for example if an arb mode takes a long time to run.
155
+
-**randomizer** (int): The bot will randomly select an opportunity from the number of opportunities specified in this configuration after sorting by profit. For example the default setting 3 means the bot will randomly pick one of the 3 most profitable opportunities it found in the randomizer.
156
+
-**limit_bancor3_flashloan_tokens** (bool): If True, this limits the flashloan tokens to tokens supported by Bancor V3.
157
+
-**default_min_profit_gas_token** (float): The minimum amount of expected profit, denominated in the gas token, to consider executing an arbitrage trade.
158
+
-**timeout** (int): **Testing option.** This will stop the bot after the specified amount of time has passed.
159
+
-**target_tokens** (str): This option filters pools to only include the tokens specified in this comma-separated list of token addresses. This can be used to significantly limit the scope of the bot.
160
+
-**replay_from_block** (int): **Testing option.** The bot will search the specified historical block & attempt to submit a transaction on Tenderly. This requires a Tenderly account to use.
161
+
-**tenderly_fork_id** (str): **Testing option.** Specified exchanges will be searched on Tenderly.
162
+
-**tenderly_event_exchanges** (str): **Testing option.** Exchanges for which to get events on Tenderly.
163
+
-**increment_time** (int): **Testing option.** This option increments the specified amount of time on Tenderly if a value for tenderly_fork_id is provided.
164
+
-**increment_blocks** (int): **Testing option.** This option increments the specified number of blocks on Tenderly if a value for tenderly_fork_id is provided.
165
+
-**blockchain** (str): The blockchain on which to search for arbitrage. Currently only Ethereum & Base are supported.
166
+
-**pool_data_update_frequency** (int): The frequency in bot cycles in which the bot will search for new pools. **Recommended not to modify.**
167
+
-**use_specific_exchange_for_target_tokens** (str): This filter will limit pool data to include only tokens contained by the specified exchange. For example "carbon_v1" would limit the scope of pool data to only include pools that have tokens currently traded on Carbon.
168
+
-**prefix_path** (str): An optional file path modification, intended for cloud deployment requirements. **Recommended not to modify.**
169
+
-**version_check_frequency** (int): The frequency (in bot cycles) the bot will check the version of the Fastlane smart contract. Set to -1 to disable.
170
+
-**self_fund** (bool): **USE AT YOUR OWN RISK** If set to True, the bot will use funds in the user's wallet to execute trades. Note that upon start, the bot will attempt to set an approval for all tokens specified in the flashloan_tokens field.
171
+
134
172
135
173
Specify options in the command line. For example:
136
174
@@ -153,4 +191,26 @@ We follow [semantic versioning][semver] (`major.minor.patch`), updating the majo
153
191
[semver]:https://semver.org/
154
192
155
193
-**v2.0** - Complete rewrite to include Carbon along with Bancor.
156
-
-**v1.0** - Initial bot version for Bancor protocol pools only.
194
+
-**v1.0** - Initial bot version for Bancor protocol pools only.
195
+
196
+
### Example Start Configurations
197
+
The following examples are command-line inputs that start the bot with different configurations:
0 commit comments