Skip to main content

No project description provided

Project description

This library works by injecting a new module in the Web3.py 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 FlashbotProvider which injects the correct header on post

Example

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_SIGNATURE_KEY"))


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

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

Development and testing

Setup and run (mev-)geth with Websocket support:

geth --http --http.api eth,net,web3,txpool --syncmode full

Install poetry

Poetry will automatically fix your venv and all packages needed

poetry install

Tips: PyCharm has a poetry plugin

Linting

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

flashbots-0.4.2.tar.gz (5.4 kB view details)

Uploaded Source

Built Distribution

flashbots-0.4.2-py3-none-any.whl (6.4 kB view details)

Uploaded Python 3

File details

Details for the file flashbots-0.4.2.tar.gz.

File metadata

  • Download URL: flashbots-0.4.2.tar.gz
  • Upload date:
  • Size: 5.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.6 CPython/3.9.5 Linux/5.4.0-70-generic

File hashes

Hashes for flashbots-0.4.2.tar.gz
Algorithm Hash digest
SHA256 10c3aa092070b81e5d41c035601e01911fe202a53eb88a7e011b3e5353e3c28d
MD5 1baebb6704296ca066650e670c86c0c1
BLAKE2b-256 e2f0aa63a2096e366dc9f1a3bbdfd145c42400e5a98adce5226319f1c3263fda

See more details on using hashes here.

File details

Details for the file flashbots-0.4.2-py3-none-any.whl.

File metadata

  • Download URL: flashbots-0.4.2-py3-none-any.whl
  • Upload date:
  • Size: 6.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.6 CPython/3.9.5 Linux/5.4.0-70-generic

File hashes

Hashes for flashbots-0.4.2-py3-none-any.whl
Algorithm Hash digest
SHA256 81afccaafd1ca465fa6d670ac1d5afaefd9f929aa52f0b5cb4bfaf177a6359c5
MD5 efafb1a5df1badc24a5c141445737155
BLAKE2b-256 e257348acd9806738c594c1f7bebd1c6200cb5a2791494af0394446ea452bfbb

See more details on using hashes here.

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