Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
__pycache__
*.pyc
.idea
build/
dist/
flashbots.egg-info/
62 changes: 62 additions & 0 deletions PKG-INFO
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
Metadata-Version: 2.1
Name: flashbots
Version: 1.0.0
Summary: flashbots client
Author: Georgios Konstantopoulos
Author-email: me@gakonst.com
Requires-Python: >=3.9,<4.0
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.9
Requires-Dist: web3 (>=5.22.0,<6)
Description-Content-Type: text/markdown

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

```python
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:

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

Install [poetry](https://python-poetry.org/)

Poetry will automatically fix your venv and all packages needed

```sh
poetry install
```

Tips: PyCharm has a poetry plugin

## Linting

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

```sh
sudo pip install black # Black should be installed with a global entrypoint
black .
```
24 changes: 14 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
# web3-flashbots

This library works by injecting a new module in the Web3.py instance, which allows
This library works by injecting flashbots as 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
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

Expand All @@ -23,27 +25,29 @@ 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
## Development and testing

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

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

Install [poetry](https://python-poetry.org/)

Poetry will automatically fix your venv and all packages needed
```
Poetry will automatically fix your venv and all packages needed.

```sh
poetry install
```
Tips: PyCharm has a poetry plugin

Tips: PyCharm has a poetry plugin

## Linting

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

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

2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[tool.poetry]
authors = ["Georgios Konstantopoulos <me@gakonst.com>", "Nikolas Papaioannou <n0k0@hacky.software>"]
name = "flashbots"
version = "1.0.1"
version = "1.0.0"
description = ""
readme = "README.md"

Expand Down
31 changes: 31 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# -*- coding: utf-8 -*-
from setuptools import setup

packages = \
['flashbots']

package_data = \
{'': ['*']}

install_requires = \
['web3>=5.22.0,<6']

setup_kwargs = {
'name': 'flashbots',
'version': '1.0.0',
'description': 'web3-flashbots.py',
'long_description': '\nThis library works by injecting a new module in the Web3.py instance, which allows\nsubmitting "bundles" of transactions directly to miners. This is done by also creating\na middleware which captures calls to `eth_sendBundle` and `eth_callBundle`, and sends\nthem to an RPC endpoint which you have specified, which corresponds to `mev-geth`. \nTo apply correct headers we use FlashbotProvider which injects the correct header on post \n\n## Example\n\n```python\nfrom eth_account.signers.local import LocalAccount\nfrom web3 import Web3, HTTPProvider\nfrom flashbots import flashbot\nfrom eth_account.account import Account\nimport os\n\nETH_ACCOUNT_SIGNATURE: LocalAccount = Account.from_key(os.environ.get("ETH_SIGNATURE_KEY"))\n\n\nw3 = Web3(HTTPProvider("http://localhost:8545"))\nflashbot(w3, ETH_ACCOUNT_SIGNATURE)\n```\n\nNow the `w3.flashbots.sendBundle` method should be available to you. Look in `examples/simple.py` for usage examples\n\n# Development and testing\n\nSetup and run (mev-)geth with Websocket support:\n```\ngeth --http --http.api eth,net,web3,txpool --syncmode full\n```\n\nInstall [poetry](https://python-poetry.org/)\n\nPoetry will automatically fix your venv and all packages needed\n```\npoetry install\n```\nTips: PyCharm has a poetry plugin\n\n\n## Linting\nIt\'s advisable to run black with default rules for linting\n\n```\nsudo pip install black # Black should be installed with a global entrypoint\nblack .\n```\n\n',
'long_description_content_type': 'text/markdown',
'author': 'Georgios Konstantopoulos',
'author_email': 'me@gakonst.com',
'maintainer': None,
'maintainer_email': None,
'url': None,
'packages': packages,
'package_data': package_data,
'install_requires': install_requires,
'python_requires': '>=3.9,<4.0',
}


setup(**setup_kwargs)