flashbots / simple-arbitrage Goto Github PK
View Code? Open in Web Editor NEWExample arbitrage bot using Flashbots
Example arbitrage bot using Flashbots
Below is the error information:
requestMethod: 'POST',
serverError: Error: connect ETIMEDOUT 172.67.71.234:443
at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1144:16)
at TCPConnectWrap.callbackTrampoline (internal/async_hooks.js:126:14) {
errno: 'ETIMEDOUT',
code: 'ETIMEDOUT',
syscall: 'connect',
address: '172.67.71.234',
port: 443
},
url: 'https://relay.flashbots.net'
}
I pinged "172.67.71.234" and it is unreachable. I do a search: https://check-host.net/check-ping?host=relay.flashbots.net. I found that there are two IPs bond with 'https://relay.flashbots.net'. One is "172.67.71.234" which is unreachable for me and another is "104.26.11.65". Is there a way to set "104.26.11.65" as the entry for 'https://relay.flashbots.net'? Or is there anything wrong with my code?
Many thanks!
>>>>>>>>>>>>>>>>>$ ping 104.26.10.65
PING 104.26.10.65 (104.26.10.65): 56 data bytes
64 bytes from 104.26.10.65: icmp_seq=0 ttl=51 time=382.503 ms
64 bytes from 104.26.10.65: icmp_seq=1 ttl=51 time=238.248 ms
64 bytes from 104.26.10.65: icmp_seq=2 ttl=51 time=425.513 ms
64 bytes from 104.26.10.65: icmp_seq=3 ttl=51 time=258.062 ms
64 bytes from 104.26.10.65: icmp_seq=4 ttl=51 time=264.377 ms
64 bytes from 104.26.10.65: icmp_seq=5 ttl=51 time=278.940 ms
>>>>>>>>>>>>>>>>>$ ping 172.67.71.234
PING 172.67.71.234 (172.67.71.234): 56 data bytes
Request timeout for icmp_seq 0
Request timeout for icmp_seq 1
Request timeout for icmp_seq 2
Request timeout for icmp_seq 3
Request timeout for icmp_seq 4
Request timeout for icmp_seq 5
Request timeout for icmp_seq 6
Request timeout for icmp_seq 7
Hi can someone please clarify how funds can be or are withdrawn from BundleExecutor.Sol ?
do the profits of the trade stay within the contract and can they be withdrawn?
A Brownie problem potentially.
Mac OS X Big Sur v11.5.1
Node v16.4.2
Python v3.8
Sol v0.8.6
Brownie v1.15.2
I am compiling using Brownie. However the only files that end up 'compiled' and in /build/contracts are:
Compiling contracts...
Solc version: 0.6.12
Optimizer: Enabled Runs: 200
EVM Version: Istanbul
Generating build data...
**- FlashBotsMultiCall
- IERC20
- IWETH
- FlashBotsUniswapQuery
- IUniswapV2Pair
- UniswapV2Factory**
Thereafter, when I try to deploy from Brownie, BundleExecutor.sol isn't found. This could be PATH related. However, why is Brownie compiling the reference contracts from inside BundleExecutor.sol ?
I'm using this code as a learning module; however, I receive the following error when running the code.
Error: could not detect network (event="noNetwork", code=NETWORK_ERROR, version=providers/5.6.8)
I believe it comes from the following line 10 index.ts
const ETHEREUM_RPC_URL = process.env.ETHEREUM_RPC_URL || "http://127.0.0.1:8545"
Looking around online, I think it could be two things. (1) This is a local host (Like ganache or something), so I wont be able to run this code. Or (2) I am missing a dependency.
ANY help would be great, I have already learned a lot!!!
Kindest,
Carl M.
that use flashbot ?
Could somebody please point to any successful execution of this simple-arbitrage
project against Ethereum Mainnet?
As I test, I would like to fork Mainnet at that block and try this project locally.
i'm trying a local light client.
(node:2216808) UnhandledPromiseRejectionWarning: Error: missing provider (operation="estimateGas", code=UNSUPPORTED_OPERATION, version=abstract-signer/5.3.0)
should i be using infura for ETHEREUM_RPC_URL?
Hello
How should I run the part below?
$ PRIVATE_KEY=PRIVATE_KEY_FROM_ABOVE
BUNDLE_EXECUTOR_ADDRESS=DEPLOYED_ADDRESS_FROM_ABOVE
FLASHBOTS_RELAY_SIGNING_KEY=RANDOM_ETHEREUM_PRIVATE_KEY
npm run start
The link to Flashbots Searcher FAQ
in README.md seems to be orphaned: https://hackmd.io/@flashbots/rk-qzgzCD
First off, thanks for open-sourcing this. Thought I give it a try and created the contracts. However, no transactions are ever started by the contract.
I see this log, which looks like it is submitted via the relay.
Submitting bundle, profit sent to miner: 0.0003, effective gas price: 2.1664 GWEI
I have these environment variables set.
FLASHBOTS_RELAY_SIGNING_KEY=0x....
PRIVATE_KEY=0x.....
BUNDLE_EXECUTOR_ADDRESS=0xfC54bf73483d28619E43479551140939380B0e1b
ETHEREUM_RPC_URL=https://mainnet.infura.io/v3/mykey
MINER_REWARD_PERCENTAGE=20
I just found the discord, but there's a lot going on there. Figure I'd start here. Any direction or guidance is appreciated! 🙏
I embedded environmental variables in .env and ran npm run start. Here's the error I encountered "Unable to compile TypeScript". Is there any defects in the current code?? Thanks.
$ npm run start
> @flashbots/[email protected] start /home/ether/work/javascript/simple-arbitrage
> npx ts-node --project tsconfig.json src/index.ts
? Unable to compile TypeScript:
src/index.ts:56:49 - error TS2339: Property 'getUniswapMarketsByToken' does not exist on type 'typeof UniswappyV2EthPair'.
56 const markets: any = await UniswappyV2EthPair.getUniswapMarketsByToken(provider, FACTORY_ADDRESSES);
~~~~~~~~~~~~~~~~~~~~~~~~
src/index.ts:58:30 - error TS2339: Property 'updateReserves' does not exist on type 'typeof UniswappyV2EthPair'.
58 await UniswappyV2EthPair.updateReserves(provider, markets.allMarketPairs);
~~~~~~~~~~~~~~
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! @flashbots/[email protected] start: `npx ts-node --project tsconfig.json src/index.ts`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the @flashbots/[email protected] start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /home/.npm/_logs/2021-08-09T05_29_01_383Z-debug.log
Hi Everyone, thanks for sparing your precious time to help me.
Actually the length of my targets and payloads is not matching. I tried since more than a week but could’nt solve it. Can someone please help me come out of this issue. I would be very very happy if someone help me please. Thanking you
…
async takeCrossedMarkets(
bestCrossedMarkets: CrossedMarketDetails,
blockNumber: number,
minerRewardPercentage: number
): Promise {
for (const bestCrossedMarket of bestCrossedMarkets) {
const buyCalls =
await bestCrossedMarket.buyFromMarket.sellTokensToNextMarket(
WETH_ADDRESS,
bestCrossedMarket.volume,
bestCrossedMarket.sellToMarket
);
const inter = bestCrossedMarket.buyFromMarket.getTokensOut(
WETH_ADDRESS,
bestCrossedMarket.tokenAddress,
bestCrossedMarket.volume
);
const sellCallData = await bestCrossedMarket.sellToMarket.sellTokens(
bestCrossedMarket.tokenAddress,
inter,
this.bundleExecutorContract.address
);
const targets: Array = [
...buyCalls.targets,
bestCrossedMarket.sellToMarket.marketAddress,
];
const payloads: Array = [...buyCalls.data, sellCallData];
…
I don’t know whether the problem is in this part of code or somewhere else. I’ve also deployed a contract on the Ethereum Mainnet.
Please someone guide me please.
I'm getting the following error when I'm running npm run start
/Users/glaksmono/Documents/simple-arbitrage/node_modules/@ethersproject/logger/src.ts/index.ts:205
const error: any = new Error(message);
^
Error: call revert exception (method="getPairsByIndexRange(address,uint256,uint256)", errorSignature=null, errorArgs=[null], reason=null, code=CALL_EXCEPTION, version=abi/5.0.9)
at Logger.makeError (/Users/glaksmono/Documents/simple-arbitrage/node_modules/@ethersproject/logger/src.ts/index.ts:205:28)
at Logger.throwError (/Users/glaksmono/Documents/simple-arbitrage/node_modules/@ethersproject/logger/src.ts/index.ts:217:20)
at Interface.decodeFunctionResult (/Users/glaksmono/Documents/simple-arbitrage/node_modules/@ethersproject/abi/src.ts/interface.ts:326:23)
at Object.<anonymous> (/Users/glaksmono/Documents/simple-arbitrage/node_modules/@ethersproject/contracts/src.ts/index.ts:309:44)
at step (/Users/glaksmono/Documents/simple-arbitrage/node_modules/@ethersproject/contracts/lib/index.js:46:23)
at Object.next (/Users/glaksmono/Documents/simple-arbitrage/node_modules/@ethersproject/contracts/lib/index.js:27:53)
at fulfilled (/Users/glaksmono/Documents/simple-arbitrage/node_modules/@ethersproject/contracts/lib/index.js:18:58)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
Any ideas what do I need to do?
It would also be great if someone can improve the README so that there's step by step instructions on what to do to get this code up and running
I understand that this is simple example code and probably not making any profit, my question is what should be improved to make little profit at least with this bot? i am a dev but im not good at blockchain technology, but i can do my research and make improvements just need suggestions. thanks.
Hi,
Is it possible to test smart contract on remix?
function getPairsByIndexRange
is not working when i take a test using Ropsten Test network.
Any guide appreciatively, thanks
No longer a problem
Is this the relayer I need https://github.com/flashbots/mev-relay-js? How do I specify a different relayer in https://github.com/flashbots/ethers-provider-flashbots-bundle?
When the code reaches getPairsByIndexRange, I am getting the following error:
Error: Transaction reverted: function call to a non-contract account
I tried copying the same UniswapQuery code from Etherscan and pasting into my VSCode and running it as a separate contract and test with Hardhat but still getting the same error. But when I enter the 3 parameters in the Read Contract section on Etherscan I successfully get all the pairs.
Does this code from the repo only work on Mainnet or Mainnet-fork? Or should it still work on localhost (for example npx hardhat node)?
With the environment variable what does the Readme note below mean:
ETHEREUM_RPC_URL - Ethereum RPC endpoint. Can not be the same as FLASHBOTS_RPC_URL
I am using localhost:8545 as the ETHEREUM_RPC_URL (through npx hardhat node). But what is FLASHBOTS_RPC_URL? There is no such environment variable inside the code.
Hi,
I set all with correct info, when I do NPM RUN START I get this error.
I tried on BSC network, I don't have this error?
Any idea ?
Can't find such a file in flashbots/pm
.
Hey there,
might be a dump question. But can anybody explain why we need to use our own deployed Smart Contracts and don't just connect a wallet with Web3.js or Ethers and call Uniswap etc directly?
Cheers
Hi !
What do you mean by 'raw 32-byte format' ?
The private key from metamask has a length of 64 char, how can i convert it to 32bytes ?
I'm missing something here
Thanks a lot !
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.