Skip to main content

No project description provided

Project description


This library works by injecting flashbots as a new module in the instance, which allows submitting "bundles" of transactions directly to miners. This is done by also creating a middleware which captures calls to eth_sendBundle and eth_callBundle, and sends them to an RPC endpoint which you have specified, which corresponds to mev-geth.

To apply correct headers we use the flashbot method which injects the correct header on POST.


from eth_account.signers.local import LocalAccount
from web3 import Web3, HTTPProvider
from flashbots import flashbot
from eth_account.account import Account
import os

ETH_ACCOUNT_SIGNATURE: LocalAccount = Account.from_key(os.environ.get("ETH_SIGNER_KEY"))

w3 = Web3(HTTPProvider("http://localhost:8545"))

Now the w3.flashbots.sendBundle method should be available to you. Look in examples/ for usage examples.


To use goerli, add the goerli relay RPC to the flashbot function arguments.

flashbot(w3, ETH_ACCOUNT_SIGNATURE, "")

Development and testing

Install poetry

Poetry will automatically fix your venv and all packages needed.

poetry install

Tips: PyCharm has a poetry plugin

Simple Goerli Example

See examples/ for environment variable definitions.

poetry shell
ETH_SENDER_KEY=<sender_private_key> \
PROVIDER_URL=<alchemy_key> \
ETH_SIGNER_KEY=<signer_private_key> \
python examples/


It's advisable to run black with default rules for linting

sudo pip install black # Black should be installed with a global entrypoint
black .

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

open_aea_flashbots-1.4.0.tar.gz (8.8 kB view hashes)

Uploaded Source

Built Distribution

open_aea_flashbots-1.4.0-py3-none-any.whl (9.9 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page