|
| 1 | +Metadata-Version: 2.1 |
| 2 | +Name: flashbots |
| 3 | +Version: 1.0.0 |
| 4 | +Summary: flashbots client |
| 5 | +Author: Georgios Konstantopoulos |
| 6 | +Author-email: me@gakonst.com |
| 7 | +Requires-Python: >=3.9,<4.0 |
| 8 | +Classifier: Programming Language :: Python :: 3 |
| 9 | +Classifier: Programming Language :: Python :: 3.9 |
| 10 | +Requires-Dist: web3 (>=5.22.0,<6) |
| 11 | +Description-Content-Type: text/markdown |
| 12 | + |
| 13 | +This library works by injecting a new module in the Web3.py instance, which allows |
| 14 | +submitting "bundles" of transactions directly to miners. This is done by also creating |
| 15 | +a middleware which captures calls to `eth_sendBundle` and `eth_callBundle`, and sends |
| 16 | +them to an RPC endpoint which you have specified, which corresponds to `mev-geth`. |
| 17 | +To apply correct headers we use FlashbotProvider which injects the correct header on post. |
| 18 | + |
| 19 | +## Example |
| 20 | + |
| 21 | +```python |
| 22 | +from eth_account.signers.local import LocalAccount |
| 23 | +from web3 import Web3, HTTPProvider |
| 24 | +from flashbots import flashbot |
| 25 | +from eth_account.account import Account |
| 26 | +import os |
| 27 | + |
| 28 | +ETH_ACCOUNT_SIGNATURE: LocalAccount = Account.from_key(os.environ.get("ETH_SIGNATURE_KEY")) |
| 29 | + |
| 30 | + |
| 31 | +w3 = Web3(HTTPProvider("http://localhost:8545")) |
| 32 | +flashbot(w3, ETH_ACCOUNT_SIGNATURE) |
| 33 | +``` |
| 34 | + |
| 35 | +Now the `w3.flashbots.sendBundle` method should be available to you. Look in `examples/simple.py` for usage examples |
| 36 | + |
| 37 | +# Development and testing |
| 38 | + |
| 39 | +Setup and run (mev-)geth with Websocket support: |
| 40 | + |
| 41 | +```sh |
| 42 | +geth --http --http.api eth,net,web3,txpool --syncmode full |
| 43 | +``` |
| 44 | + |
| 45 | +Install [poetry](https://python-poetry.org/) |
| 46 | + |
| 47 | +Poetry will automatically fix your venv and all packages needed |
| 48 | + |
| 49 | +```sh |
| 50 | +poetry install |
| 51 | +``` |
| 52 | + |
| 53 | +Tips: PyCharm has a poetry plugin |
| 54 | + |
| 55 | +## Linting |
| 56 | + |
| 57 | +It's advisable to run black with default rules for linting |
| 58 | + |
| 59 | +```sh |
| 60 | +sudo pip install black # Black should be installed with a global entrypoint |
| 61 | +black . |
| 62 | +``` |
0 commit comments