Flashbots — Bundle and Simulate
In the previous lesson we covered the basics of Flashbots and installed some Python modules that allow us to communicate with the Flashbots relay.
In this lesson, we will do the following:
Get some Ether for the Goerli testnet
Connect to the Flashbots Goerli test relay
Build two transactions
Bundle the two transactions together
Simulate the bundle via the Flashbots relay
Submit the bundle for mining
To interact with the Goerli testnet, you’ll need a node or a Goerli RPC. I recommend using the public RPC from Ankr, accessible from
https://rpc.ankr.com/eth_goerli without the need to create an account.
To run tests on Goerli, you need Goerli Ether. Happily for us, testnet Ether is free. You can request 0.25 ETH using the Goerli Faucet.
We will use Brownie to manage our private keys, but otherwise this is a web3.py-centric lesson.
I recommend generating a dedicated account for playing on testnets. In Brownie, you can generate a new account with the command
brownie accounts generate test_1 or similar. This will give you a mnemonic seed phrase and an external address, which you will use at the Goerli Faucet.
In this example I am using two generated accounts,
test_2, along with my dedicated
flashbots_id account which is used exclusively for signing and reputation.
Prepare the Environment
This will feel quite familiar if you worked through the Snowsight posts.
Start a Python console and load the required modules: