flashbots


Nameflashbots JSON
Version 1.1.1 PyPI version JSON
download
home_pagehttps://github.com/flashbots/web3-flashbots
Summaryweb3-flashbots.py
upload_time2023-01-25 06:02:27
maintainerzeroXbrock
docs_urlNone
authorGeorgios Konstantopoulos
requires_python>=3.9,<4.0
license
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            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 the `flashbot` method which injects the correct header on POST.

## Quickstart

```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](./examples/simple.py) for usage examples.

### Goerli

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

```python
flashbot(w3, ETH_ACCOUNT_SIGNATURE, "https://relay-goerli.flashbots.net")
```

## Development and testing

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

## Simple Goerli Example

See [examples/simple.py](./examples/simple.py) for environment variable definitions.

```sh
poetry shell
ETH_SENDER_KEY=<sender_private_key> \nPROVIDER_URL=https://eth-goerli.alchemyapi.io/v2/<alchemy_key> \nETH_SIGNER_KEY=<signer_private_key> \npython examples/simple.py
```

## 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 .
```

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/flashbots/web3-flashbots",
    "name": "flashbots",
    "maintainer": "zeroXbrock",
    "docs_url": null,
    "requires_python": ">=3.9,<4.0",
    "maintainer_email": "brock@flashbots.net",
    "keywords": "",
    "author": "Georgios Konstantopoulos",
    "author_email": "me@gakonst.com",
    "download_url": "https://files.pythonhosted.org/packages/05/2a/c30bf0bf366f5772b535731912d6307363183b3179da3f5e426aec6ef446/flashbots-1.1.1.tar.gz",
    "platform": null,
    "description": "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`.\n\nTo apply correct headers we use the `flashbot` method which injects the correct header on POST.\n\n## Quickstart\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](./examples/simple.py) for usage examples.\n\n### Goerli\n\nTo use goerli, add the goerli relay RPC to the `flashbot` function arguments.\n\n```python\nflashbot(w3, ETH_ACCOUNT_SIGNATURE, \"https://relay-goerli.flashbots.net\")\n```\n\n## Development and testing\n\nInstall [poetry](https://python-poetry.org/)\n\nPoetry will automatically fix your venv and all packages needed.\n\n```sh\npoetry install\n```\n\nTips: PyCharm has a poetry plugin\n\n## Simple Goerli Example\n\nSee [examples/simple.py](./examples/simple.py) for environment variable definitions.\n\n```sh\npoetry shell\nETH_SENDER_KEY=<sender_private_key> \\nPROVIDER_URL=https://eth-goerli.alchemyapi.io/v2/<alchemy_key> \\nETH_SIGNER_KEY=<signer_private_key> \\npython examples/simple.py\n```\n\n## Linting\n\nIt's advisable to run black with default rules for linting\n\n```sh\nsudo pip install black # Black should be installed with a global entrypoint\nblack .\n```\n",
    "bugtrack_url": null,
    "license": "",
    "summary": "web3-flashbots.py",
    "version": "1.1.1",
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "40d9806908319ec53375297ece08dd1ad00af8becb5d63c236e2a7023a50bb22",
                "md5": "c010b9c22a3a3010227271cbf1451989",
                "sha256": "d919d633b026ffec8bd65cd53d68f54dc98d41d299a6b4d31c2e16d4e1e87b36"
            },
            "downloads": -1,
            "filename": "flashbots-1.1.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "c010b9c22a3a3010227271cbf1451989",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.9,<4.0",
            "size": 10042,
            "upload_time": "2023-01-25T06:02:25",
            "upload_time_iso_8601": "2023-01-25T06:02:25.197950Z",
            "url": "https://files.pythonhosted.org/packages/40/d9/806908319ec53375297ece08dd1ad00af8becb5d63c236e2a7023a50bb22/flashbots-1.1.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "052ac30bf0bf366f5772b535731912d6307363183b3179da3f5e426aec6ef446",
                "md5": "3a4b84f299a249d001c5e781017c8d6d",
                "sha256": "94e7c768d6d5072271defccba39310ff3ac69ef6845b6a6ac188e679c9488ac0"
            },
            "downloads": -1,
            "filename": "flashbots-1.1.1.tar.gz",
            "has_sig": false,
            "md5_digest": "3a4b84f299a249d001c5e781017c8d6d",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.9,<4.0",
            "size": 9975,
            "upload_time": "2023-01-25T06:02:27",
            "upload_time_iso_8601": "2023-01-25T06:02:27.740654Z",
            "url": "https://files.pythonhosted.org/packages/05/2a/c30bf0bf366f5772b535731912d6307363183b3179da3f5e426aec6ef446/flashbots-1.1.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-01-25 06:02:27",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "github_user": "flashbots",
    "github_project": "web3-flashbots",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "flashbots"
}
        
Elapsed time: 0.03604s